Forum Moderators: martinibuster
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!
ASA
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!
I'm just wondering if Google does indeed need to see the actual Javascript on the HTML page. If it's served from a .js file, the same data goes to Google as it would if it were copied verbatim into the HTML source.
The only difference would be when Google crawled the page, but does the regular Google crawl have anything to do with Adsense? If Google is using it's regular crawl data to decide which ads to serve for a particular page, I'm not sure why it would need to see the explict Javascript source on the page.
When the call is made to Adsense to download the ads, I presume it knows which page it's coming from and the call transfers exactly the same data as it would if the Javascript was placed directly on the page. If Google has crawled the page, it knows what's there in terms of content and so it knows which ads to serve. None of the data sent by the AdSense Javascript identifies the page it's included on. It just sends account ID and Ad formating information whether it's loaded from a .js file or sits directly on the page. The page ID is sent in the headers I assume and isn't related to the actual Javacript data.