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!
Without seeing the actual error messages I'll just throw this possibility out to you. An example of such an error might be
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
Best practice is to first test for the variable to be defined, e.g.,
Doing this will help to avoid these errors in the Console.
thanks for taking the time to answer!
Unfortunately, I've tried your approach but still have these errors:
I've also tried declaring the variables in an extension, like b['page_name'] = "" but that didn't get me rid of the errors as well.
Do you have another idea why that happens?
Thanks and best regards,
I believe this is occurring in your example because of the order of the tests. The .toString() on the undefined parameter is occurring before the test to see if it is defined.
Ensure the 'is defined' test on the parameter is listed first in the conditions within your extension or JS code:
If that doesn't work for you please file a ticket with email@example.com so we can take a look for you.