How to Track Links in Google Analytics
Google Analytics allows you to track how often viewers on your website click particular links on your website. Links to internal pages are automatically tracked, however you must add JavaScript code to links that point to pages outside of your own website in order to track them.
Instructions
-
-
1
Set up the links you wish to track. Add JavaScript code to each link you wish to track, so picking only the links you really care about saves effort.
-
2
Open the web pages with the links in your web page editing software. Locate the link you would like to track.
-
-
3
Add the following JavaScript into your "A HREF" tag, before any other code used by Google Analytics:
<br>onClick="javascript: pageTracker._trackPageview('/outgoing/sample.com');"<br>
Change the portion in the parentheses to the location you would like to have listed in your tracking report. -
4
Save the web page file. Upload it to your website.
-
5
Verify that your links are being tracked by checking your log in Google Analytics after a day or two. Your links appear in the "Top Content" report. The links you added tracking code to should now appear in the report.
-
1
Tips & Warnings
Be aware that the directory specified in your code (in this example, /outgoing/sample.com) is how your link will be logged. Consider creating a logical directory structure for your links so that you can review the links more easily.
If you are not using the most recent version of Google Analytics, this code may not work for you. Read the help information provided for your version of Google Analytics to find out how to track links in the version you are using.