Detecting Ad Blockers
We've all had experience with Ad-Blockers some time or the other. Whether you are the frustrated website owner trying to earn a little bit of advertisement revenue, or the internet user trying to navigate your way though the plethora of advertisements. Ad-Blockers have become integral part of browsing the web.
It was the initial growth of Ad-Blockers such as AdBlock Plus which prompted many website owners into disguising their advertisements in an attempt to circumvent Ad-Blockers. However such techniques meant a lot of work. Renaming advertisement file-names, changing folder structures and ensuring none of the standard advertisement image sizes were used. Then if all that was met you only had a limited amount of time before the advert was noticed by someone with an Ad-Blocker and added to their "block" list.
Within the past few months however I have noticed that an increasing number of website owners are diverting their attention away from such time consuming techniques to instead taking a more direct approach by blocking visitors who use Ad-Blockers. The crux of this technique though is in the detection of Ad-Blockers. And it is this that aroused my curiosity. So after doing some research I have created a list (with sample code) of the most common methods for detecting Ad-Blockers that I found in use on websites across the net.
The methods used to detect Ad-Blockers
Compiled below (in no particular order) is a list of the most common methods for detecting Ad-Blockers.
Method 2. Checking the advert still existsA simpler method is to check that the advertisement is still present within the page by checking for its ID attribute. This is a far from reliable method though, as it fails to take into account the fact that most Ad-Blockers simply hide adverts, as opposed to removing them.
Method 3. Detecting changes to the advert's CSS ClassDue to the fact many Ad-Blockers don't actually remove the advertisement from the website, only hide it, the following method tries to detect the use of a CSS class added to the advertisement in order to alter its visibility.
Method 4. Checking the styles relating to the advert's visibilityThe most accurate, yet complicated, of the 4 methods checks each of the styles relating to the advertisement's visibility. Any style added to the advertisement that would result in it being hidden from the user triggers the "detector".
Whilst researching the techniques being used to detect Ad-Blockers it became apparent that for every method of detection in use there exists a technique of circumvention. Leading to a fascinating cat-and-mouse game that is unlikely to stop any time soon.
If anyone has seen other methods that I may have missed then why not leave a comment explaining where it is, and how it works...