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:


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 – – 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 Responses to “Tracking Hosted WordPress Blogs With Google Analytics”

  1. 1 Schummy October 26, 2010 at 1:45 am

    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,

  2. 2 Stuart Parker October 26, 2010 at 9:17 am

    It’s still working for this blog. Are you sure you completed all the set-up steps? If so, can only think maybe WordPress / WebDigi is blocking new setups. Odd.

  3. 3 cooperkaren October 6, 2011 at 3:01 am

    Works wonderfully for me, thanks!

  4. 4 harsh.baid June 12, 2012 at 6:55 am

    Thanks a lot, since a long time I was looking for solution to add my google analytics account to my blog. Thanks once again. Cheers.

  1. 1 Helpful blog on google analytics for wordpress blogs « cooperkaren Trackback on October 6, 2011 at 3:03 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: