Controlling when tags fire in pageload stages

Gold Contributor
Gold Contributor

Is there a way to force specific tags to fire after specific pageloading stages? dom.complete, dom.ready, etc?

I have some tags that on some pages i'd want to fire immeadiately on pageload, whereas on other pages or other tags I'd want to fire after pageload is complete (or at least later than inital pageload process).

4 REPLIES 4

Controlling when tags fire in pageload stages

Employee Emeritus

@Michael_Kim_shc

Out of the box, all Tags loading via Tealium will fire at DOM Ready.

You can change this setting to DOM Complete, but you cannot have both DOM Ready and DOM Complete, you gotta pick one. You will want a JavaScript Extension scoped to PreLoader with the following code: 

window.utag_cfg_ovrd = window.utag_cfg_ovrd || {}; 
utag_cfg_ovrd.dom_complete = true;

Now that said, there is one other setting called the wait flag which is set on a tag by tag basis.  For each tag where the wait flag is no, that tag will load as soon as possible and will not wait for DOM state to change. 

You can read more about the override flags here: https://community.tealiumiq.com/t5/Browser-utag-js/utag-Config-Overrides/ta-p/14048

You can read more about the wait flag in the Advance Settings section of: https://community.tealiumiq.com/t5/Tealium-iQ-Tag-Management/Tags/ta-p/5016#toc-hId--1470671774

 

Controlling when tags fire in pageload stages

Gold Contributor
Gold Contributor

Thanks @brian_kranson!  very helpful!

Controlling when tags fire in pageload stages

Gold Contributor
Gold Contributor

Hi @brian_kranson,

Is there any way to have a tag load prior to dom.ready if desired?

Controlling when tags fire in pageload stages

Tealium Employee

Hi @Michael_Kim_shc

Your best bet to run the tag before DOM Ready would be to turn the wait flag off.

https://community.tealiumiq.com/t5/Tealium-iQ-Tag-Management/Tag-Configuration-Advanced-Settings/ta-...

If you use this, you need to make sure all data that you want to send if ready by the time utag loads and fires the tag.

Regards,

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.
Public