Tracking Clicks on Ads With Google Analytics

Posted on November 23, 2011

As the importance of having valuable content on websites continues to increase, the demand for advertising space on those sites grows. Advertisers want to get their messages in front of people in the most targeted, cost-effective, and relevant ways possible. Good content naturally attracts both website traffic and the attention of advertisers, so site owners are finding opportunities to make more money with their websites.

Of course, no advertiser is going to want to place ads on a site without knowing the amount of traffic they are getting from it. Likewise, most website owners don’t have the tracking tools like Google Adwords or Microsoft Advertising do to quantify how much traffic they are sending to their advertisers. Most websites use Google analytics for tracking activity, but anything that happens after a user first comes to a page is not tracked unless they go to another page on your site. This is because the cookies that are used by Google Analytics are set when a user first views a page, so you can’t track clicks on an advertisement without some special coding.

So how do you track which advertisements visitors to your website click on in Google Analytics? In order to track clicks on an advertisement, you do need some special coding, but the good thing is that you don’t need to be a web development expert to do it.

The first step is to add some additional javascript code just after the Google Analytics code snippet on every page of your website where advertisements are used. The code you will need to add looks like this:

If you don’t know where your Google Analytics code is, simply look at the source code of your website and search the page using the control+F or command+F function for “ga.js”. Once you’ve found this code, copy and paste the code you see above right after it. This code will slow the load time of the advertiser’s website to allow enough time to track the outgoing visitor.

The next step is to add some additional tagging to the anchor text of links used for advertisements on your website. The anchor text you will need to add is in bold text below. Advertiser1.com is merely a placeholder so be sure to update that with new URL for your each of advertisers depending on which ad you are tagging.

Once you have these updates to your website’s code made, you’ll want to give Google Analytics 2 or 3 days to populate data. Remember, if no one clicks an ad nothing will be tracked, so it’s a good idea to click on an ad from another computer for testing.

The final step is to view the newly tracked data in the Google Analytics interface. I should note that Google is currently changing the interface to a new version, which will fully be launched on January 1, 2012. If you’re using the old version of Google Analytics you will be forced to switch by that time.

Below you’ll see a screen shot of the new Google Analytics interface including where to find information about clicks on ads. This information is all housed in with the Events section of the Content Report found in the sidebar. In order to view how many clicks each advertisement received, click “Event Action.” This will then provide you a list of the advertisements that received clicks and how many clicks they received. Each event represents a click on an ad.

If you’d like to more help on tracking clicks to advertisements through Google Analytics, see this helpful tutorial on Outbound Links.

Lets Chat