How to use Google Analytics to track your AdBlock rate

Swasti Sharma
Wed, 16 Aug 2023 10:14:06 +0000
Categories

If you suspect you are losing ad revenue due to ad blockers, Google Analytics can assist you! Here’s a simple tutorial for using Google Analytics to detect ad-block users and make informed judgments.

Over the last decade, the share of web traffic that employs ad blockers has skyrocketed. According to eMarketer, over 76 million US consumers have installed ad blockers in their browsers, costing the advertising business over 30 billion dollars in losses by 2020.

For a variety of reasons, an increasing number of people are installing ad blockers on their browsers. Some people dislike ads, while others may utilize them to combat malicious conduct, and still, others may choose to disable ads for privacy reasons.

Whatever the cause, an increasing number of users have an ad blocker installed on their browsers. Ad-blockers take care of not only advertisements but also other trackers on websites.

Ad-blockers prohibit publishers from monitoring their visitors across numerous sites or services by blocking trackers from launching on a page.

This is a significant issue for digital publishers because it interferes with their ability to analyze the effectiveness of their online advertising campaigns and, in some cases, cuts their profits in half.

As a result, understanding whether your visitors are using ad blockers is critical. The good news is that Google Analytics can help you with this.

Most publishers are well aware of the value of Google Analytics as their first line of defense in determining visitor behavior and content performance.

However, some people are unaware that they can use Google Analytics to their advantage in resolving the ad-blocking issue.

If you’re in the same scenario, this blog post will explain how to track ad-block users with Google Analytics using two ways.

1: In Google Tag Manager, Create A Custom Event Trigger.

The custom event trigger is used to track interactions that take place on your website or mobile app but are not handled in regular ways. The most common application is when you wish to track form submissions, but the form’s default behavior has been changed (e.g., the submit browser event has been overridden.)

To create a new custom event trigger, follow these steps:

Select Triggers, then New.

Select the Custom Event trigger type from the Trigger Configuration menu.

Enter a name for the event. To allow this field to handle regular expressions, check the “use regex matching” box.

Configuration example

Here’s an example web configuration that will send a tag to the data layer when a custom event called ‘button1-click’ is triggered:

When the button is pressed, add the following code to send the event to the data layer:

?Button 1

Make a new customized event trigger. Use the following settings in the Trigger Configuration section of your new tag:

Event name: button1-click

This trigger fires on All Custom Events

When you apply this trigger to a tag, it will fire even if the default submits event is overridden. When the provided button is pressed, the data layer receives a custom event with the value button1-click. Tag Manager then recognizes button1-click as a custom event value and fires the tag.

To send several variables along with the event, use dataLayer.push().

As an example: Send the following conversion value with the custom event name: dataLayer.push({‘event’:’button1-click’,’conversionValue’:25});

In Tag Manager, create the data layer variable and utilize it in the conversion value field of your Google Ads conversion tracking tag.

2: In Google Tag Manager, Create A New Event Tag.

In this step, we’ll be creating a Google Analytics event that will record the number of times an ad blocker was detected. Every event requires at least 2 components: Category and Action.

You can specify your event further by adding an optional Label and Value field. Here’s a refresher on how to categorize your events.

Typically, events are fired based on link clicks, video plays, form submissions, and specific page visits. Our event will be recorded as page visits.

To create an event tag, follow these steps:

Select New from the Tags menu on your left.

Select Google Analytics from the Tag Configuration menu: Analytics at a Glance

Make the Track Type Event.

Enter the Category and Action values. While it is not required, we have included a Label in our example.

Under Google Analytics Settings, select Google Analytics Tracking ID.

Under Triggering, add your new custom event trigger.

Don’t forget to give your event a name and hit Save when you’re finished!

This event will keep track of how many times an adblocker was identified on a pageview. You must compare your AdBlock rate to the total number of pageview hits to establish your AdBlock rate. Simply build a new event that is triggered by all page views to accomplish this.

3: Incorporating JavaScript Code Into The Website’s Header

We’ll now go on to the technical component of the detection process, the script, ready with our event tag and trigger.

Why do AdBlockers Use AdBlock Filters?

To identify what should be blocked and hidden on web pages you visit, virtually all ad-blocking browser plugins, including AdBlock, employ rules. These rules are also referred to as filters, and they are available in collections known as filter lists.

AdBlock filter lists can help you prevent a variety of other bothersome — or even harmful — items online in addition to adverts. For example, the Malware Protection filter list can shield you from sites known to contain adware and other forms of malware.

Here is how you can Incorporate JavaScript code into the website’s header

Add the following JavaScript code to the website’s header to determine if a visitor has an ad blocker installed on their browser.



(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

})(window,document,’script’,’https://www.google-analytics.com/analytics.js’,’ga‘);

// Creates an adblock detection plugin.

ga(‘provide’, ‘adblockTracker’, function(tracker, opts) {

var ad = document.createElement(‘ins’);

ad.className = ‘AdSense’; //Name of ad partner you’re working with.

ad.style.display = ‘block’;

ad.style.position = ‘absolute’;

ad.style.top = ‘-1px’;

ad.style.height = ‘1px’;

document.body.appendChild(ad);

tracker.set(‘dimension’ + opts.dimensionIndex, !ad.clientHeight);

document.body.removeChild(ad);});

ga(‘create’, ‘UA-XXXXX-Y’, ‘auto’); //Replace UA-XXXXX-Y with your tracking ID.

ga(‘require’, ‘adblockTracker’, {dimensionIndex: 1});

ga(‘send’, ‘pageview’);