Do anyone know how to prevent website wait a time to trigger all script in GTM tags?
My website have an event that will redirect to new URL when I click a button
I want to catch this event in GTM tag and add some script code to track behavior. I have setup a tag for this, it’s fired correctly but sometime no event capture; I was checked and put my code to console tab and it also worked.
I want wait a sec to run my code. But don’t know how to, I have tried use eventlistener(‘id-button’) but this make conflict with default event.
I’m just add tracking in GTM and don’t have access to based website code. The website also push missing datalayer. Sample below:
dataLayer.push({
event: "gtm.click",
gtm.element: "HTMLButtonElement: html > body > div.container > div.productPage1 > div.product_t" +
"op > div.pure-g > div.pure-u-1.pure-u-md-1-2 > div.product__content > div.pure-g " +
"> div.pure-u-1.pure-u-md-3-4 > div.action > button.and_checkout.btn_order.btn_add" +
"_to_cart.buy-now.preorder",
gtm.elementClasses: "and_checkout btn_order btn_add_to_cart buy-now preorder",
gtm.elementId: "",
gtm.elementTarget: "",
gtm.triggers: "10,11,12,13,14,15,16,17,18,19,20",
gtm.elementUrl: "",
gtm.uniqueEventId: 22
})
Have someone tried this before? Pls help me a solution and I only can adjust in GTM tag.