vBulletin Mods

The Official vBulletin Modifications Site

Block Google Adsense Ads on Error Pages & More by BOP5
by BirdOPrey5
31 Jan 2018 16:36

2 Attachment(s)
Brought to you by BirdOPrey5.com. (Formerly Qapla.com)

I have been made aware that vBulletin 3 and 4 Administrators who use Google Adsense ads in positions like the header, navbar, and/or footer are getting warnings from Google that ads are appearing on error pages (such as "No Permission" pages) which lack any real content, in violation of Adsense Terms of Service. Google threatens to suspend your Adsense account if this is not fixed.

Put simply this mod attempts to kill Adsense ads from loading in the easiest possible way.

When an error page is detected the plugin will search for the code "adsbygoogle.js" which all current Adsense ads call on to load. If found it will delete the filename so the file is never called by the browser and never loaded on the page, thereby preventing the Adsense Ads from showing.

If you find it useful please consider making a donation using the Support Developer option to the right of this post, below my avatar. :up:

There are no real instructions and no options. Install the mod from Product Manager in the Admin CP and it is active. Disable the mod from Product Manager to turn it off or uninstall it to remove it. No permanent changes are made to your site or files.

This only works for Google Adsense. If there is demand I may be able to block ads from additional sources if you can provide me with sample ad code for those ad providers.

Should work on just about all versions of VB 3.8.x and 4.x.x and PHP 5 and 7 currently available. Tested on VB 4.2.5 and PHP 7.0.x.

2.0.0 Update

As of version 2.0.0 released 29th March 2018 you can now also specify a list of pages on which to block ads by going to Admin CP -> Settings -> Options -> Block Adsense Ads on Error Pages & More by BOP5. By default register and sendmessage (the Contact Us page) are on the block ads list.


Please "Mark as Installed" if you use this. :)

BirdOPrey5 31 Jan 2018 17:56


Alan_SP 31 Jan 2018 19:07

Quickly tested, everything works as it should, ads are blocked.

djbaxter 01 Feb 2018 13:01

Works just fine out of the box on error pages.

What about pages like Settings or Private Messages? Shouldn't those also be blocked, technically?

BirdOPrey5 01 Feb 2018 18:35

Private Messages are content. It doesn't need to be public content to qualify to have ads. But the settings pages, registration pages, some others, probably could be added.

unitedpunjab 10 Feb 2018 06:01

I have a feature request.

Starting February 15 " Chrome will remove all ads from sites that have a "failing" status in the Ad Experience Report"


One of the violation is "30%" rule.


I am worried about threads with short single posts.

Could it be possible to remove ads on threads with thin content ?
less than x words ?

kai_sey 21 Mar 2018 16:59

Thanks for this mod - nice to see some awesome coders here still supporting vb3.8x.

Any chance you can also incorporate the sendmessage.php page into your mod to disable Adsense there?

Since, I just got an email from Google telling me:

"This is a warning message to alert you that there is action required to bring your AdSense account into compliance with our AdSense program policies. We've provided additional details below, along with the actions to be taken on your part... Example page where violation occurred: https://www.domain.com/forums/sendmessage.php

Action required: Please make changes immediately to your site to follow AdSense program policies.

Would really appreciate it!

spipo 22 Mar 2018 19:14

it doesnt works on vb 4 . i can still see adsense showing on deleted posts

edite : Sorry . it works fine . juts I had adsense integrated with DFP . so it doesnt included that code . so i changed it with another 'name'

BTW : anyway to integrate this plugin with other pages : like /sendmessage.php /private.php ..ect ?


BirdOPrey5 29 Mar 2018 20:37

Version 2.0 released, allows blocking of specific pages using their THIS_SCRIPT constant. Setup to block by default on register and sendmessage pages. (sendmessage is the "contact us" page.)

If this mod is helping your site place consider making a donation using the "Support Developer" link below the Avatar in the first post. :)

kingMOB 21 Jun 2018 03:20

Thanks BirdOPrey5.

Any chance of expanding the plugin and include DFP and an option to block ads before some date based on the last post of a thread?

BirdOPrey5 22 Jun 2018 12:10

For DFP can you post the javascript you need to add to your template to make it work?

For disabling based on date of last post in a thread would be more difficult but probably possible. Just not sure I understand the logic why anyone would need/want that feature?

All times are GMT. The time now is 04:34.

Powered by vBulletin® Version 3.8.12
Copyright © 2019, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.