I love WordPress. And I love Yoast’s Google Analytics plugin for WordPress. It makes installation of GA so much swifter. And I really hate hacking plugins because that means I have to be careful when I upgrade them. But there are two things that really stick in my craw:
- The RSS campaign tags are configured so that each article is it’s own campaign.
- I’d love to be able to implement additional tricks, like using a timer to make my Bounce-rate a function of time, not pageviews.
Campaign Tagging URL for RSS hack in WP
Since the (super-awesome) plugin doesn’t allow you to manually configure the tagging for the RSS feed, I had to go in and do it myself. You find the code for RSS tracking around line 560 in the plugin code. It’s all hard-coded and easy enough to adjust.
I set mine up so that the post headline is matched up with the utm_content tag, so that it accurately reflects the content of whatever it was someone clicked on.
Time-based bounce-rate for Google Analytics and WordPress
I got the idea to make a time-based bounce-rate from Padicode. But instead of hardcoding WP into my site template, I had to hack the Yoast plugin. You’ll find the location to insert a timer into your GA tracker around line 400 of the plugin code. You’ll need to escape some characters so the line will ultimately look something like this:
echo "\t\t".'setTimeout(\'pageTracker._trackEvent(\'NoBounce\',\'NoBounce\', \'Over 20 seconds\')\',20000);'."\n";
Good luck and have fun!