Welcome to WebmasterWorld Guest from 54.90.204.233

Forum Moderators: martinibuster

Message Too Old, No Replies

Ad blocker tracking script for Analytics + AdSense

     
11:23 pm on Nov 11, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Sept 25, 2005
posts:2047
votes: 340


On sites where you employ both Google AdSense and Analytics, here's one simple method to find out how often ads are blocked:

<script>
if(typeof adsbygoogle !== "undefined") {
window.addEventListener('load', function() {
if(typeof adsbygoogle.loaded === "undefined" && typeof ga !== "undefined") {
ga('send', 'event', 'AdSense', 'Ads blocked', { "nonInteraction": 1 });
}
}, false);
}
</script>

Add it just before </body>. This will send an "Ad blocker active" event to Analytics whenever the AdSense ads are prevented from loading.

As soon as you have some data, there are several ways to analyze it, but I find it easiest to create a new segment on the Audience > Overview page. Give it a descriptive name, then select "Conditions" under "Advanced", find "Event Action" in the dropdown menu, enter "Ads blocked" in the textfield (assuming you haven't renamed it in the code above) and click "Save". The segment will now be active. Optionally click the + button next to it and select the "All Sessions" segment for a basic comparison of ad blocked sessions vs. total sessions, bounce rate differences, etc.

  • Events count towards your collection limits [developers.google.com].
  • You need to be using analytics.js (current library) rather than ga.js (legacy library), or events won't be registered.
If you use it, please report your findings :-)

Update:
I should add that this assumes you use Analytics and AdSense on most, if not all, your pages. If you don't, you could consider also logging an event when AdSense ads are loaded, so that you can more accurately gauge the ad blocker share:

<script>
if(typeof adsbygoogle !== "undefined") {
window.addEventListener('load', function() {
if(typeof ga !== "undefined") {
if(typeof adsbygoogle.loaded === "undefined") {
ga('send', 'event', 'AdSense', 'Ads blocked', { "nonInteraction": 1 });
} else {
ga('send', 'event', 'AdSense', 'Ads not blocked', { "nonInteraction": 1 });
}
}
}, false);
}
</script>

(This will obviously further increase the number of events counting towards your collection limits)

[edited by: robzilla at 12:17 am (utc) on Nov 12, 2015]

11:30 pm on Nov 11, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 29, 2005
posts:9092
votes: 756


Curious. Have you tested this on JS disabled browsers, or those with NoScript or similar installed?
11:34 pm on Nov 11, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Sept 25, 2005
posts:2047
votes: 340


What's to test? If all JS is disabled or blocked, the code won't work, and neither will AdSense or Analytics.

It's a fair point, though, this is only aimed at tracking "simple" ad blockers. Tracking users who also block JS is a lot trickier.
12:16 am on Nov 12, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 29, 2005
posts:9092
votes: 756


My point, exactly. :)

Write a Perl or PHP function to track these. It is all too easy to defeat JS at the browser.

edit: And most ad blockers and script killers deal with js from the get go.

Look to server side like perl, php, ruby, python to get best results for this kind of thing.

[edited by: tangor at 12:22 am (utc) on Nov 12, 2015]

12:22 am on Nov 12, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Sept 25, 2005
posts:2047
votes: 340


I'm not so concerned about the JS disablers. The ad blockers are a bigger problem, and (thankfully) much easier to track.

Any server-side scripting would have to account for bots, spiders and other types of non-users. Not worth it for me.
1:12 am on Nov 12, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 29, 2005
posts:9092
votes: 756


Last time I looked g analytics was JS based. I think I would be concerned. :)

At present there's anywhere between 25% and 37% of the web running blockers, script killers, etc. Heck, even here at WW we've seen a number of members jump on the bandwagon for their personal surfing.

Factor in that tangent for your report results.
10:23 am on Nov 12, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Sept 25, 2005
posts:2047
votes: 340


And most ad blockers and script killers deal with js from the get go.

I checked the two most popular ad blockers, AdBlock and Adblock Plus, and both allow JS, including Google Analytics.

Even Ghostery doesn't block anything by default. Disable all JS and you'll break your web experience; it's not for everyone.
12:51 pm on Nov 12, 2015 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Apr 29, 2005
posts:2098
votes: 111


Thanks for posting that. Will give it a go.
8:37 pm on Nov 14, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Sept 25, 2005
posts:2047
votes: 340


19.5% ad blockers for me so far.

Not surprisingly, the blocking group has a lower bounce rate and spends more time on the site.
3:35 am on Nov 15, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Mar 17, 2015
posts:768
votes: 413


Disable all JS and you'll break your web experience; it's not for everyone.

I've never concerned myself with the anti-script brigade. The average user seems content enough with off-the-shelf adblockers. I'm sure the Ghostery and NoScript users are around and that they visit my sites, however I doubt they make up more than a small portion of adblockers.
11:58 am on Nov 15, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2004
posts:1974
votes: 68


I just finished rewriting of an app that records user`s interaction/blocks bots and scrapers/Geo on my sites, Server-Side - ColdFusion/SQL Server/MySql - No sharing of visitors data with outside sources - very important to me. No dependency on JS, but rather on an image that is a part of layout that is referenced in a small CSS file and is never cached.

I wrote the original in very early of 2005 after being overcharged(and never refunded even with solid evidence) for clicks by 2 competitors clicking on our AdWords ads.


@robzilla, does the script You mention still sends data to G for FireFox users that have Private mode enabled?
12:52 pm on Nov 15, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Sept 25, 2005
posts:2047
votes: 340


@robzilla, does the script You mention still sends data to G for FireFox users that have Private mode enabled?

Not when Tracking Protection is enabled, no. All calls to Analytics will be blocked, unfortunately.

Might still work with Piwik, though, if you host it locally. You'd just have to edit the event tracking call.
3:02 pm on Nov 15, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2004
posts:1974
votes: 68


Thanks.
12:43 pm on Nov 16, 2015 (gmt 0)

Full Member

5+ Year Member

joined:Apr 26, 2009
posts:275
votes: 2


I have been doing this for quite some time now and YES it is one of the great ways to determine the real number of visits with Ads Blocked.

You can also add an addition to the filter to separate users with no support for JS, simply click on and in the existing filter and in the second box in the first drop down enter "Java Support" and in the text area enter "No" then save you filter. You should then see the real numbers.
3:07 pm on Nov 16, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Sept 25, 2005
posts:2047
votes: 340


"Java support" indicates whether or not the browser support Java, i.e. applets. This has nothing to do with Javascript, I'm afraid. After all, Google Analytics cannot run without Javascript enabled.
12:13 am on Nov 17, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12913
votes: 891


I don't use Google Analytics. I got tired of the remote HTTP connection hanging-up page loads. However I can easily tell how many pages are affected by adblockers with a similar script I use to serve my own hosted adds if the Adsense container div doesn't load to the full width/height. This information has little value to me though; it is what it is. YMMV
11:57 am on Nov 17, 2015 (gmt 0)

New User

5+ Year Member

joined:Oct 15, 2009
posts: 12
votes: 3


15.5% of blocks and 7 times faster page load times with ads blocked. Bounce rate almsot the same.
12:24 pm on Nov 17, 2015 (gmt 0)

Full Member

Top Contributors Of The Month

joined:May 11, 2015
posts:219
votes: 70


Ramone, I saw similar stats using another tool. Around 16-17% ad blockers (in consumer tech that's actually surprising). Not sure though how many haven't been picked up by the script.
12:25 pm on Nov 17, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12913
votes: 891


Asynchronous scripts should not affect page load time.
10:58 am on Nov 19, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Sept 25, 2005
posts:2047
votes: 340


Thanks for sharing your stats Ramone and LuckyD.

This information has little value to me though; it is what it is.

It is what it is, yes, and knowing won't change anything by itself, but I like to be able to gauge the effect of ad blockers on the user experience, and finding out whether it's worth doing something about it such as replacing AdSense ads with my own, a "donate" button, etc. A ~20% share is pretty significant to me, so I will start experimenting with those options soon.
11:27 am on Nov 19, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12913
votes: 891


I'm not seeing any more than 8 - 12% blocked ads (all Adsense) on 26 - 30k daily page loads. Maybe higher traffic sites are affected more?

I also load in-house ads: my products & affiliate products, as well as sell ad space. None of these are getting blocked. Point being, not enough of an impact to implement evasive measures (yet.)
3:08 pm on Nov 19, 2015 (gmt 0)

New User

5+ Year Member

joined:Oct 15, 2009
posts: 12
votes: 3


Actually percentage is even higher today - 25%
I am wondering about legal consequences of AdBlock programs as its users are breaking terms of service included in sentence:

You may not copy, emulate, clone, rent, lease, sell, modify, decompile, disassemble, otherwise reverse engineer, or transfer any program...

- especially in the part of - modify. AdBlock program is modifying the content of my web page. That is against the TOS of my web site.
5:31 pm on Nov 19, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Mar 17, 2015
posts:768
votes: 413


Preventing a page element from loading isn't really modifying the content though. It's more a case of selective loading/viewing.
My TOS prohibits the use of adblockers. Not that it matters much because <1% of users actually look at the TOS.
8:24 pm on Nov 19, 2015 (gmt 0)

New User

5+ Year Member

joined:Oct 15, 2009
posts: 12
votes: 3


Another observation after adding code above: CTR on ads is about 4 times higher from users with ad blocker than without it. So actually users with ad blockers are more interested in content that is behind ads.
12:09 am on Nov 20, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2004
posts:1974
votes: 68


You may not copy, emulate, clone, rent, lease, sell, modify, decompile, disassemble, otherwise reverse engineer, or transfer any program...

GOOG Cache? Google User Content, etc.....?

I uninstalled AdBlockPlus browser from my devices.

But then:

Androiid>>Framaroot>>SuperSU>>Froid>>AdAway(AdAway Merge Lists) Hosts File>>Goodbye All Ads/Hacks & such!
Windows>>HostsFile(AdAway Merge Lists)>>FF|IE>>Goodbye All /Hacks & such!
iOS(thanks but..) & Blackberry Devices for testing run tru WIFI DD-WRT router firewall.

NoScript Rocks!

My main competitors in E-Com sector all run either "AdCents" or utilize some type of user tracking/data sharing soft package installed.

HA - some of them(trolly, at best) are/were/forgotten about!

I do understand that this is AdSense threads forum section.
7:05 pm on Nov 20, 2015 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 30, 2005
posts: 120
votes: 2


Ramone,

CTR for adblocking users is higher not because they are interested in ads, but because they tend to accidentally click on ads more often. When one normally surfs without ads, something which slips through the block is often mistaken for a site element, navigation or whatever. They do not have a skill to tell ad from content.
10:42 pm on Nov 20, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Mar 17, 2015
posts:768
votes: 413


They do not have a skill to tell ad from content.

Haha, that's a pretty damning assessment of adblock users.
10:35 am on Nov 21, 2015 (gmt 0)

New User

5+ Year Member

joined:Oct 15, 2009
posts: 12
votes: 3


So it means that as my CTR is way bellow what it was some 3-4 years ago that actually adblock users have been actual guys who clicked on ads and all other people have adblock inserted in their vision so they are not in the need of adblock programs.

Than, why we are tracking adblock users anyway? That would lead to conclusion that adblock programs will be of the benefit for advertisers as they will get quality traffic and that would eventally lead to higher CPC of ads.
6:20 pm on Nov 22, 2015 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 30, 2005
posts: 120
votes: 2


The web publishers made much progress in making the ads difficult to distinguish from navigation elements or even article content. If something slips through ad block (or else how do you measure CTR for people with ad blocker?), I'd expect it not to be labelled as an ad by any noticeable method. On the contrary, I would expect it blended as much as possible into the content.
2:21 pm on Nov 24, 2015 (gmt 0)

New User

5+ Year Member

joined:Oct 15, 2009
posts: 12
votes: 3


It is amazing to me how the percent of adblock users is constant in the past 7 days, being 15-16% every day, except for very small period of time.
This 31 message thread spans 2 pages: 31
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members