Forum Moderators: martinibuster

Message Too Old, No Replies

Adsense within javascript

         

triumph

10:53 pm on Aug 12, 2004 (gmt 0)

10+ Year Member



I a run weblog which uses adsense. Currently, I have skyscraper ads on the side, but I want switch to inline ads between the fourth post and fifth post. I found a hack that does this using PHP, but my weblog app only handles javascript. I've got most of the code worked out. I've gotten the program to place a message at every 4th post, however I can't seem to insert adsense code.. Here is the code:

<SCRIPT Language="JavaScript">
var googlead
googlead = 0
</SCRIPT>
<blog post>
if(googlead == 5){
document.write("<script type="text/javascript"><!--
google_ad_client = "pub-********xxxxxxxxxx";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_channel ="test";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>")
}
</script>
</blog post>

<SCRIPT Language="JavaScript">
googlead++
</SCRIPT>

BTW, I have no programming experience, so please be nice.. If I replace the Adsense code with some test text, it works fine.

Any help would be appreciated.

HughMungus

10:56 pm on Aug 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What do you mean you can't insert the code? Do you mean you can insert it but nothing shows up? What does show up? Can you use an include, instead?

triumph

10:58 pm on Aug 12, 2004 (gmt 0)

10+ Year Member



Sorry. "Nothing shows up" means the screen is blank when I enter the adsense code.

Not sure how to use an include..

IanCP

11:12 pm on Aug 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do a Google search on:

"server side include+tutorial"

And look out for:

BigNoseBird.Com's Server Side Include Page ( SSI)

HughMungus

11:20 pm on Aug 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might also try asking the people who run your weblog how you might make that work.

triumph

11:32 pm on Aug 12, 2004 (gmt 0)

10+ Year Member



It's hosted service called typepad.. It's basically movabletype except they host it.

peterinwa

5:32 am on Aug 13, 2004 (gmt 0)

10+ Year Member



Be careful. If you change a single character of Google's AdSense code you can be dropped from their program. And for good reason.

Peter