Jump to content

Prevent ads from being displayed on error pages


alfanexus
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 

Link to comment
Share on other sites

  • 2 months later...
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 :(

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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