I’ve developed a quick and easy little wordpress plugin that will add Google Analytics tracking code to any absolute links in a post/page. You can go to the plugin home page at http://wordpress.org/extend/plugins/xooanalytics/. It basically just searches the post content for a regular expression match for a link. If the link contains an absolute URL, then it adds the urchinTracker() function as an onclick event. When a user clicks on that link, the urchinTracker function saves that click as a hit on that link.

The code appends ‘/external/’ to a link and ‘/mailto/’ to an email address, so you can filter all of your hits with the ‘contains /external/’ or ‘contains /mailto/’ section and you’ll only see results to external links from your posts/pages.

Requirements, you must have the Google Analytics code just below the opening <body> tag of your page, rather than at the bottom of the page before the closing </body> tag. Otherwise, your page will throw a JavaScript error. Read the rest of this entry »

If you enjoyed this post, make sure you subscribe to my RSS feed!

Bookmark: del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Windows Live Furl Yahoo Ask Newsvine Simpy Backflip Spurl Squidoo