Two Yoast google-analytics-plugin hacks for Wordpress

SAN JOSE, CA - JULY 22:  A plug-in Toyota Priu...
Image by Getty Images via Daylife

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:

  1. The RSS campaign tags are configured so that each article is it’s own campaign.
  2. 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!

Post to Twitter Post to Delicious Post to Digg

This entry was posted in Observation and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • Need a hand getting started?

    If you'd like help implementing the ideas expressed in this blog post, please contact Thoughtfaucet. Let's make things people like.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>