Track Multiple Authors with Google Analytics
On a multiple author site, each author can post in a multitude of categories, it’s nearly impossible to identify each author’s contributions to the overall strategy of the site. I was doing some testing with this recently and identified a nice simple way of measuring traffic by each author.
Google Analytics has the ability to track additional virtual pages. This is typically utilized to track outbound links to advertising or calls to action to landing pages. However, by simply manipulating your Google Analytics code on your single post pages, you can track the popularity of individual authors.
Typical GA code on a page looks like this:
var pageTracker = _gat._getTracker("UA-XXXXXX-X"); pageTracker._initData(); pageTracker._trackPageview();
You can insert a ‘virtual’ pageview by adding the following:
var pageTracker = _gat._getTracker("UA-XXXXXX-X"); pageTracker._initData(); pageTracker._trackPageview("/by/author/Douglas Karr"); pageTracker._trackPageview();
To customize for WordPress:
var pageTracker = _gat._getTracker("UA-XXXXXX-X"); pageTracker._initData(); <?php if (is_single()) { ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> pageTracker._trackPageview(?/author/<?php the_author() ?>?); <?php endwhile; ?> <?php } ?> pageTracker._trackPageview();
UPDATE: A couple of commentors pointed out that it didn’t work – I had to add the famous WordPress loop in!
This will only load the necessary pageview on a Single Post page. You may want to extend this to monitor the first post on the home page as well, but this is at least a start. Within Google Analytics, you can open a Content Report and simply filter it by “/author/” to get a list of all of the authors and their associated page views, bounce rates, time on page, and conversions.
Now you can begin rewarding your authors for the actual contribution they bring to your organization! Let me know if you run into issues using WordPress – I wrote the code and didn’t test it.