Home arrow Web Design Blog arrow How do I manually track clicks on outbound links?

How do I manually track clicks on outbound links? PDF Print E-mail

Google Analytics provides an easy way to track clicks on links that lead away from your site. Because these links do not lead to a page on your site containing the UTM JavaScript, you will need to tag the link itself. This piece of JavaScript assigns a pageview to any click on a link - the pageview is attributed to the filename you specify.

For example, to log every click on a particular link to www.example.com as a pageview for "/outgoing/example_com" you would add the following attribute to the link's tag:

 
<a href="http://www.example.com" 
onClick="javascript: pageTracker._trackPageview('/outgoing/example.com');">

It is a good idea to log all of your outbound links into a logical directory structure as shown in the example. This way, you will be able to easily identify what pages visitors clicked on to leave your site.

To verify that _trackPageviewis being called correctly, you can check your Top Content report 24-48 hours after the updated tracking code has been executed. You should be able to see the assigned pagename in your report.

This article source from here.

 
Next >