Tracking Hosted WordPress Blogs With Google Analytics

The only thing that really bugs me about using a WordPress-hosted blog is the auto-removal of Javascript from posts and template elements (widgets). They say this is for security reasons, and since I haven't paid dollar-one for four years' use of what is actually a very good blogging platform, I'm not going to make too much of a fuss about it.

Much of the day-to-day stuff that would require Javascript can be done using custom tags and widgets Рembedding video, Flickr galleries, RSS feeds and the like. Analytics, on the other hand, is kinda frustrating. The WordPress forums are full of people wanting to know how to deploy Google Analytics to hosted WordPress blogs, and the answer is always the same Рyou can't. GA requires the embedding of a piece of Javascript on every page. WordPress hosted blogs strip out Javascript. Thus, Google Analytics is a no go.

Or is it?

I found this site a few weeks ago, while looking into some Facebook reporting issues – a rather simple app that allows you to embed a hosted image in a Facebook page, and which runs the Google Analytics tracking script each time that image is requested. On a whim, last night I thought I'd see if it worked with my WordPress blog, and whaddya know – it did!

It's far from perfect – for example, each unique image can only report on one page at a time (i.e. the whole blog is counted as one page), as Javascript would be required to dynamically pull in the filename and post title – but it's a hell of a lot richer than the standard WordPress blog stats. If you want to know what your most popular posts are, you can get that info from WordPress, but for everything else – unique visitors, top referrers, visitor demographics etc – Google Analytics seems to do just fine.

It's early days, and time will tell if the data I'm seeing is accurate or useful (hopefully both). Looking good so far though. Give it a try and let me know how you get on, hey?

Tracking image generator: http://ga.webdigi.co.uk/

*Update*

I’ve had a few people ask about implementation, so here goes:

  1. Create a new Google Analytics profile for your hosted WordPress blog
  2. Grab the Google Analytics ID for your new profile (looks like this UA-3123123-2)
  3. Complete the form here – http://ga.webdigi.co.uk/ – to generate your tracking image code. Copy this to your clipboard.
  4. Log in to your WordPress console, and then go to Appearance -> Widgets
  5. Create a new ‘Text’ widget, and drag it to your sidebar.
  6. Paste the tracking image code into the body of the text widget. Leave the title blank.
  7. Save and close the text widget.
  8. Done!

6 thoughts on “Tracking Hosted WordPress Blogs With Google Analytics”

  1. Hi there,

    I have tried what you said in the post but it appears it’s not working in GA. I know meantime WP has changed the platform many times and that’s the reason I decided to ask you if this still works for you.

    Best regards,
    Schummy

    Reply

Leave a Comment