Jump to content

Google Adsense


THL

Recommended Posts

Hello

I have ran google Adsense on my forum for years, but lately it is blocking pages due to certain content that is against its policy for example a knife related subject, etc.

I have my Adsense banners setup in IPB to show in the forum header, footer, etc 

Question being how do I prevent certain forum sections and my classifieds section from showing Adsense code ?

Thanks

Link to comment
Share on other sites

I did look but could only block adverts from certain websites appearing, not block them showing from certain areas on my own website... I'll take another look.

Just checked that only blocks advertisers from what I can see, it doesn't allow me to restrict ads from appearing in a certain forum section... Is there an easy way in IPB to do this?

Link to comment
Share on other sites

this code was given by someone in this forum only. search to find out.

 

<!-- START: CUSTOM CODE: ADVERTISEMENT -->
{{$forumId = 0;}}
{{if \IPS\Request::i()->app == 'forums' and \IPS\Request::i()->module == 'forums' and \IPS\Request::i()->controller == 'forums'}}
    {{$forumId = \IPS\Request::i()->id;}}
{{endif}}
{{if \IPS\Request::i()->app == 'forums' and \IPS\Request::i()->module == 'forums' and \IPS\Request::i()->controller == 'topic'}}
    {{try { $topic = \IPS\forums\Topic::loadAndCheckPerms( \IPS\Request::i()->id ); $forumId = $topic->forum_id; } catch( \Exception $e ) {};}}
{{endif}}
{{if ( \IPS\Request::i()->module == 'forums' AND ! in_array( $forumId, array( 8, 9, 10, 11, 12, 14, 15, 16 ) ) ) OR !( in_array( \IPS\Request::i()->controller, array( 'login', 'register', 'lostpass', 'store', 'modcp', 'settings', 'ignore', 'notifications', 'profile', 'messenger', 'forums', 'topic' ) ) OR in_array( \IPS\Request::i()->app, array( 'app_1', 'app_2') ) )}}

    {advertisement="ADS-IN-HEADER"}
    
{{endif}}
<!-- END: CUSTOM CODE: ADVERTISEMENT -->

 

In above example, Please note that array(8, 9, 10, 11, 12, 14, 15, 16) should be replaced by your forum section Ids in which you don't want to display the ADs.

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

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