Highlighted

How can I wait until the tag fully loads before executing some code?

Bronze Contributor
Bronze Contributor

We have a pre-loader that sets of our data collection libraries. I'd like to load a specific tag once some other setup code fires, which I am able to do via:

utag.view(utag_data, [1]);

but how can I wait to continue my pre-loader until that tag fully loads?

 

Is there any way to do an onload event listener for the tag?

1 REPLY 1
Highlighted

How can I wait until the tag fully loads before executing some code?

Silver Contributor
Silver Contributor

If you need to wait until a tag is fully loaded before executing code I would recommend using a custom container and use a loader callback function.  There is a good article on how to implement this here: 

https://community.tealiumiq.com/t5/Tealium-iQ-Tag-Management/How-to-Tealium-Custom-Container-Tag-wit...

Specifically I would refer to section 6.  This outlines how to specify the code to run after the script has been fully loaded.

 

If I have seen further it is by standing on the shoulders of giants