I’m trying to add 2 adsense codes to one page. When I do it only one (the first defined) is shown and the page seems to be in endless loading.
Here is the code with example slots and client IDs.
<body>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxx";
google_ad_slot = 111111111;
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxx"; //the same like the first one client
google_ad_slot = 222222222;
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</body>
If I remove one of these adSense codes than it works. How can I make it work with both codes?
Finally after almost 2 hours of googling I figured it out. Only thing I had to do is to add quotes to google_ad_slot variable (Oh my…). So the working code looks like this:
If there is just one adSense code, the slot as an integer works fine. If you add another, you must define all slots as strings.
Cheers!