ASP.NET 2.0 Resources

Powered by Blogger

Tracking AdSense clicks with Google Analytics

UPDATED: there is updated version available - AdSense tracking script v2

There are quite a few adsense click tracking systems/scripts around, but i was not satistied with any of them. Partly because they were not able to track what ad units were clicked (not even mentioning specific Ads and AdLinks keywords). But also mainly because their lack of advanced reporting capabilities. I'm using Google Analytics on my sites and i really like that user interface and reports, so i was looking for a way to integrate AdSense tracking with them.

The AdSense tracking script presented here is a result of my research. You can download free astracker.js script just now. Please first read the instuctions how to install this script and how to connect is to Google Analytics.

If you are rather interested in How to interpret AdSense clicks results with Google Analytics, please also read my post Analyzing and Interpreting AdSense results with Google Analytics

Features

  • Supports also Firefox browser
  • Tracking of clicked ad types - Type of ad unit is tracked with click. You can also setup custom type for each ad unit on page.
  • Tracking clicked URLs and Keywords - URLs or AdLinks keywords are tracked together with click.
  • Support for custom ad channels - You can easily setup custom channel (type) for each ad unit.

Known limitations

These are the limitation i have faced when using this script. If you know about any other, please leave me a comment and i will add it.

  • Tested and tweaked for Internet Explorer / Mozilla (Firefox) only
  • The clicks are tracked only after page is fully loaded - Click tracking is initialized when page onload event occurs, so before page is fully loaded no clicks can be tracked with this javascript.
  • Clicks resulting from AsLinks search results ads are not tracked - This happens on google seach server, so it's simply not possible to track those clicks.
  • Keyboard "clicks" are (usually) not tracked - When tabbing and pressing enter on AdSense ad, this click won't be tracked unless mouse pointer if also in AdSense IFrame.
  • Possible false keyboard clicks - This is the oposite of above. When the mouse pointer is on AdSense IFrame and the user uses TAB key to focus some of AdSense IFrames, false click could be reported.
  • False click reports when using two mice - Yes, this could really happen :)) When one mouse poiter is in AdSense IFrame and document unload event occurs (for example when some (non adsene) link is clicked by second mouse), false click could be reported.

