Forum Moderators: martinibuster
Anyone able to get multiple Google Adsense ads working on their site?
The Google ad Javascript seems to predefine some variables, and once it gets to the second ad, the information is lost/incorrect, and is not displayed.
I use a simple "box" module with the two Javascripts included in each one of the modules.
They look like this:
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat"><span class="smallfont"><strong>$vba_options[portal_blockbullet] <!-- Module title here -->Advertisement </strong></span></td>
</tr>
<tr>
<td class="$getbgrow" width="100%">
<center><script type="text/javascript">
<!--
google_ad_client = "pub-XXXXXXXXXXXXXXXX";
google_ad_width = 125;
google_ad_height = 125;
google_ad_format = "125x125_as";
google_ad_channel ="ZZZZZZZZZZ";
google_color_border = "578A24";
google_color_bg = "CCFF99";
google_color_link = "00008B";
google_color_url = "00008B";
google_color_text = "000000";
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
<!-- //-->
</script>
</center>
</td>
</tr>
</table>
<br /> And the second ad is :
<!-- begin Google skyscraper 120 x 600 -->
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat"><span class="smallfont"><strong>$vba_options[portal_blockbullet] <!-- Module title here -->Advertisement </strong></span></td>
</tr>
<tr>
<td class="$getbgrow" width="100%">
<center>
<script type="text/javascript">
<!--
google_ad_client = "pub-XXXXXXXXXXXXXXXX";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "image";
google_ad_channel ="YYYYYYYYYY";
google_color_border = "336699";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
<!-- //-->
</script>
</center>
</td>
</tr>
</table>
<br />
<!-- end Google skyscraper 120 x 600 -->
I would very much appreciate any help!
If you notice each Google AdSense requires two pieces of JavaScript. One sets the variables, and the second one calls it.
It seems the second instance of "setting" the variables does not happen because the variables are already set. So when the second set's second JavaScript runs, the variables are from the first set - and are incorrect for what it supposed to be.
I have switched the ads back and forth, and only the first ad is displayed. No matter if it is the graphics or the text.
I have tried it in just raw HTML, just two ads, no luck.
I've also been able to set it up to hide the ads from registered users, which is handy, and am looking at setting it up so that rather than just appearing at the top of the page, the ads appear at the correct post - ie, if the user clicks a link along the lines of /showtopic?p=41653#post41653
the ads will appear directly below / to the side of post 41653.
For maximum effect with Vbulletin, get your ads onto the archives - that's where I get my best results.
Roddy
There is nothing wrong with vB or VBA. It is all Google.
According to their writing, I flagged one of the blocks as "image only", since there are few and far between for image clients, they will display a simple empty block. Switching it to text/image, will display text ads if the image ads are not available.
Take care