+6 votes
in Tutorials and Guides by (1.5m points)

Find out how many visitors use AdBlock with Google Analytics

1 Answer

+7 votes
by (725k points)
 
Best answer

In recent years, ad blockers have had a special impact, the number of users deciding to use them increasing. This generates a decrease in advertising revenue quite high, which is why we must know the number of users who visit our website and block advertising . This has motivated me to write this tutorial, where I show you how to find out how many visitors use AdBlock with Google Analytics .

image

In order to carry out this tutorial we will only need a web page and a text editor to add the tracking code that allows us to find out how many users are blocking the advertising. In addition, the code we will provide is fully compatible with WordPress.

How to find out how many visitors use AdBlock with Google Analytics.

In order to register the visits that use AdBlock with Google Analytics we will use a very simple Javascript code, which in turn makes use of Google Analytics events.

The code checks if a Google Adsense advertising block is loaded and thus determine whether or not the advertising is blocked. Therefore, for the javascript code to work correctly, we assume that the website uses at least one Google Adsense block. If not, we will have to slightly modify the code on the line var ad = document.querySelector("ins.adsbygoogle"); to select the HTML element that uses the advertising block of our website.

The Javascript code that we will use is the following (also available from this link ):

<script>
window.onload = function() {
    // Retraso para permitir la carga de los anuncios
    setTimeout(function() {
        // Obtenemos el primer bloque de publicidad Adsense
        var ad = document.querySelector("ins.adsbygoogle");
        // Si el bloque de publicidad no se carga, registramos el evento
        if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {

            if (typeof ga !== 'undefined') {

                // Registrar el evento "True" en Universal Analytics sin afectar al porcentaje de rebote
                ga('send', 'event', 'AdBlock', 'True', {'nonInteraction': 1});

            } else if (typeof _gaq !== 'undefined') {

                // Registrar un evento no interactivo (compatibilidad Google Analytics antiguo)
                _gaq.push(['_trackEvent', 'Adblock', 'True', undefined, undefined, true]);

            }
        } else {
            // Si el bloque de publicidad se carga correctamente, registramos el evento
            if (typeof ga !== 'undefined') {

                // Registrar el evento "False" en Universal Analytics sin afectar al porcentaje de rebote
                ga('send', 'event', 'AdBlock', 'False', {'nonInteraction': 1});

            } else if (typeof _gaq !== 'undefined') {

                // Registrar un evento no interactivo (compatibilidad Google Analytics antiguo)
                _gaq.push(['_trackEvent', 'Adblock', 'False', undefined, undefined, true]);

            }
        }
    }, 3000); // Detectar los anuncios tres segundos despues de que cargue la página
};
</script>

You just have to paste it into the <body> tag of the HTML code of the web page we want to analyze. My recommendation is to place it towards the end, in the footer or footer.

To use this code in WordPress we will have to edit the footer.php file of our theme and add the code we provided earlier. That easy.

Now we have the code working, we can only review the statistics of Google Analytics in the Comportamiento -> Eventos -> Eventos principales . Here we will find the event called «AdBlock» , on which we have to click.

image

Now we will see on screen the different actions of the AdBlock event, which are «True» (counts visits with AdBlock activated) and «False» (counts visits with AdBlock deactivated) . To analyze the data in a more comfortable and intuitive way, we will mark with a check both «True» and «False» and press the button «Include in the graph» to show a graph with the different statistics.

image

We already have on screen a graph with which to analyze the impact of ad blockers on our website.

image

What to do with AdBlock traffic?

Some ideas not to miss the traffic that comes to our website with an activated ad blocker can be:

  • Show alternative ads : There are some ad networks whose ads are not blocked by AdBlock, for example Acceptableads.com or Adrecover.com.
  • Show a message to motivate the user to deactivate AdBlock on our website. In this way you add the URL of our website to your trust list and the advertising will be displayed normally.
  • Force the visitor to disable AdBlock on our website by blocking access to content. In this way, the user can only access the content if he disables AdBlock.
  • Show a donation widget instead of the ads. There are many websites that when they detect the use of AdBlock, replace the ads with a widget that allows users to make donations through PayPal and similar services.

The biggest problem with this is that ad blockers also block good advertising, because it is true that good advertising exists. With advertising, the opportunity is born to maintain totally free websites, but bad practices and abuses (especially annoying pop-ups), increasingly push to take advantage of ad blockers.

In short, to know if you should monetize traffic with Adblock, you must first know how many visitors use AdBlock on your website.


Most popular questions within the last 20 days

...