Forum Moderators: martinibuster

Message Too Old, No Replies

Temporarily AdSense switching off / on for whole website

         

optimierung

3:43 pm on Oct 17, 2006 (gmt 0)

10+ Year Member



Hi
For checking the visitors behaviour I want to switch off/on for a certain time period the presentation of all ads on my whole website (some 100s pages with ads) without eliminating the code or uploading different pages: how can I do this in form of some "single command" or something else?
Thanks in advance

swa66

9:37 pm on Oct 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SSI (server side includes) is one of the most likely candidates, you could also do it with PHP, but I doubt you'd be asking the question if you were writing PHP yourself.

Basically for an apache web server you enable it by adding

AddHandler server-parsed .html

into your httpd.conf configuration file (many other ways advantages and drawbacks, please consult httpd.apache.org for more information.)

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.

optimierung

8:21 am on Oct 19, 2006 (gmt 0)

10+ Year Member



Hi swa66
thanks for your excellent suggestions and detailed description; I will take it into account. At the moment I am not sure my hoster will allow to use the Apache config file!

One further question: Is there any experience G will "penalyze" such switching methods yielding to sudden extreme "AdSense traffic changes"?

ashii

8:47 am on Oct 19, 2006 (gmt 0)

10+ Year Member



Simple put adsense code into a PHP include file and use that file.when you need to disable ads,rename that file and upload a blank file that place.

A simple command in htaccess file will allow you to run php code into html pages on almost every UNIX/Linux server.

Bddmed

10:13 am on Oct 19, 2006 (gmt 0)

10+ Year Member



ashii,

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]

optimierung

11:11 am on Oct 19, 2006 (gmt 0)

10+ Year Member



Hi Bddmed

because my hoster does not allow to use Apache config and further having some channels I am just thinking about a quick solution by simply replacing src="http://pagead2.googlesyndication.com/pagead/show_ads.js" by a comment <!-- ... and vice versa

Bddmed

11:24 am on Oct 19, 2006 (gmt 0)

10+ Year Member



Just replace the complete AdSense code with a comment tag.
That way you're preventing troubles leaving any code on the site.
When you want your AdSense back just replace the comment tag with your code again.

optimierung

12:25 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



Bddmed

As I have different codes I cannot distinguish easily and must therefore replace an unspecific part

Bddmed

12:36 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



Have you tried to use Server Side Includes as suggested by swa66? I know you told us you can't change config files. But most hosts have it turned on anyway. In my experience it's the most easy way to handle ads, templates, navigation, etc.

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]

optimierung

12:49 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



Bddmed

I agree that SSI or similar is the best solution in all such cases but as a quick solution .....

Bddmed

1:02 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



Than go by the solution you mentioned yourself. It will just leave the page with some unused javascript variables. But don't ask me what the implications can be for modifying the AdSense code.

optimierung

1:50 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



Bddmed

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

Bddmed

1:58 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



It's not unresolved. It's only unused. It won't harm your page and yes it works.

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.

optimierung

2:23 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



Bddmed

In my first post I already asked about "Penalty": It's a very interesting question if this replacement of the URL will be regarded as a G code modifikation and will be penalyzed!?

Other comments please

swa66

4:43 pm on Oct 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah, shared hosting providers:

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

optimierung

5:51 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



swa66

thanks for further help: .htaccess is no problem for me

level80

6:44 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



My solution (in HTML) is to use the iframe tag. Example:-

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

Bddmed

6:59 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



When using SSI the outside world sees just one page. With IFRAME, technically, the ads page is a complete other page than the content page.

Don't you have any targeting problems?

As stated before my pages load within .5 sec. using SSI. So I still think this is the best way to go in this case.

level80

7:11 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



Ah sorry perhaps I should've been more clear. Obviously using Google ads in an externally referenced file in an iframe would be probably contrary to their T&Cs and would perhaps screw up targeting based on referring page, on-page factors. It would almost definately contravene the no content rule as the extra HTML file would just be an ad unless the page included content too (eg was say navigation bar, Adsense ad, something else). As plenty of sites are solely designed using the FRAMES tag though I'm sure it's possible for the Adsense bot to target it to the whole page rather than just the frame the adsense ads are in.

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.

Bddmed

8:13 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



Just to sum it up:

- See if SSI is enabled for you.
- Forget about IFRAME (for Adsense).
- Use search/replace site-wide.

level80

8:27 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



Regarding search/replace site-wide does anyone know a good program for doing this quickly across thousands of files? I'm halfway tempted to write one myself. I currently use Editpad which despite it's speed is a little slow when I'm instituting site-wide changes.

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.

Edge

8:34 pm on Oct 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



level80 - Dreamweaver will search and replace.

level80

9:08 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



I don't like using Dreamweaver as it leads to massively bloated code. Also as it's an HTML editor (and not just a text editor like Editpad) I would've thought it'd be slower.

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.

Bddmed

9:21 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



I use dreamweaver all the time. And trust me, it does site-wide changes tremendously.
My profession is not being a webmaster, and I've been coding for more than 20 years now. If you now better tools to use than we do, please tell us. If you write your own, share it.

Etonian

9:26 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



Posted by level80:
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]

optimierung

12:19 pm on Oct 21, 2006 (gmt 0)

10+ Year Member



Posted by Bddmed:
Therefore I recommend you to contact Google about using this technique. I really can't speak for them.

I have asked the G team regarding my simple code replacement costing only 5 min (using tool S & R and upload): Strictly forbidden they told me!

Bddmed

12:25 pm on Oct 21, 2006 (gmt 0)

10+ Year Member



Thanks for sharing with us Optimierung.

Now at least we all know.

[edited by: Bddmed at 12:27 pm (utc) on Oct. 21, 2006]

level80

12:48 pm on Oct 21, 2006 (gmt 0)

10+ Year Member



However just to clarify (in case this gets confusing), what is allowed is things along the lines of the following

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

frox

1:08 pm on Oct 21, 2006 (gmt 0)

10+ Year Member



level80, I am not sure what you are saying is allowed.

have you been explicitely authorized to do that?

That can be used to achieve things Adsense does not want to allow (e.g. color schemes that aren't allowed)

I know they are quite obsessive with this "don't change our code"

level80

1:38 pm on Oct 21, 2006 (gmt 0)

10+ Year Member



Login to Adsense and you'll see you can change the tags for colours yourself. Yes it would be possible to end up with something stupid like white text on a white background, but it would automatically displays visible text if you did.

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.

This 36 message thread spans 2 pages: 36