THL Posted August 18, 2018 Share Posted August 18, 2018 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 More sharing options...
Mark Clifford Posted August 18, 2018 Share Posted August 18, 2018 Login to your Adsense account and then go to experiments > allow and block ads That should do the trick. Link to comment Share on other sites More sharing options...
THL Posted August 18, 2018 Author Share Posted August 18, 2018 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 More sharing options...
Surendra.S Posted August 18, 2018 Share Posted August 18, 2018 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 More sharing options...
Day_ Posted August 20, 2018 Share Posted August 20, 2018 Link to comment Share on other sites More sharing options...
THL Posted August 21, 2018 Author Share Posted August 21, 2018 Thanks have bought this plugin now. Although when I try to install it, it throws me out of IPB admin and back to my websites root domain, it also doesn't not have instructions at all with it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.