Load Tealium tags upon window.onload

Bronze Contributor
Bronze Contributor

Hi,

 

I'm looking to improve performance on my site and would like to explore the option of loading Tealium tags on window.onload. Does Tealium provide such a functionality? 

Thanks in advance.

4 REPLIES 4

Load Tealium tags upon window.onload

Tealium Employee

Hi @Manish

 

Without directly editing the utag loader template the best option you have is to turn on the dom_complete override.

Normally the loader will start processing tags when the DOM State has moved away from Loading, and in either Interactive or Complete.

 

You can do this in an JS extension scoped to Pre Looader.

With the code:

 

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

 

Adrian

 

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

Load Tealium tags upon window.onload

Bronze Contributor
Bronze Contributor

Hi Adrian,

 

Thanks for the response, I presume this approach would mean we would be loading all tags in the profile after DOM ready. I'm trying to load and fire specific tags after DOM ready and retaining others as is.

 

-Manish

Load Tealium tags upon window.onload

Tealium Employee

@Manish

 

So you the tags that would fire after DOM Complete are the ones where you have set the wait flag to yes on a tag.

If they are set to wait no, they they will fire as soon as the utag is ready.

 

The other option is to use the utag.view functionality of firing specific tags. This could mean you have an extension that tracks DOM Complete, and then fires a utag.view({...data...}, null, [<array of tag ids>]);  for the tags that you want to fire at this point.

 

Adrian

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

Load Tealium tags upon window.onload

Gold Contributor
Gold Contributor
 
Public