I have recently started exploring the new Google Analytics interface and realized how powerful the AdSense integration into Analytics was. I wanted to integrate AdSense and Analytics on all my properties.
I had no problems setting up the primary domain, but noticed any secondary domain would not report the correct revenue. It seems it a fraction of the total, but per site the actual percentage was pretty much the same. After making a post on the Analytics support form and digging around I finally have found a solution that works. It turns out I was only seeing the earnings for the first ad unit on the page.
This thread here fixed the issue for me. I hesitated to even try this solution, as the post is from 2009. After running out of options I implemented the fix they suggested and it worked great. Let me explain the issue and fix in more detail.
When you setup secondary domains in Analytics you are instructed to add this code to the top of the page:
What this does is tell AdSense what your Analytics profile is in order to properly report the data. It appears that the variable window.google_analytics_uacct is only applied to the first AdSense ad unit on the page, and after that it is reset.
The fix is to modify your every AdSense ad unit code on the page by adding the window.google_analytics_uacct = “UA-XXXXXXX-XX” code at the top. Here is an example of my ad unit:
I’ve only tested this for a couple days, but everything seems to be working just fine.
I hope this helps anyone who is having issues as well.