Recently I needed the ability to track outbound/external links to one of my affiliates from my website, Husky Floor Liners. I love using the the “Site Overlay” feature in Google Analytics, but noticed that all of my prime links were showing that 0% of visitors were clicking on them! I then decided to change the links that were getting clicks to affiliate links, so that hopefully my sales would increase. After a few days, I went back into the Google Analytics Site Overlay feature and saw that now almost all of my links were getting 0% clicks. I then figured out that Google did not track clicks to external websites, and that the site overlay feature was ONLY for internal links. Blast.
My Solution
I began doing a lot of research, and found that it was possible to track external link clicks with Google Analytics using a little piece of Javascript in the link code. Here is the article on tracking outbound link clicks from Google Analytics.
The article was good, but I still had a few questions that took time to find answers to. After talking to my friend Amelia, who had already figured it all out, it became clear to me. I thought I would simplify the instructions and answer them here in a way that I could understand.
- Your Google Analytics code needs be at the top of the page in order to use the External Link Click tracking feature in Google Analytics. So, if you area already using Google Analytics, move the tracking code from the bottom of your page, to right after the <body> tag of your page.
- Add this code to your links: onClick=”javascript: pageTracker._trackPageview(’/outgoing/example.com’); For example, if you were linking to my site:(<a href=”http://andyisaacson.com” onclick=”javascript: pageTracker._trackPageview(’/outgoing/dumbwebguy’);”>andyisaacson.com</a>)
- Change the “/outgoing/example.com/” to whatever you want. You do NOT have to create that actual directory on your website. Whatever you put in the _trackPageview variable will show in your Google Analytics. So, if you want to specifically track a link to my website from your website, you could put whatever you want in there to help you remember. You could put: /outgoing/andyisaacson.com, /outgoing/dumbwebguy, /guythat/thinksheknowssomething, or anything. Just make sure that you dont have that actual directory on your website.
There you go! Its really easy. Like I said, the part that stumped me was what to put in the “/outgoing…”. The answer is that it does not really matter.
Now, use this feature to your advantage. In my situation I wanted to track every external link on my site to see which one had the best click-through’s. Unfortunately, the Google Analytics External Link Clicks do not track with the Site Overlay feature. However, you can still figure out which links are doing the best by seperating the tracking directories. I created a new tracking directory name for each link on my site. Here are some examples:
/huskyliners/buynowbutton
/huskyliners/homepagepicture
/huskymats/moreinfolink
I tried to simplify this and explain things as best as possible. Hopefully I did not make things more confusing. If you have any questions, please post in the comments box below.











