Xenforo 2.x Tutorial Show adblock detected notice

Yondu

Staff member
Global Moderator
Joined
Aug 10, 2019
Messages
234
Reaction score
136
Points
54
Age
20
Location
Belgium
Today I used an old resource of xF1 on xF2 by copying required things.

This Tutorial will help you to shows Adblock notice to the user in place of google advertisement banner.



In order to get it working on your website, first, create javascript file namely advertisement.js and add it to your forum root directory.

add following code to it - it's just a one-line code.

Code:
You don't have permission to view the code content.
Then go to extra.less template and add below code to its end.

Code:
You don't have permission to view the code content.
then go to advertisement section and select an ad where you want to show the message when ads are blocked - mostly the advertisement will be at ad below top breadcrumb or overview top or any location you want.

After you Google Adsense code in HTML area, add below lines of code in it.

Code:
You don't have permission to view the code content.
You can edit the message to show, as per your wish and style.

That's it! now you can test it for correct configuration by enabling ad block on your website.

Enjoy!
 
  • Like
Reactions: rUxGaming
D

Daemon

Guest
Most ad block plugins can detect these also and block them though.