***

Note: AdBlocker plus has now whitelisted doubleclick.net – thus this optional step only necessary if the client operates in a vertical where there is a higher than normal number of adblockers installed (e.g Adult content website).

image143

***

To monitor any loss in traffic when switching for ga.js to dc.js caused by adblocking of doubleclick.net pixel, this script can be added:

<!– Source: andrescholten.net/google-analytics-retargeting-for-adwords-and-adblock-software –>

<script>var adblocking = true;</script>

<script src=”/js/advertising.js”></script>

<!– You will need to upload advertising.js file which just contains var adblocking = false; –>

<script>

window.dataLayer = window.dataLayer || [];

// Check to see if adblocking.js was blocked, then load dc.js via GTM event

if (!adblocking) {

dataLayer.push({“event”: “onload_dc_js”, “eventAction”: “success“, “eventLabel”: “dc_js”, “eventNonInteractive”: true}); // universal default mode

}

// if blocked load ga.js fallback via GTM event

else {

dataLayer.push({“event”: “onload_ga_js”, “eventAction”: “failure“, “eventLabel”: “ga_js”, “eventNonInteractive”: true}); // universal in display mode ticked

}

</script>

<head>

 

Note two nonIneractive event for ‘onload_dc_js’ and ‘onload_ga_js’ will need to be added based on “eventAction”: “success” and “eventAction”: “failure“. For example:

image144

A 1second timeout and if gat is undefined, can also be used if uploading the adblocking.js file is not possible:

<!– customHTML script to trigger two events – one using dc.js and the other using ga.js sourced from here –>

<script>

window.dataLayer = window.dataLayer || [];

 

// Run all pages – has 1second setTimeout delay

setTimeout(function(){

if (typeof _gat == ‘undefined’) {

// Record an onload event of doubleclickTest in GA via dataLayer

dataLayer.push({

‘event’: ‘onload_ga_js’,

‘eventAction’: ‘failure’,

‘eventLabel’: ‘ga_js’,’eventNonInteractive’: true

});

} else {

dataLayer.push({

‘event’: ‘onload_dc_js’,

‘eventAction’: ‘success’,

‘eventLabel’: ‘dc_js’, ‘eventNonInteractive’: true

});

}

}, 1000);

})();

</script>

 

WARNING about blending ga.js and dc.js: Installing different tracking code on the same page will trigger a ChromeTagAssistant critical error. Data will report to your GA account, but the pageview and user data will become unreliable resulting in pageviews/visits over-reporting and Display data under-reporting. Source: https://support.google.com/tagassistant/answer/3059154?ref_topic=2947092#ga_dc

0117 3361103