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 & jatar k & martinibuster

Google AdSense Forum

Using JS Includes for AdSense Code?
Is it ok to go external with the js?

 11:12 am on Oct 11, 2003 (gmt 0)


Im trying to put the code in my other site and want to use the following code:

This is filename like: google.js
google_ad_client = "pub-8873314380043948";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
<script type="text/javascript"

I will just insert the code in my webpages like this:

<SCRIPT LANGUAGE="javascript" SRC="google.js"></SCRIPT>

I would like to know if this is just fine or it is against in adsense policy.



 11:23 am on Oct 11, 2003 (gmt 0)

No, that's fine. You haven't changed the code and are just making it easier for yourself if/when Google alter the code.


 12:18 pm on Oct 11, 2003 (gmt 0)

As Mark said. I use server side includes myself, but the principle is the same.

Off topic:

<SCRIPT LANGUAGE="javascript" SRC="google.js"></SCRIPT>

Just do yourself a favour, and use standard HTML instead:

<script type="text/javascript" src="google.js"></script>

There's no "language" attribute to the script tag in standard HTML.


 1:54 pm on Oct 11, 2003 (gmt 0)

>server side includes ... the principle is the same.

Don't want to sound like a smart alec but there's a significant difference: JavaScript is executed on the client side (even external js) but ssi is executed on server side. So if mediabot visits a page that includes the adsense code using ssi, it gets the js code. But if it visits a page that uses external js it probably won't get it - mediabot probably doesn't fetch js (?). Don't know if its important for mediabot to see the actual AdSense code at the requested page - one never knows ... maybe it reads the id token to do checks or something!? I also would like to make the code external (like i do with amazon and others) but i gonna ask google before ...


 7:11 pm on Oct 11, 2003 (gmt 0)

Hmmm...This is interesting. I don't think that people are having trouble using this method. I would also like to know what peoples experiences are.



 9:53 pm on Oct 11, 2003 (gmt 0)

I use a Frontpage include to include the Google script into the page and don't get any problems, either with Google or with the targetting of the adverts.


 12:23 am on Oct 12, 2003 (gmt 0)

I think the big question is whether the ad code shows up in the HTML of the page or not. With a PHP include and with SSI, it does. As a user visiting the page, you can't tell that it was included - it's simply on the page. With the ad code is NOT in the HTML code of the site. As was mentioned above, I don't know if that really matters or not.



 12:50 am on Oct 12, 2003 (gmt 0)

I think Yidaki raises some excellent points. I haven't seen any .js files that are used to call the AdSense file, and there is probably a reason for this.

I think your best bet is to ask Google directly and see what they say on the subject. They are usually very prompt in replying.

With javascript files (ie. google.js), the code doesn't appear on the page, while it does appear when using an SSI, which is probably where the problem is.

Let us know once you hear back from Google on this, as I am sure there are many who are interested in an official word from Google on using .js to call the AdSense code.


 2:29 am on Oct 12, 2003 (gmt 0)

if you have php or some other scripting language, you can always put the adsense code into an external file, then include() the file. It would appear to be within your html document from the website, but would be in a seperate file.


 11:47 am on Oct 12, 2003 (gmt 0)

I contacted Adsense Support and still waiting for their reply.


 11:50 am on Oct 12, 2003 (gmt 0)

>I contacted Adsense Support and still waiting for their reply.

hehehe, when? Waiting since four hours now and still no reply! I bet we'll know it by tomorrow. ;)


 12:07 am on Oct 14, 2003 (gmt 0)

Its acceptable.

An email from their support.

Thank you for your email. Placing the AdSense code within a .js file is acceptable so long as there is no alteration of the AdSense code itself.

We realize that this makes the AdSense code much easier to maintain across an entire website.


 6:40 am on Oct 14, 2003 (gmt 0)

>external js is acceptable

Yep, received the this morning same reply. Additionally they told me to use adsense-tech [at] google.com for tech questions and adsense-support [at] google.com for all other questions. The first email adress is new to me.

All in all: great support Google!

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