Jump to content

Prevent ads from being displayed on error pages


alfanexus

Recommended Posts

Posted

Its great that IPS has an inbuild ad-system, but it seems that ads are being displayed on error pages like 404 pages. If you fore example use Google Adsense you will be getting in trouble for putting ads on error pages since its against their TOS.

So how can I exclude ads from being displayed on 404 and other error pages?

Posted

I use custom locations you can setup in the Advertisements setup and not global header or footer, enter them into the index, forum display and topic templates top and bottom

Posted

Depends really, if you're creating a new theme each time them yes, it's only 3 templates so no biggy and adding one at the very top and bottom of the templates takes no time, not like you're digging through the code or anything.

If you're using the theme difference pages and making the changes manually/reverting templates they may not be effected. 

Maybe some if statements you can add to the ad code, be interested if there is but I'm not too fussed if not. Been doing this since 3.4.

Posted
54 minutes ago, daveoh said:

I use custom locations you can setup in the Advertisements setup and not global header or footer, enter them into the index, forum display and topic templates top and bottom

I did this too but I put the adcode in a Custom Block (Pages) which allows me to put the block anywhere I like.

Posted

I have found a solution, so I dont have to edit a lot of templates and still being able to use the predefines location for headder ads.

In globalTemplate
find:

{advertisement="ad_global_header"} 

and replace with:

{{if !in_array('pages', $location )}}                   
{advertisement="ad_global_header"} 
{{endif}}

This way ads a being displayed on all kind of pages except CMS and Error pages.

I havent found a way to keep the ads on CMS pages so that only Error pages are excluded. But its the best solution I was able to come up with for now.

 

Posted

Yes I forgot about the login pages. Here is an updated code:

{{if !array_intersect(array('pages', 'register', 'login', 'lostpass', 'contact', 'submit'), $location )}}  
{advertisement="ad_global_header"}             		                                            
{{endif}}

I also removed ads on lostpassword, contact form and post submit form.

Still haven found a way to include CMS exclude error pages at the same time.

Posted
2 hours ago, alfanexus said:

Yes I forgot about the login pages. Here is an updated code:


{{if !array_intersect(array('pages', 'register', 'login', 'lostpass', 'contact', 'submit'), $location )}}  
{advertisement="ad_global_header"}             		                                            
{{endif}}

I also removed ads on lostpassword, contact form and post submit form.

Still haven found a way to include CMS exclude error pages at the same time.

How do you allow the Adsensebot access to all pages behind a login? To show on profile pages, search etc. you need to setup a login which I've done but it also asks for which URL's are displaying ads on, be impossible to add all user profiles and search url's 

Posted

I havent tried to allow adsensebot to login pages. Ads are being displayed fine anyway, they might be target content on the page but there really is not much content to target on a profilepage anyway. Ads are still target with googles adcookies.

  • 2 months later...
Posted
On ‎30‎.‎11‎.‎2015 at 2:50 PM, alfanexus said:

Yes I forgot about the login pages. Here is an updated code:


{{if !array_intersect(array('pages', 'register', 'login', 'lostpass', 'contact', 'submit'), $location )}}  
{advertisement="ad_global_header"}             		                                            
{{endif}}

I also removed ads on lostpassword, contact form and post submit form.

Still haven found a way to include CMS exclude error pages at the same time.

Not working with new version :(

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...