Is there a way to make the GPT tag wait on the processing of a Tealium Custom Container before GPT executes?

Gold Contributor
Gold Contributor
I need to load an external js file, process some code on load and then set data for the GPT mapping. I was wondering if there is a way to have GPT wait on processing of the Tealium Custom Container.
2 REPLIES 2

Is there a way to make the GPT tag wait on the processing of a Tealium Custom Container before GPT executes?

Tealium Employee
I can think of a few ways, but each has their own caveats as well. Option 1: One option is to include the code for that JS file into a JavaScript Code extension and set the extension's scope to Pre Loader. This makes that code the very first thing Tealium will load, ensuring that code loads and executes before the GPT Tag. Any data set by this code will be ready for the GPT Tag. However, this won't be treated like most of the other Tags, meaning you can't use load rules. Any special loading circumstances would have to be handled by more JavaScript code. I recommend contacting your Tealium Account Manager if you do this. Option 2: You can place the external JS file in the Tealium Custom Container, and place it at the top of your list in the Tags tab and place the GPT Tag at the bottom. This way your Tealium Custom Container will load first, and your GPT Tag will load last. In most circumstances this means the Tealium Custom Container will execute before the GPT Tag, but this isn't guaranteed for every situation. To make sure your Tealium Customer Container loads before any of the other Tags, you can set its Wait Flag setting to 'No' (https://community.tealiumiq.com/posts/644178-tag-configuration-advanced-settings#wait_flag). This means the Tag won't wait for the DOM Ready signal and instead loads as soon as the utag.js file loads. However, if this Tag relies on some element on the page to fire properly, and that element hasn't loaded yet, it may result in the Tag exhibiting unexpected behavior or failing to load. You can find out more about the order in which elements load via utag.js here: https://community.tealiumiq.com/posts/723886-utag-js-order-of-operation-white-paper Option 3: The next option is to use the Custom Script Source Tag Setting for the Tealium Custom Container (https://community.tealiumiq.com/posts/644178-tag-configuration-advanced-settings#custom_script_sourc... Place the URL for the file, without the protocol, into the field. Any Tag that has this setting configured turns into a "Blocking Tag". A blocking Tag is a Tag that must load before Tags after it can load. This will ensure that your Tealium Custom Container Tag loads before your GPT Tag, but this can negatively affect the other Tags if your Custom Container takes a long time to load. Contact your Account Manager for this one as well. I hope this was helpful. - Seth

Is there a way to make the GPT tag wait on the processing of a Tealium Custom Container before GPT executes?

Gold Contributor
Gold Contributor
Very helpful. Thanks
Public