Google Product Forums

bug: figured out why analytics only shows a fraction of my adsense revenues!

loupiote Aug 6, 2009 1:37 AM
Posted in group: AdSense in English

Categories: Products and Features :

i just figured out why analytics only shows a fraction of my adsense revenues. it's basically caused by a bug in the adsense code. on some browsers (including google Chrome and FireFox), the adsense script that displays the ad unit (or link-unit) RESETS all the google global variables to "null".

the google globals variable that are "reset" include:


this mean that you should re-assign the correct value to google_analytics_uacct before EACH ad code snipplet. the code snipplets that google provides for the ads set all the other global variable, but you need to set google_analytics_uacct.

if you don't, analytics will only register the revenues of the very first ad on your page. so if your page has several ads, there will be an enormous discrepancy.

of course this is a bug in the adsense code, since google itself assumes that the global variable google_analytics_uacct (or window. google_analytics_uacct , which is the same) only needs to be set once, as implied by their help pages:

there is no mention in that halp page that this global need to be set before EACH adsense script code.