Mobile app version of vmapp.org
Login or Join
Ravi8258870

: Google Analytics does not show AdSense if you have multiple sites I have multiple sites in my Google Analytics, and under the content section, adsense revenue per page is only visible for one

@Ravi8258870

Posted in: #GoogleAdsense #GoogleAnalytics

I have multiple sites in my Google Analytics, and under the content section, adsense revenue per page is only visible for one of the sites. The rest of the sites in my Google analytics do not display what page the AdSense revenue came from.

Is this a known bug? Has anyone had this? Or do I need to configure something else?

Here is how I currently do this.

It is constructed as part of a php string, but the idea is the same. See the first 2 lines of this function. And the rest of the function displays traditional analytics snippet.

$str = '';
if($production === true)
{
$str.= '<script type="text/javascript">'."n";

$str.= 'window.google_analytics_uacct = "UA-9425856-20";'."n";

$str.= 'var _gaq = _gaq || [];'."n";
$str.= '_gaq.push(["_setAccount", "UA-9425856-20"]);'."n";
$str.= '_gaq.push(["_trackPageview"]);'."n";

$str.= '(function() {'."n";
$str.= ' var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;'."n";
$str.= ' ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";'."n";
$str.= ' var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);'."n";
$str.= '})();'."n";

$str.= '</script>'."n";
}
echo $str;

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ravi8258870

1 Comments

Sorted by latest first Latest Oldest Best

 

@XinRu657

You need to add an additional snippet of code to your non-primary domains:

<script type="text/javascript">
window.google_analytics_uacct = "UA-XXXXXX-X";
</script>


It needs to be placed above the other GA and AdSense code. The "UA-XXXXXX-X" should be replaced with the same GA account number used in the GA code.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme