Posts Tagged ‘Adblocker’

June 11, 2016

Thwarting Adblockers

When I started tracking adblockers on my site I didn’t have much of an intuition how common adblockers were, or how much it was affecting my bottom line. As a one person company, I have limited time to throw at any one problem so these types of questions always warrant an investigation to see if it’s worth my time and effort. If ad blockers were used by a small enough percentage of my audience, I would ignore the issue and focus on writing new apps.

Initially I came up with an arbitrary threshold of an acceptable amount of ad blocking. As long as adblocking was less than 15% of my traffic, my bottom line would remain mostly intact. Actually, the first number in my head was 10%, but I bumped it up after it appeared 12% of my ads were being blocked. There was no real reason behind either number, just intuition. The first time the percentage of blocked ads rose above 15% I decided to look the other way. Maybe 17% was a more reasonable number. Than I had my first 20% ads blocked day, followed by my first 40% day, and finally a day over 50%. The bandwidth I was paying for to host the webapps was costing me more than the money I was earning from them. Forget earning money, it was costing me money! Ignoring the problem was no longer an option.

Thankfully my Ad blocking detection script was generating a fair amount of data. I had replaced those “console.log” calls with google analytics event recordings, so I could generate a fairly extensive profile of just who was using adblockers.

I wasn’t surprised to see that adblocking was more common on desktop than mobile browsers. I think that’s pretty common knowledge these days. What caught me off guard was the stark divide between weekend behavior and weekday behavior. Even accounting for browser type, adblocking was nearly non existent on the weekends. Digging further I learned some corporate networks block ads as a matter of policy.

Penalize the user for their network administrator’s policy didn’t seem like the right course of action. Yes, blocking ads are against my terms of service, but what choice did they have? They have no control over their coprorate’s network policy and I’m more likely to incure their ire than get any positive benefit from blocking them. I opted to go a different route.

I opted to show different, unblockable ads that address many concerns that advocates of adblocking raise.

When google adsense is blocked, I now serve static image & text ads to Amazon. Because the only javascript running is javascript I wrote, rather than a third party script, there is no additional security concern. Nor is their an extra strain on resources beyond what running my apps would cause anyway. No third party involvement also means no additional privacy concerns. The new ad policy that addresses the objections of most people who use ad blockeres. That sounds like a win-win in my book!

If you want to see the Amazon ads used, but don’t have an adblocker, you can always check them out here. As always, I welcome feedback.

It occurred to me that there may be other people out there interested in detecting the presence of adblockers on their website. Here’s my approach.

First a little primer. When you sign up for adsense, adsense has you add a small code block to your website. The code block contains an ins element with class name “adsbygoogle”. When the adsense javascript code runs, it finds this element in your DOM and inserts the ad into it.

Most ad blockers work by preventing the adsense javascript file from downloading to the user’s browser and executing. Therefore, the simplest and most straight forward way to detect an adblocker is to see if any content was inserted into the ins “adsbygoogle” element. If you’re using javascript with the jquery library that might look like:

$(window).load(function() {
setTimeout(function() {
var ad = $(“ins.adsbygoogle”);
if (ad.length > 0 && ad.html().replace(/\s/g, “”).length == 0) {
console.log(“Ad blocked”);
}, 2000);});

The code sets a 2 second (2000 milisecond) timeout to give the adsense script time to load an execute. After two seconds have elapsed, it uses the jquery selector to find the ins element with adsbygoogle class. If the ins element is present, it checks to see if the tag contents (with the .html() call) has zero length and thus was not populated.

There are a couple drawbacks to this approach. While most adblockers work by preventing the ins element from being populated, some adblockers remove the ins element from the document DOM altogether. Others modify the css properties so the ins element is no longer visible. In my case some pages, such as the terms of service, are ad-less by design. I wanted to detect a modified DOM which meant signaling to my detection script whether an ins element was expected to be present in the first place.

The first thing I did was create a div container around my google adsense ins tag. Most adblockers give you the ability to hide arbitrary elements on a page, so you can hide any ad the blocker may have missed. Blockers store information about the element (usually the id) so they can continue to block the element if you leave the page and come back, or they see the element on other pages in the same domain. By creating a random string each element appears different to the adblocker. There is no way for the adblocker to hide all my container divs (see note below for caveat.)

This is done by PHP and might look like:

$id = getRandomID();
echo “<div id=\”$id\”><ins class=”adsbygoogle”…
echo “<script>addAdsenseID(‘$id’);</script>”;

The function getRandomID() is a user created function I didn’t include for brevity. Insert your favorite random string generator. The last step, addAdsenseID is a javascript call that ads the id to an array.

The updated javascript now looks like:

$(window).load(function() {
setTimeout(function() {
for (var id in adsenseIds){
var ad = $(‘#’ + id + ‘ ins.adsbygoogle’);
if (ad.length > 0){
console.log(“DOM modified”);
} else {
if (ad.html().replace(/\s/g, “”).length == 0){
console.log(“Ad Content Empty”);
} else if (ad.css(‘display’) == ‘none’){
console.log(“Ad Display None”);

}, 2000);});

No more over counting pages without ads, no more missing the case where the DOM has been modified. It happens rarely, but as a data scientist “rarely” is just not specific enough. I opted to inspect each adsense element, but if you wanted one check per page you could always replace the for loop declaration with something like “var id = adsenseIds[0];”

Caveats: While my approach is robust enough for my purposes, it’s not full proof. At present I see two possible work arounds.

1.) A user can disable javascript altogether. With javascript disabled, my detection script won’t run. I doubt anyone would do that on my website since that would also render all the apps useless. I’m not loosing any sleep over this one.

2.) The ids I generated for my container div elements were completely random, but the ids for the elements on the rest of the page or not. Certain characters (‘q’, ‘x’, ‘z’, etc) are more likely to occur in random strings than strings based on English. One could create a statistical modal to predict whether an id was a random string and thus the container div id. It’s a lot of work, but it’s possible.

February 25, 2016

My Ad Policy

There’s been a bit of an arms race between ad blocking users, content providers and advertisers. As ad blockers rise in popularity, revenue goes down for content providers. Content providers tend to resort to more obtrusive ads, hoping to garner more clicks from those users not utilizing blockers. They may put clickable content (like a next button) too close to the ad so misclicks turn to ad clicks. Or they do growing interstitial ads that block the content until the user is forced to interact with the ad. From the advertisers prospective, misclicks are worse than no clicks. They cost the advertiser money for little gain as the user wasn’t actually interested in the ad in the first place. As a result, the advertiser offers lower rates, reducing the content provider’s revenue further. The more annoying the ads, the more likely users are to turn to ad blockers in the first place. Things have gotten out of hand, and no one wins in this scenarios. The user has a terrible experience. The advertiser gets the wrong king of visitors. While the content provider may make money initially, over time he or she makes less and less as he or she drives more people to use adblockers.

I am not a fan of adblockers, but I recognize why some users are. In my world view, it’s the content owner’s responsibility to ensure a reasonable user experience, and that includes the ads the user sees. I intend to do my part to stay out of the arms race, even if that means less revenue.

With that in mind I’ve been thinking about my own ad policy:

No Misclicks and no Trick Clicks

I used to love the game Robot Unicorn Attack on my phone. I played it daily. Nicki loved it too, referring to it as “the horsie game.”

Aside: A great way for a scrupleless developer to make a quick buck? Write a ad supported toddler game app with ads on the screen the toddler sees. If there’s a button the’ll find it and click on it. You don’t even need to be sneaky with ad placement.

When you inevitably died the game gave you the option of using a fairy tear to continue your life. You clicked “yes” to continue, “no” to move on to the next life. At some point they moved the “no” button to the bottom of the screen and put a “watch a 30 second ad clip instead” option in it’s place. After one too many misclicks I uninstalled the game from my phone and quit cold turkey. Since my terms of service disallow adblockers, I certainly can’t fault anyone from quitting me cold turkey if I tried something similar!

As a content provider I promise to make all advertisements obvious, and will design my apps in such a way that any ad click is more than likely an intentional ad click.

Limited Ads

In order to test my ad blocking detection script, I needed to download an install an adblocker. By default I turned it off, but every time my browser restarted the ad blocker also restarted. This particular ad blocker would show how many ads it blocked on each page. The record was 49 on a news website. Forty-nine. I had no idea.

Of course there’s a big difference between news websites and my apps. Lengthy articles have more space for ads. I try and keep my apps contained within a single screen, so I couldn’t fit that many ads in, evening ignoring my first pledge.

Right now I’m limiting myself to just one or two banner ads.

Possible Revenue Alternatives

A common defense of adblocking users is that they weren’t going to click on ads anyway, so what difference does it make? This argument is based on the inaccurate assumption that adviews don’t earn revenue. They do! To be fair it’s rather small.

Some websites allow for users to donate money instead of viewing ads. Others allow other currency in lue of ads; such as a share of social media or subscribing. When I get larger I may consider the former option. If you want to speed up the process, you can consider Google Contributor. You pay a small monthly fee to contributor. Contributor blocks some of the google adsense ads you would have seen, and uses your monthly fee to pay the content provider as though you had seen the ad.

February 19, 2016

Anti Ad Blocker

As I try to make my way in the world as a ad supported content provider, ad blockers are a bit of a thorn in my side. Recently I’ve been pondering the ethics of ad blockers with a few friends. I’ve noticed that those people firmly in the “pro” ad blocker camp tend to view websites more as public property, such as a town library. In their view, as ‘net citizens they are entitled to the content of each webpage, should they so choose to consume it. They’ll quickly point out that ads are not just annoying, but can run a muck, crashing browsers and, in rare instances, install viruses on the web surfer’s computer. As they see it, sometimes blocking ads is necessary tool for navigating the web.

I tend to view websites more as private property, closer to a book store rather than a public library. Sure, you’re often free to browse the content at your leisure in your local Barns and Noble, but that’s more of a store policy than a requirement. After all, there’s no rule that says content providers cannot use pay walls, or restrict content by requiring registration.

The book store owner typically encourages the leisurely browsing, by providing comfy chairs and sometimes offering a coffee shop or nice music. The hope is that the additional browsing time turns into collateral purchases. There’s no requirement for patrons to purchase, of course, and not all customers do. Enough customers do buy extra books to make it worth the store owner’s while. The display advertisement model is rather similar. Content providers attempt to provide enough interesting content to keep web surfers on their websites, in hopes for a few advertisement clicks.

In the-website-as-book-store view, it’s the responsibility of the content provider to ensure his or her ads are not overly burdensome. You might not like the music playing over the loud speakers in a traditional brick and mortar store. Perhaps it’s just the lyrics you object to, but it’s playing at obnoxiously loud decibels. You still wouldn’t take it upon yourself to rip out the speakers. No jury would accept “potential hearing loss” as justification when you’re free to leave the store at any time. If your experience at the store was unpleasant you may complain, and you’d probably leave. That’s what I do. When ads get too annoying, I leave the website.

It’s not a perfect analogy – (ad blockers are not destruction of another’s physical property) – but it’s the analogy I got.

Many of my favorite techie news sources have been reporting ad blocker use has been on the rise in recent months. As someone trying to make a business with ad supported content, that’s a scary proposition. I decided I couldn’t live in the dark anymore, not knowing how many of my users are utilizing an ad blocker. In a few days I’ll have a good idea whether and how big a problem ad blockers are on my site.