homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Google / Google AdSense
Forum Library, Charter, Moderators: incrediBILL & martinibuster

Google AdSense Forum

Adsense in external .js file?
Simple question, is that allowed

10+ Year Member

Msg#: 2438 posted 5:43 pm on May 1, 2004 (gmt 0)

Please excuse this rookie question.

Is it OK to put the Adsense javascript code in an external javascript file, or must the code appear directly within the html file that uses it.



10+ Year Member

Msg#: 2438 posted 8:23 pm on May 1, 2004 (gmt 0)

I have one javascript file that apply adsense code to all site pages, and impressions and click are regularly registered.


10+ Year Member

Msg#: 2438 posted 6:03 am on May 2, 2004 (gmt 0)

No it is not allowed. I have asked them.


10+ Year Member

Msg#: 2438 posted 8:25 am on May 2, 2004 (gmt 0)

There's another thread about Adsense in an external javascript:


Reply from the Google Adsense team: "code cannot be altered in any way"...


10+ Year Member

Msg#: 2438 posted 7:16 pm on May 2, 2004 (gmt 0)

Can we use SSIs or PHP to serve different ads from the same pages? I mean, does Google care if a given page serves different ads each time it's visited? The ads would change, but all would come from a stock "written" by Google, with no changes inside the scripts.

Possible uses: (1) serve different colors or sizes to reduce ad-blindness, (2) serve different channels, tracking anything knowable—hour of day, member status, (3) tie differences in aesthetics to channels, to track the most effective colors, sizes, etc.

I asked this question here once before, but got no replies. Google misunderstood my question and sent me a form letter about how to insert JS into webpages.


WebmasterWorld Senior Member 10+ Year Member

Msg#: 2438 posted 7:19 pm on May 2, 2004 (gmt 0)

I have my adsense code in a SSI file, this does not alter the code in any way and I can change all the ads with the switch of one file.


WebmasterWorld Senior Member jomaxx us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 2438 posted 7:43 pm on May 2, 2004 (gmt 0)

Some of those changes will trigger a reindexing of the page by AdSense (specifically ad sizes; not sure about color changes or channel changes).

I don't see why you couldn't swap AdSense in and out using PHP or SSI, but I would be careful about constantly changing the ad format. You might conceivably get some bizarre side effects, such as excessive spidering, poor targeting, or frequent manual checks from Google staff.


10+ Year Member

Msg#: 2438 posted 6:18 pm on May 6, 2004 (gmt 0)

Thanks Tombolo, for posting that link to the previous thread on this topic, and thanks to the others who replied too. The first post in that previous thread, had the most desirable way to do Adsense as an external javascript file. Too bad the official word so far, is that its not allowed. So, wouldn't it be nice if..

Google, most esteemed AdsenseAdvisor,
Could you please add a little code into your algorithm that checks if pages are using un-adulterated Adsense code... to add the option to use a specific external javascript file, which is restricted to containing ONLY the 12 required lines to set the Google_variables values.? Your checking algorithm should be able to figure that out, and it would make format changes to large sites, sooo much easier.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Google / Google AdSense
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved