Can Google ads be placed in an external .js file and called? Will Google execute the code call or the .js file? Not too up on js but can do that much. :)
Ann
encyclo
2:03 am on Sep 4, 2006 (gmt 0)
You can't alter the AdSense code and comply with the TOS, so that in itself shuts the door on this approach. If you want to keep the AdSense code in a separate file (often a very good idea), better to use SSI or similar server-side includes.
ann
2:31 am on Sep 4, 2006 (gmt 0)
I wasn't talking about altering the adsense code itself. just placing it in an external file.?
Ann
jomaxx
2:38 am on Sep 4, 2006 (gmt 0)
I wouldn't do it without Google's explicit approval, but I asked them about something very similar and they said OK.
fischermx
2:56 am on Sep 4, 2006 (gmt 0)
Ann: It does not work well. I've tried that. Google will try to read "content" from the .js file and will find nothing, therefore you'll get PSA's or totally untargetered ads. If the only purpose of doing this is easy deployment you're better using server-side technology like php/asp depending your host to populate the ads code in the correct places programatically.
fredw
3:34 am on Sep 4, 2006 (gmt 0)
You can't load the Adsense as remote javascript file, because an external javascript file does not and cannot include the <script></script> tags. Therefore, creating the Adsense code as a remote javascript file would require modification of the Adsense code (to remove the opening and closing tags) and that's strictly verboten.
You can, however, save the entire Adsense code block in a separate text file and include it in your page using something like SSI or PHP. So, this requires some simple programming capability and is not for everyone.
ann
8:17 am on Sep 4, 2006 (gmt 0)
Okay. Thanks a lot all of you for your answers. I will go for the ssi's using PHP instead.