Forum Moderators: martinibuster
Basically for an apache web server you enable it by adding
AddHandler server-parsed .html Next you add a file with the html GOOG gave you to add to your site in a file (let's assume you call it adsense.html in your document root)
Then you replace the ads in every page with:
<!--#include virtual="/adsense.html"--> To the visitors nothing has changed (some marginal speed decrease at worst).
To you however, you can now change the ad, delete it, repalce it with compaeting ads, .... all with editing one single file. [Tip: do not delete the file, leave it empty]
If you need channels etc, just create more of those files.
One further question: Is there any experience G will "penalyze" such switching methods yielding to sudden extreme "AdSense traffic changes"?
When you do that all your static HTML pages would go through the PHP parser. All my pages are static HTML and they load rocking fast. Just below .5 seconds according to Googles webmaster tools. This is great for user experience.
If you want to switch off ads I think there are better alternatives for static pages then having them all go through the PHP parser.
Why not use a site-wide search/replace. To upload some 100 pages isn't going to take that long either.
[edited by: Bddmed at 10:16 am (utc) on Oct. 19, 2006]
Just make a test page to see if it's working. When it does you'll have to rework your pages once. After that you can change ads by changing just a few files.
[edited by: Bddmed at 12:36 pm (utc) on Oct. 19, 2006]
I have tested the following simple substitution on some pages and it worked without any problems:
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> replaced by <!-- adsense //-->
What do you mean with "unresolved variables"?
---------------
Again thanks to all for your longterm suggestions
The only question is about what does Google think about this. Since you modify the AdSense code. Google doesn't allow this and by doing so you may jeopardise your AdSense account.
Therefore I recommend you to contact Google about using this technique. I really can't speak for them.
- test it, it's likely turned on.
- if not turned on, ask them to turn it on, if they are somewhat serisous they'll gladly do this.
- if they refuse, test if you can use .htaccess files and are allowed that overrride (same command, just in a file in your documentroot.
- if your .htaccess doesn't work, ask the hoster to allow ssi to ber configured in .htaccess files.
...
- switch hosting provider
- use php
- ...
<IFRAME FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=160 HEIGHT=600 SRC="<your site ere>/ad100x600.htm"></IFRAME>
This code will then insert the ad100x600.htm page into your page. You can also do something similar with frames and many other ways without resorting to ugly PHP hacks, SSIs or things that will add significant overhead to page loading times.
The advantage to this is that you can insert the code into many pages. Once it's done and you wish to make changes you only have one file to edit.
There's a similar rationale to using cascading style sheets too, but that's a topic for another day.
I was referring to other types of ad I have on the site which the code is just HTML (as they're not javascript it doesn't affect targeting - they have to be static and not contextually targeted ads anyway). When you have thousands of pages it is just easier to change things that way. Another way to do it would be an javascript in an extra file (in a similar way to the way the Google Adsense ads work). However I doubt you're allowed to use Google Adsense quite like that. I'll email Google Adsense support with examples and see what they say - but I doubt I'll get a reply before Monday.
However I prefer to keep the pages static to keep page loading time sensible. Regarding PHP pages - how much slower (or quicker) are they than just straight HTML? For the same page I'd assume they're slower because the code has to be parsed by the server, the page created, then sent rather than with HTML. I suppose it would partly depend on the complexity of the HTML code and the speed of the server.
I disliked Dreamweaver when it was suggested I use it for a site. I found it even more pointless when I had to use it on a university course. Dreamweaver is for newbies. Us programmers program by hand. :)
Thanks for the suggestion anyway.
Regarding search/replace site-wide does anyone know a good program for doing this quickly across thousands of files?
I use Search and Replace 98 [htmlworkshop.com]. It's freeware, it's fast, and despite its name, it's XP-compatible. Very useful little utility.
[edited by: Etonian at 9:27 pm (utc) on Oct. 20, 2006]
For example, if I wanted to change the background colour from white to black on all the pages showing my Google Adsense ads I'd do a search for:-
google_color_bg = "FFFFFF";
replacing it with
google_color_bg = "000000";
across all the pages. Then upload them. You could use the same technique to change the size of ads and any of the ad tags (presuming they're valid tags you're allowed).
Just to try out that I set all colours to black (perfectly allowable) - as you can't read black text on a black background Google automatically change the text colour to grey.
You can set the palette to whatever you like. It's at the choose Choose Ad Format and Colours section page when you log into Adsense.
If you weren't allowed to change the colours ~ 90% of the ads currently showing on websites are in breach. lol It's just most people can't be bothered enough to go beyond the default palette.
Don't worry it's a change to the code that's allowed (hey the variable is generated by their website anyway!). Ask them yourself if you like.
You can even get it to generate code to switch randomly betweeen colours automatically too.