Google Analytics for WordPress MU – single blog AND sitewide!

The bane of many a WPMU site owners life has been the question of how to give your users access to Google Analytics, while being able to use it yourself for sitewide statistics.

Well, we’re about to let you have your cake and eat it too :)

Presenting – Google Analytics for WordPress MU – a plugin that does exactly what you’ve always weanted it to do :)

Essentially it allows you to simply enter your ‘UA’ code into a new field in Site Admin > Options AS WELL AS allowing your users to enter their code in Settings > Google Analytics.

And, they will both work together! Oh frabjous day etc. :)

And if that’s not enough to make you go ‘Callooh! Callay!’ – well, we’ve also integrated this into our ‘Supporter’ framework – so you can restrict access to the individual stats to to paying users only (if you wish). Just visit Site Admin > Supporter once it’s installed to set it to free / paid.

Enjoy the statistical goodness!

google analytics for wordpress mu in action

Comments (14)

  1. Nice plugin James, we had a go at this and found we couldn’t get both sets of stats working at the same time in MU (that was before the last GA code update).

    Jamie, good luck with your plugin development effort. Just because WPMU might look easy from the outside doesn’t mean it is.

  2. by working?… that plugin works quite fine. Been using it for some time on our WPMU install.

    even modified it a bit to pass on subdomain info. to google so the main site analytics aren’t filled relative URLs owned by other sites.

  3. Oh.. sure.. it’s not really hard to do, but here it goes –

    Using the following plugin:
    http://wpmudev.org/project/Google-Analytics-Plugin-For-Wordpress-MU—Revised–English

    …edit rafik_ga.php

    Starting after lines 38, and 53, you will notice the following code:
    var firstTracker = _gat._getTracker(“‘.$site_urchin.’”);

    …insert after that,
    pageTracker._setDomainName(“.your.domain.here.com”);

    …then, after line 67, where it says:
    var firstTracker = _gat._getTracker(“‘.$site_urchin.’”);

    …insert:
    firstTracker._setDomainName(“.your.domain.here.com”);

    Keep the first period before the domain! It’s there on purpose…
    Now, go into Google Analytics, and setup the following ADVANCED filter:
    Filter Type: Custom filter > Advanced
    Field A: Hostname
    Extract A: (.*)
    Field B: Request URI
    Extract B: (.*)
    Output To: Request URI
    Constructor: /$A1$B1

    ..more google documentation can be found at
    http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55524

    Then, when viewing your google analytics for your WPMU sites, you will get to see traffic for all content with that sites subdomain preceeding it’s page URL. e.g.: instead of seeing content as /2009/02/some-page/, you will see someonesblog.mywpmusite.com/2009/02/some-page/

    ..makes it easy to tell which sub-sites on your WPMU are really popular.

    This, however, will also record hits from your logged in users as well. I plan to add a logic check that will not display the google code if the user is logged in. I do this on other independent WP installs.

  4. Just create an account (remember not to pay) and email me yr details – you’ll be a valuable member of the community too I reckon, we’re looking forward to your perspective on things.

  5. So James, did he won? Or you can’t say because he presented a fine free solution that does the same as your paied solution. I am sorry, but it’s really hard to me see someone get paid because he do things for free plattaformns… and that keep saying how cool is WPMU. oh well, i know.. it’s me that are wrong.

Participate