Forum Moderators: martinibuster

Message Too Old, No Replies

Insert AdSense per javascript

Who has experience with this?

         

jetteroheller

6:32 pm on Jan 27, 2009 (gmt 0)

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



Just right now, there is on the server a text file for each domain

google.txt with

300x250=
Here goes the original copied AdSense code for this domain in 300x250
300x250=END

120x90=
Here goes the original copied AdSense code for this domain in 300x250
120x90=END

the Perl script called by SSI reads the file and extracts the requested AdSense code.

For performance optimation, I want to deliver the html code gun zip compressed. So SSI is no longer possible, all the files are compressed on the server.

Now I want to put the Adsense code in a Javascript

mt["nav300x250"]="Here goes my AdSense code for 300x250";
mt["nav120x90"]="Here goes my AdSense code for 120x90";

The only change of the code would be done by my CMS

$text=~ s/\"/\\\"/g;
$text=~ s/\n/\ /g;

To insert the code into a javascript literal.

Like the SSI, the javascript should have some code to decide display or not display the ad.

Who inserts AdSense by Javascript?

Are there disadvantages?

I mean, the AdSense spider can see at what part of the html is what ad. So it could be an optimization for the targeting exactly where the ad is placed in the html.

At javascript, the AdSense spider can not know where the ad is inserted, so this method of fine tuning the targeting is not possilbe.

jetteroheller

12:11 am on Jan 28, 2009 (gmt 0)

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



mt["nav300x250"]="Here goes my AdSense code for 300x250";
mt["nav120x90"]="Here goes my AdSense code for 120x90";

There is only one problem, it does not work.

Seems innerHTML ignores javacode.

I tried also document.write ( mt["nav300x250"] )
but it also did not work

Any idea how to display an AdSense code stored in a javascript variable?

jetteroheller

7:23 am on Jan 28, 2009 (gmt 0)

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



Before I started, I resarched the theme by

site:webmasterworld.com insert AdSense code by javascript
and found this message from 2003

[webmasterworld.com...]

Has this ever worked?
Has something changed?