How do you delay a tag to fire on document complete?

Bronze Contributor
Bronze Contributor
 
6 REPLIES 6

How do you delay a tag to fire on document complete?

Moderator
Moderator
Hi John, By default, Tealium will fire all tags on DOM Ready (when all the page content has loaded). Does that answer your question, or were you thinking of something else? Craig.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

How do you delay a tag to fire on document complete?

Bronze Contributor
Bronze Contributor
No, I have specific need to delay a tag firing when dom has loaded all resources completely.

How do you delay a tag to fire on document complete?

Moderator
Moderator
If you absolutely require the whole page and all resources to be loaded, you can use the "load" event, which will only fire when all resources (including iframes) have loaded. We don't have an option in Tealium for this, as it's not normally necessary. It would be possible to create an extension to fire a specific tag on the document complete event by firing a utag.view call, and passing in the specific UID of the tag that you wish to fire. If you are using jQuery, it would look something like this: Assuming the UID of the tag you wish to fire is "44": {code:javascript} jQuery(window).load(function () { window.utag.view(window.utag_data, undefined, ["44"]); }); {code}
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

How do you delay a tag to fire on document complete?

Bronze Contributor
Bronze Contributor
I've been testing, but I haven't been able to delay the tag to doc complete.

How do you delay a tag to fire on document complete?

Bronze Contributor
Bronze Contributor
Got it to work by adding a new load rule that always evaluates to false.

How do you delay a tag to fire on document complete?

Gold Contributor
Gold Contributor
I have the same need. In the order confirmation page I have the main tag for analytics, and others for marketing campaigns. I need to run the former before everything else starts, in order to avoid any loss of data. The tag order that we use in Tealium affects the order utag loads each tag, but does not manage what they do. I mean, usually the analytics tag takes a long time to run more than any other tag, so it will fire the pixel at the last moment. Even if I use the WAIT FLAG=OFF for the analytics tag, I noticed that the other tags, if cached, could run before anyway. So, do you suggest not to load other tags in the order confirmation page, and load them after a delay using something like the setTimeout() function? Thanks,
Public