Welcome to WebmasterWorld Guest from 54.226.130.194

Forum Moderators: incrediBILL & martinibuster

Message Too Old, No Replies

Using JS Includes for AdSense Code?

Is it ok to go external with the js?

     

bheybugarin

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

10+ Year Member



Hello,

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>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
//-->

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.

MarkJH

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

10+ Year Member



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

bird

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

WebmasterWorld Senior Member 10+ Year Member



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.

Yidaki

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

WebmasterWorld Senior Member 10+ Year Member



>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 ...

bzprod

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

10+ Year Member



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.

-J.P.S.

MarkJH

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

10+ Year Member



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.

mickmel

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

10+ Year Member



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.

Mickey

Jenstar

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

WebmasterWorld Senior Member jenstar is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.
[google.com...]

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.

JasonHamilton

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

10+ Year Member



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.

bheybugarin

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

10+ Year Member



I contacted Adsense Support and still waiting for their reply.

Yidaki

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

WebmasterWorld Senior Member 10+ Year Member



>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. ;)

bheybugarin

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

10+ Year Member




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.

Yidaki

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

WebmasterWorld Senior Member 10+ Year Member



>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!