Highlighted

Can we dynamically reference the "S-Object Name" from a JS extension?

Rookie Contributor
 
1 REPLY 1
Highlighted

Can we dynamically reference the "S-Object Name" from a JS extension?

Tealium Employee
Hi Sofiane, Usually, the S Object name would be consistent on a page, so it should be safe to always refer to "s" (or whatever you have defined the object name as) in an extension. If you're writing an extension that will be deployed on sites with several different s object names, you could do something like this: Assume you have 3 s objects, but you don't know which one is in scope for this extension: "teal_s" "s" "trackingData" You could do something like: {code:javascript} var local_s = window.teal_s || window.s || window.trackingData; {code} This would give you a local reference to the "s" object, so long as 1 of the 3 object names is defined. I'm not sure if this would help in your situation or not. Perhaps you can share some more details on what you're trying to achieve? Thanks, Craig.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.