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

Silver Contributor
Silver 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

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

Gold Contributor
Gold 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
Public