I have function which pushes clicked link attributes to dataLayer for Google tag manager.
https://developers.google.com/tag-manager/enhanced-ecommerce
Problem is that extension "adguard" has ability to block such tracking. In adguard it calls 'A filter for all known counters and analytical systems'. While blocking dataLayer.push, it blocks eventCallback event too and link doesn't get opened.
Here is function:
function ga_promoTriggerClick(e)
{
var p_id = $(e).attr("data-id");
var p_name = $(e).attr("data-name");
var p_creation = $(e).attr("data-creation");
var p_pos = $(e).attr("data-pos");
dataLayer.push({
'event': 'promotionClick',
'ecommerce': {
'promoClick': {
'promotions': [
{
'id': p_id,
'name': p_name,
'creative': p_creation,
'position': p_pos
}]
}
},
'eventCallback': function()
{
var p_href = $(e).attr("href");
if(typeof p_href != "undefined")
{
document.location = $(e).attr("href");
}
}
});
}
How can i send user to link if "adguard" is blocking the dataLayer.push?
Some thoughts:
- Error / Success / Fail function, but none of them exists.
- Set timeout 1 second ( this way user will have 'lag' )
- Check if adguard is turned on ( somehow ) and on click check the variable
Thanks for suggestions
dataLayer
to something else? – vinoaj