Google Analytics has gotten so many new features in the last year, that the only way I could incorporate those into my Google Analytics plugin, which has been downloaded 4,024,510 times, was by doing an almost complete rewrite. That’s why today, I’m proud to announce version 4.0 of this plugin.
What’s new with this Google Analytics plugin?
First of all, this new version 4.0 switches to the new asynchronous tracking method. This new tracking was also the reason it took a while to get this version out the door: there were quite a few bugs to work out; tracking by the beta was not reliable for a while.
What’s the advantage of the new tracking you ask? Why bother switching? Well, there are three reasons, as listed by the Google Analytics blog:
- Faster load times for your web pages due to improved browser execution of the tracking code.
- Enhanced data collection & accuracy.
If you want to know more about asynchronous scripts, check out this blog post by Steve Souders, in which he explains the concept and what it means for page load times. The short version: a normal script blocks other objects on your page, like images, from being loaded until it has been fully loaded. An asynchronous script allows for those other objects to be downloaded at the same time.
Google launched the custom variable support in October 2009, and I’ve been playing with ways to use these in tracking ever since. Custom variables are a way to add data about the current page, the current session or the current user in your tracking, which you can use for some very cool things.
I’ve been thinking and working with guys like my buddies Frederick Townes and Justin Cutroni about what you should and could be tracking. It wasn’t easy, which is why I’m very proud to show you this settings panel:
As you can see in the screenshot, you can segment by:
- Logged in users: speaks for itself, very useful on BuddyPress sites etc: where do people that are logged in go, where do others go. It stores the users primary user level in the variable, so you can even segment for just “subscribers”. (There’s an advanced option to ignore users of certain levels should you want to btw)
- Author name: track page views per author.
- Single category: if your posts are in only one category each, this allows you to track views per category.
- All categories: track multiple categories per post, a bit harder to view in Analytics, but could still be useful.
- Tags: track all tags for each post, has its limits but might be useful.
- Publication year: see what’s doing good and bad, more specifically whether your old posts are still getting traffic.
- Post type: especially with the new custom post type features in WordPress 3.0 this is very useful: if you’ve got movies, actors etc. set up as custom post types, this allows you to track how many page views each post type got.
So you could run reports showing which authors do better, which categories and / or post types get more pageviews and so on. This will provide you with the kind of analysis you need to improve your blog. I hope you’re starting to get why I’m so excited about this release. But wait, there’s more.
Google Analytics API integration
Where in the past I’d ask you to enter your “UA ID” from the backend, you can now simply click a button, authenticate with Google Analytics, select the right account and then the right profile and start tracking! Check out how easy that is:
Of course you can still enter the UA ID by hand if you want to, just check the box in the lower left of the screenshot and you’ll get an input box to enter the UA ID.
This plugin now fully integrates with both WP E-Commerce and Shopp: for both of these plugins it tracks sales using e-commerce tracking, allowing you to track where people that bought something came from, how they went about your site and which pages triggered them to buy.
All you have to do is install the plugin, and it’ll automatically detect whether you’re running one of these two plugins. You’ll then get a box like this:
In the past this plugin used page views to track downloads and outbound clicks, thereby inflating page views. I started doing this before event tracking even existed, but of course this needed to be changed. The plugin now uses event tracking for this by default, but, if you want to, you can just check a box and it’ll switch to using page views again. You can also switch to page views just for downloads, to keep your goals working the same way.
An API for this plugin
This plugin adds a couple of filters so you can add your own tracking from your own plugins without having to hassle with the rest of the tracking. The 3 filters are:
$push = apply_filters('yoast-ga-custom-vars',$push, $customvarslot); $push = apply_filters('yoast-ga-push-before-pageview',$push); $push = apply_filters('yoast-ga-push-after-pageview',$push);
Custom variables are hard to deal with, as they need to be in the same “slot” all the time, that’s why the
$customvarslot is passed along.
Go get the Google Analytics for WordPress plugin
I have to believe that I’ve convinced you by now, so please go get the plugin. Please do let me know in the comments when you’ve upgraded, and what you think I should be adding!