Requirements

  • Presented AdSense tracking script adtracker.js
  • Working AdSense account
  • Google Analytics account (or profile)
  • Access to tracked web page source code and some web space to store javascript tracking code to (it's small around 3.5k)
  • Small knowledge of HTML to implement tracking script

How does it work?

Setup is quite simple. Small javascript file is added to your web page and that's it. This script listens for ad clicks and reports them to Google Analytics (analytics code has to be already installed in the web pages). Google Analytics interface is than used to interpret tracking results.

Compliance with Google AdSense TOS

This tracking script uses passive click monitoring and in no way alters code generated by Google AdSense. It does not interfere with Ad clicks directly, but simply listens for browser mouse and keyboard events and reports through Google Analytics tracking engine. I have reviewed AdSense TOS and did not find any issue what so ever. But if you want to be sure, go ask Google AdSense support for permittion first. Just don't expect simple Yes/No answer from them :)

Tracking Accurancy

The passive listening method used by this tracking script does not allow for 100% accurate click reporting. When compared to AdSense, my results are usually about 10-15% lower in Google Analytics goals. The limitations i know about are already mentioned in some of previous paragraphs. I would be really interested in how this script performs for you (especialy for higher traffic volumes).

Google Analytics integration

Integration with Google Analytics is achieved by manually calling urchingTracker when user clicks on AdSense Ad. Tracking script simulates virtual directory hierarchy to Google Analytics so you can use it's reporting capabilities effectively. This hierarchy always starts with /asclick directory (unless you modified this value), is followed by Ad group type or custom type(channel) name. The final thierd level of this hierarchy is AsSense ad URL address or AdLinks Keyword (note that this is not available for clicks from Firefox browser).

The example tracked URL will look like:
/asclick/336x280_as/www.DirectRelief.org
or /asclick/NavigBanner/www.DirectRelief.org (if you use custom adgroup names).

Setup procedure

The setup procedure constists of two parts. First you have to setup your web page to track AdSense clicks and report them to Google Analytics. Second part is about tweaking Google Analytics settings a bit to ease interpreting click retults.

And please be prepared to wait at least 24 hours before some AdSense tracking hits appear in your Google Analytics interface.

Web Page

  1. Download astracker.zip file containing all required files.
  2. Unzip and upload tracking javascript astracker.js somewhere to the web ideally directly to your web server.
  3. Add reference to this javascript to your web page directly below Google Analytics code (see the following example).
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
        _uacct = "UA-xxxxxx-y";
        urchinTracker();
    </script>
    </script src="/javascript/astracker.js" type="text/javascript">
    </script>
  4. Optionally tweak the page to support custom channel reporting - see Advanced Settings for further info.

Google Analytics

This procedure is not required, but it eases access to some type of reports so it's highly recomended. I will assume you followed this procedure in the examples how to interpret tracking results.

  1. Log on to your Google Analytics account and open settings for desired web page by clicking Edit link.
    Adsense for Google Analytics setup
  2. You should see "Conversion Goals and Funnel" pane with four goals (G1-G4). Click on the right Edit link for first goal (G1).
    Adsense for Google Analytics setup goals
  3. Set Goal URL to "/asclick" (without quotes), Goal name to "Adsense click" (without quotes) or whatever you like and finally set this goal as active (by checking Yes option for Active Goal)
    Adsense for Google Analytics setup goal details
  4. We won't setup any Funnel Navigation so you can now scroll down to Additional settings and just make sure Case sensitive option is NOT set and Match Type is set to Head Match
  5. Now scroll down click Save Changes button and we are set. From now on adsense clicks on your web page will be considered goal hits in Google Analytics.
    Adsense for Google Analytics setup goal Additional settings

Advanced settings

This AdSense tracking script supports custom channel tracking by wrapping adsense code in HTML element with specially predefined id. If you wrap your AdSense code to HTML element with id prefixed as asc_ (AdSense Contianer), the tracker will use the remaining portion of id and report is as Ad type. So for example if you wrap AdSense HTML code in div element with id asc_NavigBanner, the tracker will use "NavigBanner" instead of default "234x60_as" when tracking clicks for this Ad group.

<div id="asc_NavigBanner">
    <script type="text/javascript"><!--
    google_ad_client = "pub-xxxxxxx";
    google_ad_width = 160;
    google_ad_height = 600;
    google_ad_format = "160x600_as";
    google_ad_type = "text_image";
    google_ad_channel ="";
    google_color_border = "E8E7D0";
    google_color_bg = "FFFFFF"
    google_color_link = "E58712";
    google_color_url = "993333";
    google_color_text = "303030";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
</div>

Final URL in Google Analytics will than apear as for example /asclick/NavigBanner/www.DirectRelief.org

Using Google Analytics Reports

Google Analytics is far more powerfull when compared to AdSense reporting capabilities. But some of the reports are also possible to produce with AdSense reporting and in such cases you should always use those reports as they are 100% accurate. Also there is no actual ad revenue and eCPM tracking in Google Analytics reports so you will still have to use AdSense center for this.

How many users clicked on AdSense ads?

If you want to know absolute number of AdSense ad clicks, use Goal Tracking report (Content Optimization / Goals & Funnel Process / Goal Tracking). There you can see number of clicks graph over selected period and also total and average number of clicks.

If you're rather interested in click through rate (CTR) just use the next report Goal Conversion (Content Optimization / Goals & Funnel Process / Goal Conversion). Just note that this is different CTR as oposed to AdSense reports (it should be higher). Google Analytics shows you visitors CTR as oposed to page views CTR showed by AdSense reports.

Adsense for Google Analytics tracking user clicks

How do I know what ad types users click the most?

As usually Google Analytics has a report prepared for you. Just navigate to Content Drilldown report (Content Optimization / Content Performance / Content Drilldown). And navigate further to asclick subtree by clicking on it's icon. Now you can see different ad types in the table and also their number of visits (unique vistitor clicks) and page views (ad clicks).

Adsense for Google Analytics tracking clicked Ad types

You can see on this sample picture that i have used custom channel tracking and reporting. If you navigate even further and click on concrete ad type, you can even see how different banners or AdLinks keywords perform and what are your visitors most interested in!

Adsense for Google Analytics tracking clicked Ad texts

There are no real data on those pictures. These were taken as I was testing tracking script. But with real world data even more may be concluded...

  • If you look at Pageviews and Visits numbers in the sample, they are the same. But in real world use, they will probably be different. Pageviews can be interpretted as absolute number of Ad clicks, but the number in Visits column would not count repeated clicks by single visitor.
  • Avg Time is also very interesting. This is the average time the user stayed on the page (the page he was sent when clicking at the Ad) in case he then returned back to your page. You can see what Ads your users don't like and are comming back to your pages fast.
  • % Exit show you how many users did not come back to your pages at all and stayed on Ad page (we are of course talking about one user visit).

It's also possible to get an overview what ads are clicked the most without navitation Content Drilldown structure. We will use Goal Verification report for that (Content Optimization / Goals & Funnel Process / Goal Verification). The sample report is visible on the following picture. There is clearly visible what Ad URL's and Ad types are clicked most.

Adsense for Google Analytics tracking clicked Ad texts

How do I know what pages generate most clicks?

This one is also quite simple. We will use integrated goal tracking for this report. Specifically Defined Funnel Navigation and Reverse Goal Path reports (Content Optimization / Goals & Funnel Process / Defined Funnel Navigation). As we have not defined any funnel navigation path you can see the AdSense clicks directly in the first report. Note that only 5 most effective pages are displayed on screen. If you want to see all pages use text export by clicking the T button on top.

Adsense for Google Analytics tracking most clicked pages

You can also use Reverse Goal Path report. There you can see what navigation paths lead to most AdSense clicks.

Adsense for Google Analytics tracking most clicked navigation paths

Google Analytics Notes

Presented were only the most basic Google Analytics reports. There is far more power hidden inside Google Analytics reporting but i want to keep this post as short as possible. So if you are interested in other reporting posibilities, please also read my other post: Analyzing and Interpreting AdSense results with Google Analytics

44 Comments:

  • Thanks for this script and tutorial. I added it to my blogger.com blog. Now I just have to be patient until the data starts rolling in.

    By Blogger Will, at 4:28 PM  

  • Hi,

    good script and tutorial! anyone tryed yet?

    By Blogger Dudlydum, at 6:36 PM  

  • Hi,

    I installed this script today and after a few hours went to Google Analytics to see all my lovely new Adsense stats but alas there was none.

    So I started to look through the code and the installation instructions in your blog entry and I spotted the problem. In your installation instructions the script tag that references the javascript file has an extra / in the opening script tag

    i.e.
    /script src="js/astracker.js" type="text/javascript"

    Note the extra forward slash.

    I can't wait to get this script working :) Great blog entry, thanks!

    // Frank

    By Blogger seo ireland, at 1:57 AM  

  • hi

    should there be a forward slash at the start on the script tag

    By Blogger Harpreet Parmar, at 4:18 PM  

  • Thanks for your script. I have idea to install it to my wordpress, so I make Adsense Tracker plugin. I want to distribute it for free, perhaps I need your permission. I don't publish it yet, just waiting for your permission. May I know your email, so I can send you a copy of my plugin. Thank you so much... my another blog is here: http://www.supriyadisw.net

    By Blogger supriyadisw, at 9:09 AM  

  • supriyadisw: Hi, the script is absolutely free so you can use it, change it, update it and of course distribute it with your wordpress plugin.

    Just post here link to your plugin, so everyone is able to find it easily :)

    By Blogger dolly, at 9:43 AM  

  • Dolly,
    Thank's so much. Here my link: http://www.supriyadisw.net/2006/07/adsense-clicks-tracker Have a great day and good luck...

    By Blogger supriyadisw, at 7:05 AM  

  • anyone tried this with YPN?

    By Blogger Dan, at 9:30 PM  

  • is there any way to combine adlogger and analytics script in one, bcoz adlogger script can block invalid clicks.. If possible then it will be great...

    I have both adlogger and analytics installed on my site http://www.meethere.org

    By Blogger Hitesh Shah, at 9:13 PM  

  • I have a theory on the accuracy, and I don't think it's the script's fault: once a visitor meets a goal in analytics, it cannot be re-met. I've yet to find any goal at all where a single user got 200% on anything.

    What this means is that it probably is only tracking one ad click per visitor. If most of your visitors only click on one ad during their visit, you might only get the odd 10-15% discrepancy. If, however, most of your users click on 2 or more ads on average, you're... screwed?

    I don't know. I'd love for dolly or anyone to get back to me on this theory, cuz it's really doing my head in that I'm only getting about 50% of my clicks reported.

    rogermota (at) gmail

    By Blogger rogermota, at 3:30 AM  

  • Hi,

    Just a wonderful tool!


    I wonder if I could translate this web page to Japnanese.

    I'm a Japanese Intenet Marketer living in Japan.
    I would like to introduce this tool to my Japanese clients.

    Sure I will refer to your web site.

    Thank you very mach.

    By Blogger suzuki k., at 4:17 PM  

  • Hi,

    Thanks for the article - put the approach for my personal site and it works just great!

    I wonder may be you would be interesting in using ASP.NET 2.0 web controls to render Google AdSense code:

    http://AdSenseASP.NET/2.0-WebControls/

    They are configurabe from web.config so you could setup publisher id, channels, color palettes, etc from single place or on page by page basis.

    Thanks again,
    Alex

    By Blogger ASTerus, at 4:33 PM  

  • This is great! Thanks!

    By Blogger juliuss, at 9:16 PM  

  • Dolly,

    Thanks so much for the tutorial and script.

    I have a question....If I am on the other side of the traffic. let's say I receive the traffic myself from the adsense ads, ie. I advertise on adsense, how do I know which sites send me the traffic?

    Thanks,

    By Blogger noorodeen, at 5:08 AM  

  • Hi dolly,

    Thx for this excellent script.
    I am trying to send the datas to my own php script, not to analytics.

    The problem is, that i dont know how i must change this line in your javascript.

    // this could be replaced with other tracking sw...
    reportToGoogleAnalytics(reportedUrl)

    only with window.location.href='xxx'; ?

    Thx for your help!

    Best regards from austria!
    Max

    By Blogger max479, at 7:38 PM  

  • This comment has been removed by the author.

    By Blogger max479, at 7:41 PM  

  • Hii,
    can i use this on new blogger? if Yes then is the procedure same as you mentioned on this post for blogger also ?

    Best Regards,
    Eliena Andrews

    By Blogger Lovely, at 8:49 AM  

  • Hi, thanks for this excellent tool - I got it working in 10 seconds.

    However, I don't get the data on which ad was clicked (the URL) as in your example. When I go to Content Drilldown, I only get a listing of adgroups and the number of clicks for each.

    See here: http://www.maxfreak.com/diablo2/images/adsense.png

    It's still useful 'cos I can see which pages perform best but I'd love to be able to see the URLs.

    Oooops. I just figured it out. Google Analytics' new beta is messing it up. If I login using the previous one, it gives me URLs - though only 9 out of 2000+ clicks overall.

    By Blogger Diablo, at 1:44 PM  

  • Dude that is so sweet! Why doesn't google implement this? It might run better if you host urchin.js locally.

    By Blogger Mr Apache, at 6:38 PM  

  • This not work with blogger!!!
    How Can i upload script to blogger site????

    By Blogger Rodrigo Meléndez, at 5:09 PM  

  • This is great :D thanks!

    By Blogger Kamil, at 9:37 AM  

  • Allo! I think it may not be working with the new google tracking code 'ga.js'! Can you make it work? :D

    By Blogger Kamil, at 7:51 AM  

  • @Kamil:

    Yes it's possible to use the script with the new ga.js script.

    Change the following lines:

    #16 and #124
    urchinTracker ('/asclick');
    to
    pageTracker._trackPageview('/asclick');

    This should do the trick.

    By Blogger Johan, at 9:19 PM  

  • Great script! I was looking for this, and it fits my need perfectly. Great job!

    David Webb: Photographer

    By Blogger David, at 11:34 AM  

  • And thanks johan for the new gs script. This is really helpful.

    David Webb

    By Blogger David, at 11:44 AM  

  • for the ga.js script; where to change in lines #16 and #124????

    I searched the whole astracker.js file but did not find urchinTracker ('/asclick'); ???

    please help.

    BTW: Love the script! ( urchin.js !)
    Roy Mohan
    www.fotogaaf.nl

    By Blogger Fotogaaf-Roy Mohan, at 3:52 AM  

  • Note: The new script has been changed. If you want to use the new ga.js tracking script in GA, you no longer replace lines #16 and #124. Look for "urchinTracker(reportedUrl);" at line #142. Change this to "pageTracker._trackPageview('reportedUrl);" Your script should work fine.

    The Script is working well on my site, although not reporting all my clicks. It gives me a rough idea though - it's better than the Adsense reports!

    Cheers,

    David Webb: Photographer, Programmer and Neighbourhood Geek Guy

    By Blogger David, at 8:33 AM  

  • Hi,

    I implemented ur script, but in content drill-down, i cant go beyond asclick/360*280 ...

    I mean it shows the adblock, but not exactly the ad url or ad which was clicked from that adblock

    How do i achieve that. Can you please tell me at vinit05@gmail.com

    Thanks
    Vinit

    By Blogger unexplained, at 6:17 PM  

  • could you tell me how can I upload in blogger,I tried but failed

    By Blogger PAYAMARCHI, at 9:03 AM  

  • Nice tracking system you got there. I will be promoting this tracking tool in my website. I provided a hyperlink for my users. Keep it up dolly.

    Money Making and Blogging Tips

    By Blogger PALS, at 2:27 PM  

  • need more about blogger tips,blogging money,money tips, just visit http://exclusivz.blogspot.com
    http://onlinemoneypins.blogspot.com

    By Blogger rarcntv, at 10:27 AM  

  • Your blog is very nice...
    visit my blog asp.net example

    By Blogger Rem, at 3:58 PM  

  • ===>> http://www.abid.in

    Here's your chance to make $40,000 per month with
    Adsense by being lazy.....


    Wanna Find out How I, By Being a Lazy Ass Make $40,000/Month
    (Yep, that's 40,000 USD) Every Month Like Clockwise From My Web.site.


    ===>> http://www.abid.in

    The Website Is.

    * Highly Optimized
    * Content Rich
    * Profit Pulling
    * Fully Automated

    Here's What You Get:

    A Huge Money Making Website
    Integrated with Adsense ads,
    dynamic feeds and over a thousand content pages.


    My Free Traffic Report
    Methods I use to get a lot of traffic, almost instantly.

    Free Email Tips
    You will get some EXTRA tips on promoting your new website by email.

    Setup and Hosting Help
    Even though you get full easy to follow setup instructions.
    If you still have trouble you can contact us
    we will set up and host your website for you.


    ===>> http://www.abid.in

    As an special offer, I am offering my complete Adsense Treasure System A fully automated website which makes you money while you sleep.

    Finally a tool for you to make some serious money.

    Get Your Copy Now... Click here

    ===>> http://www.abid.in

    Ready Made Website






    Shah Rukh Khan

    Bollywood

    ShahRukhKhan



    India's Online Shopping Mall

    Online Shopping Mall

    Buy Online


    Link Directory
    The Most Responsive FREE Safelist
    Make Money Online
    Master Resell Rights eBooks
    Bollywood Sargam

    By Blogger Abid's Adsense Treasure Website Package, at 1:34 PM  

  • I installed this script on my site,but in google analytics I don't see which ads my users click most.I look arround in content drilldown and Funnel Visualization,but I only see asclick or entrance,but I can't click on it to see on wich ads my user click.

    By Blogger horoskop, at 9:58 AM  

  • Thanks for the nice post. Website hosting

    By Blogger dpanupam, at 8:04 AM  

  • Good job. I appreciate it all!

    Search the internet - internet tips online - free finance info

    Finance Tips

    By Blogger venn99, at 10:35 PM  

  • By Blogger anxin, at 8:32 AM  

  • By Blogger cara, at 6:01 AM  

  • The author has written an excellent article. You have made your point and there is not much to argue about. It is like the following universal truth that you can not argue with: No truth is universal, everything has its exception. Thanks for the info http://www.bestpenisproducts.com

    By Blogger Penis Enlargement Pills, at 10:29 PM  

  • By Blogger JEY, at 8:45 PM  

  • I can see that this is the most accurate way to track adsense click. All the information that I need to know it more is in this post.

    social media agency

    By Blogger aldrin james, at 8:16 AM  

  • Thanks for this script. It's cool.
    evaluate the site игры для девочек

    By Blogger Федя Пупкин, at 8:38 AM  

  • The best services are those who students need mostly. The cheap editing services are basically that one and it help a lot students.

    By Blogger aliya seen, at 3:44 PM  

  • Crazy bulk is one which provides a well known function of increasing the muscles in your body. if you want to make body to click here ----> http://www.buycrazybulks.com/ crazy bulk http://www.buycrazybulks.com/

    By Blogger Lilly Saloo, at 8:08 PM  

Post a Comment

<< Home

Created dolly