Welcome to WebmasterWorld Guest from 184.108.40.206
One option for you is to include the ad code via a server-side include (SSI). If done correctly, the ad code will show up in the HTML source of your pages as if it had been directly implemented.
Hope that helps!
While AdSense have contacted me about a couple of other issues on the site (which I took care of right away to their satisfaction), I've never had a complaint about my serving the AdSense code via external .js files, so I'd assumed it wasn't a problem for them.
I've had no problems at all with the ads not being targeted to my content. On most pages the targeting is very accurate.
Unfortunately the host I'm with doesn't offer SSI, so .js files were the only way I could put the code on all my pages without hardcoding it into every page. That's fine, but makes making changes a bit of a pain!
If I'm violating AdSense TOS, I'd like to know for sure so I can try to keep within the rules!
The code I'm serving IS the AsSense code. All the .js script does is serve it up line by line. The code supplied to your browser is EXACTLY the same code that AdSense provides from their web page. Your browser can't tell the difference, though of course the HTML source code for the page doesn't contain the AsSense code, it contains a call to the .js file containing the AdSense code.
I would maintain that I'm not modifying the AdSense code, I'm just not serving it directly from an html file. The TOS don't say you have to serve it directly from an HTML file as far as I'm aware.
If course if the OFFICIAL Google position is that this is totally prohibited and if they find me doing it I'll be booted off the program, then I'll get to work making modifications, but as I said, I've been running it that way for the best part of a year, Google have looked at my site and pointed out one area where I wasn't quite in compliance with their TOS (which I corrected), but they never commented on the use of .js files containg the AdSense code. I don't have it on ALL my pages, but I'd guess maybe 1/2 of them.
Perhaps I need to send (anonymous) email to them to ask for an offical ruling. I'd rather do it anonymously just in case they hadn't noticed it and get upset about it!
As I said, I seem to be getting perfectly targeted ads which are closely related to the content of each page. If there's some technical reason why Google need the AsSense code in "plain language" in the HTML source, then I hope someone can explain that to me. Of course Google don't have to since "rules is rules", and I accept that. I'd just like to know since it's going to be quite a bit of work for me to modify several hundred pages!