- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
07-20-2016 07:39 AM
I want to check for an DOM element's existence, then create/set a variable based on that condition, then map this variable value to a tag. Should this be done in a JS extension? If so how would I create the data layer variable to map (or do I have to do that)?
07-24-2016 08:32 PM
Please have deep dive into the below related links which you are looking for,
https://community.tealiumiq.com/t5/Tealium-iQ/JavaScript-Code-Extension/ta-p/11925
Hope it help!
07-25-2016 02:26 AM - edited 07-25-2016 02:27 AM
Further to the answer from @Srinivasan - you can actually do this using just a set data values extension, with a condition. Then just take the output from the extension (in this case, test_trait) and map it to the required tag.
If you need to create a new data source you can add it directly from the extension, by pressing the + button in the middle of the configuration box (see below)
You could also scope the extension to the tag, if you only want that data to be available for that exact tag.
07-26-2016 09:47 AM
07-26-2016 09:58 AM
One other thing I forgot to mention, I noticed that there is no conditional configuration option available on the custom JS extension. Is there a way to isolate the custom JS to a specific URL (aside from the custom JS to detect the path, etc.)?
07-26-2016 12:47 PM
07-27-2016 05:48 AM
You can use a ternary conditional in the JS value field, yes.
Copyright All Rights Reserved © 2008-2023