• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
[rellect] AdBlock Detector - How to create custom alert type

[rellect] AdBlock Detector - How to create custom alert type

rellect

Well-known member
#1
rellect submitted a new resource:

[rellect] AdBlock Detector - How to create custom alert type - This guide will teach you how to create a new alert type for AdBlock Detector.

This is a guide for the AdBlock Detector addon.

Recently I got many requests and suggestions for adding new alert types.
Since I can't add everyone's suggestions, and I understand the need of some sites to have the alert in a very specific position with a very specific design - This guide will teach you how to do it yourself.

Few...
Read more about this resource...
 

rellect

Well-known member
#2
rellect updated [rellect] AdBlock Detector - How to create custom alert type with a new update entry:

Robot condition

Google bot is now capable of reading javascript generated content.
Since the adblock detection message is not something relevant to be indexed, we should make sure that search engines won't see it.

If you have written your own custom alert type, all you need to do is to wrap your code with a IS ROBOT condition.

PHP:
<xen:if is="!{$session.robotId}">
// your code goes here, robots won't see it
</xen:if>
Read the rest of this update entry...
 
#3
<xen:if is="!{$session.robotId}">
<script>
$(document).bind('AdBlockOn', function(){
alert('If you see this message, your AdBlocker is On');
});
</script>
</xen:if>


Which template do I add the above code to? It is the second option you showed in the resource.
 

rellect

Well-known member
#4
<xen:if is="!{$session.robotId}">
<script>
$(document).bind('AdBlockOn', function(){
alert('If you see this message, your AdBlocker is On');
});
</script>
</xen:if>


Which template do I add the above code to? It is the second option you showed in the resource.
Generally it doesn't matter, it should work in any template.
Personally I'm putting my scripts in the footer template.