Updated: Tracking Exit Links in Google Analytics

Posted by danny on September 27, 2008 in Google Analytics, Web Development |

I’ve just updated my code on tracking exit links in Google Analytics to skip applying the code if the href of an anchor tag is ‘#’. This is usually the case when the anchor tag is there to execute javascript or to scroll to the top of the page, thus does not contain any exit liks.

This can be found on line 29 with the addition of a condition in the condition statement, anchors[i].href != (document.location + ‘#’).

I’ve seen a few other scripts that tracks exit links but some of them I don’t think are very good as they lack error checking and also some of them overwrite the existing onclick attribute which I guess could break the site’s functionality.

Also to prove to you that my script is working, I’ve included a screenshot of the report found in google analytics.

Of course you can click through to the individual links and analyse the dimensions for further analysis. I will be working on more google analytics custom scripts to help bring and enhance more meaningful reports.

Bookmark This!

http://www.dannytalk.com/wp-content/plugins/sociofluid/images/digg_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/reddit_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/twitter_48.png

Related Posts

Tags: ,

11 Comments

Leave a Reply

Your email address will not be published. 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>

Copyright © 2006-2010 dannytalk ™ A Danny Ng Blog All rights reserved.
Desk Mess Mirrored v1.7 theme from BuyNowShop.com.