- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
02-21-2014 11:07 AM
Solved! Go to Solution.
02-21-2014 11:14 AM - last edited on 12-29-2015 04:57 PM by kathleen_jo
Hi Tomas,
You can use the 'Javascript Code' Extension scoped to 'Pre-Loader' to achieve this functionality.
utag_data.name_of_new_variable_1 = "variable value";
utag_data.name_of_new_variable_2 = ["variable value 1", "variable value 2"];
You can set the variable value to be a string or array.
02-21-2014 11:15 AM - last edited on 12-29-2015 04:54 PM by kathleen_jo
Hey Tomas,
The utag.data object does not exist when the PreLoader extensions run. The utag.data object gets defined within the utag.js file. Because the Pre Loader extensions run before anything else in the utag.js file the utag.data and the "b" object are not defined at that time.
To do this you will need to use "utag_data" like so:
utag_data["variable"]
02-21-2014 12:30 PM - last edited on 12-29-2015 04:55 PM by kathleen_jo
hm, doesn't work either:
utag_data["variable"] = "variable value";
utag_data.name_of_new_variable_1 = "variable value";
could there be something else?
02-21-2014 12:41 PM - last edited on 12-29-2015 04:55 PM by kathleen_jo
If utag_data isn't defined on the page then this won't work because you can't set a variable in an object that doesn't exist.
You will need something like:
if(typeof utag_data=="undefined"){
utag_data = {}
}
utag_data["variable"] = "variable value";
02-22-2014 12:10 PM - last edited on 12-29-2015 04:56 PM by kathleen_jo
Thanks Jared.
Different question - why does Tealium fail silently on dev and qa? Debugging JS in Tealium with console.log is very inconvenient.
DEV and QA environments should spit out all the Tealium related errors and warnings into console.
02-24-2014 08:03 AM - last edited on 07-12-2016 03:55 PM by kathleen_jo
Tealium has a built in debugging function within it's library. You can follow one of the options for Method 2 in this post:
https://community.tealiumiq.com/t5/uTag/Debugging-utag-view-and-utag-link/ta-p/13695
This will output various logs into the console as the tags load and fire. It will also log errors that are found in JS Code Extensions.
All JavaScript Code Extensions are wrapped in a Try/Catch statement that when the utagDB cookie is set it will output the error and the path to the error.
It will output something like:
All Tags EXTENSIONS utag.js?a234asdf234:422
e:fail is not defined , s://tags.tiqcdn.com/utag/jaredtest/test/dev/utag.js , l:5 , t:ge
e= Error Message
s= File that threw the error
l= Extension number
t= Just logging that this came from an extension
NOTE: This will not work for JavaScript Code Extensions Scoped to PreLoader because the utag.DB function has not loaded by then. At this point you will need to use your own kind of logging for debugging.
02-24-2014 08:11 AM
Copyright All Rights Reserved © 2008-2023