Highlighted

utag_data object declaration

Silver Contributor
Silver Contributor

Hi all,

I have a very minor problem, but it does interest me: Not all variables that I use in iQ are declared in the script that is part of the HTML-code. So there are some elements in utag_data that are not declared from the very start of the page loading.

This does not seem to create any problem yet, but I get nasty error messages in the output of the debug mode. So I wanted to get rid of them. I found two rather simple solutions, which are both quite similar. First, I've declared the variables in the beginning of utag.sync, which I am fortunate having as part of the setup. The other try was to use a JS-extension that does pretty much the same and I've scoped it to pre loader.

This works quite well - the error messages disappear from the debug output on the console, but only when it's a page load. When any event is triggered, the errors are back.

I just can't figure it out why this happens - the variables should be declared, so why are they not valid in the event scope?

Thanks for your ideas and help!

Best regards,

Bernd

1 REPLY 1
Highlighted

utag_data object declaration

Tealium Employee

Hi @sangmister,

Without seeing the actual error messages I'll just throw this possibility out to you. An example of such an error might be 

image2.png

Tealium will catch errors when a method is applied to a variable that is undefined. This will occur for any test on conditions within Load Rules and Extensions

 image1.png

Best practice is to first test for the variable to be defined, e.g., 

image3.png

Doing this will help to avoid these errors in the Console. 

Thanks, David