WordPress, multiple domains & google analytics

So why not start here with a few things I discovered whilst getting this site going. This is my first time doing anything properly with WordPress and it gets the big thumbs up from me, speedy deployment, fairly easy to fiddle with and loads of plugins to play with.

Anyway, I managed to get hold of both www.actionscriptfreelancer.com and www.keendevelopment.ch which I’m hoping will push up my ratings in search engines for these keywords, so the first problem was getting two domains to point to a single WordPress installation. This turned out to be easily accomplished using the Domain Mirror plugin and changing the tagline slightly in each site should prevent Google penalizing them as duplicates (I hope). Then it was time for some Google Analytics provided courtesy of the Ultimate Google Analytics plugin.

However I hit a slight problem here as UGA only allows a single GA account id to be entered, but GA provides two seperate ids for the .com and .co.uk address. Time for a bit of PHP coding; I updated the Domain Mirror plugin so that you can also enter a GA account id for each domain, and then updated the Ultimate Google Analytics plugin so that it uses the account id for the current domain. Note that in order to get these two to work you’ll need to add a column to the wp_options table called googleid.

Download the two plugins as a zip here!


  1. I wrote a very similar plugin to Domain Mirror call Domain Theme. It has the benefit of allowing you to select a different theme based on the visiting domain name. This can be usefull for users that want to manage content and represent it in a different way to cater to a specific user. IMHO, this alters the content and shouldn’t be subject to the ‘duplicate content’ argument. You can also specify different titles and taglines as well. Because theme templates can be so powerfull, it can be used to allow you to use a theme that omits content for one domain name and/or enhances it for another. (i.e. mobile version, where browser sniffing often fails, ‘g-rated’, larger font for seniors, etc.) Hope this helps!


  2. Dave,

    Would you consider blogging in a bit more detail about how you went about adding an extra tag to the Domain Mirror plugin?

    Would you consider creating a “hat-trick” combination of the altered Domain Mirror and UGA plugins you provide above, and your more recent Sitemaps Mirror? Or should they work fine together anyway?

    Also, was there any specific reason why you chose UGA rather the more popular Google Analyticator plugin? One confusing thing is that the Analyticator plugin doesn’t show up when you search the word “analytics” in WordPress plugins website, but it is the highest rated one when you search down through all the plugins listed by popularity. I have no idea which one might actually be better.

    Thanks for the work you’ve done on this, the holy grail for me right now is to find a way to add completely customizable tags to Domain Mirror because I believe that this will allow one installation of regular WordPress to do what so many people have been misguidedly trying to do with WordPress MU.


  3. Heya Donnacha,

    As David McAleavy has updated the Domain Mirror plugin to v1.2b since I wrote this (and apparently changed quite a few things) I don’t think there’s too much point describing the process in detail. However, basically you open up plugins/AA-Domain-Mirror/WP-DomainMirror.php and everywhere you see a bit of code relating to (for example) siteurl, just duplicate it replacing it with your new tag. e.g. googleid. Then add a column to the options database table called googleid and you are good to go.

    These two plugins were developed alongside the sitemaps mirror, so if you download the whole bunch and install them every should work fine.

    I basically used UGA because I found some comments from people who liked it – I’d never even heard of the Google Analyticator plugin πŸ™‚ I’m basically a WordPress novice with good PHP skills so it may well be that there are other and easier ways to accomplish these tasks.

    Hope that helps!


  4. Dave, yeah, that helps a lot, I’ll have a good poke around inside those files and see just how far I can take it, I have pretty big plans for this.

    I’m in Edinburgh too, so, I owe you a pint sometime. Interestingly, I think Dave McAleavy is based in Glasgow; the central belt is obviously a hot-bed of WordPress development.

    Thanks again,


  5. Excellent plugin, BUT
    It’s uncomfortable to add more than 1 domain mirror. Because you should refresh you site each time when you want to add a mirror.
    How can I have more than one adding form?
    Thank you, Alexey.

  6. Hello, I have downloaded the 2 plugins zip and installed at my wp. But there is no option of Theme Template for the different Theme option of my 2nd Virtual domain.
    Other side, I downloaded the 2.3Fix version from “mcaleavy.org”. It works with the Theme Option but no option for the GoogleID (UGA). Will you pls direct me what to do.

  7. Hey Dave!
    I have done everything written in the article and even added the googleid column in the wp_options table. The domain mirror plugin keeps the information from Google Analytics which I’ve put in, but I can’t find the UA-number in any of the three sites near the footer of the page, like on yours:
    var pageTracker = _gat._getTracker("UA-4250384-3");
    On my domains this all looks like this:
    var pageTracker = _gat._getTracker("");
    I guess the UGA plugin just doesn’t get the UA numbers. Do I have to put something into the googleid fields in the column I have created?

  8. Hi everybody. I just found out, what’s wrong with adding a “column”: you have to insert a new row named “googleid” and empty! Really easy, but cost me several hours of studying the code now πŸ˜›
    Anyway, I hope it helps at least someone except me.

  9. hey, i’m trying to accomplish the exact same thing as you, two domains displaying the same content, same installation of WP, but I cannot get Domain Mirror to work

    which version are you using? maybe i could offer you a small fee to help me work out the kink?

  10. Hi, I think your blog might be having browser compatibility issues.
    When I look at your blog site in Ie, it looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give you a
    quick heads up! Other then that, amazing blog!

  11. With havin so much content and articles do you ever run into any issues of plagorism or
    copyright infringement? My website has a lot of exclusive content I’ve either created myself or outsourced but it appears a lot of it is popping it up all over the internet without my permission. Do you know any ways to help
    protect against content from being ripped off? I’d certainly appreciate

Leave a Reply

Your email address will not be published. Required fields are marked *