Tracking Clicks on Ads With Google Analytics

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. 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.

Post Comment


1 of 1 Next Page

@ari You won't specifically be able to use this feature of Google Analytics without being able to modify the website's code. There are some banner ad creation tools that allow you to create an ad that contains a tracking script which will count clicks. Obviously that would mean you'd be handling some design work, but it's an alternative. Check out Banner Snack as an example:

Posted by Steve Hill on December 26, 2013 @ 11:07 am

Hello,I was provided a website from the company for my business, but we are unable to modify those websites. How can I possibly use this tool? I don't think the company will allow us to modify any coding on the websites they provide. Is there any other way or methods to track the clicks on my ads?

Posted by Ari Garibaldo on December 17, 2013 @ 9:21 am

Appreciate this post. Will try it out.

Posted by Mauricio on October 19, 2013 @ 5:58 am

I am not sure where you're getting your information, but great topic. I needs to spend some time learning much more or understanding more. Thanks for great info I was looking for this info for my mission.

Posted by Reyes on October 19, 2013 @ 4:56 am

Thanks for this. How would you suggest we also track impressions by ad using GA?

Posted by Jeff on July 8, 2013 @ 6:31 pm

I find this content very useful. I have few more queries related to this practice. What is the difference between total events and unique events? E.g, One of our client placed an ad at the top of the page. Google analytics shows 39 unique events and total events are 57 in last one month.

Posted by Debangan Bhattacharyya on December 9, 2012 @ 11:46 pm

Hey Search Engine Optimization Compa, you can insert the first code, but the second code is a custom anchor text tag that will need to be edited depending on the url and anchor text you are tagging.

Posted by Steve Hill on February 3, 2012 @ 3:16 pm

Could I try to insert the html codes above to put on my blog site?

Posted by Search Engine Optimization Compa on December 16, 2011 @ 4:19 am

Thanks for sharing. Great post.

Posted by Robert Jones on November 30, 2011 @ 4:11 pm
1 of 1 Next Page
Subscribe to Our RSS Back To Blog