- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
Hello,
I am trying to read data from the utag.js in our iOS App. We are currently using TealiumIOS in version 5.3.0.
I did set up a SetDataExtension to the values will be available in the utag.js.
But now I am struggeling to read the data in the iOS app. If i open the utag.js in the Browser all values I did set are there, but I do not find a way to read them inside the app.
The following delegate method is called and does contain the webView hosting the utag.js:
func tealium(_ tealium: Tealium!, webViewIsReady webView: Any!)
Is there an easy way to get the value of the variables?
Or an other way to read data, which were set in tealium, in an iOS App?
09-14-2017 07:42 AM - last edited on 09-14-2017 08:01 AM by kathleen_jo
Hi @Michael,
There is a way to retrieve the data layer from the WebView, there's an example in the sample apps that we host on Github:
The Function at the bottom called enableRemoteCommand set's up a function that can be triggered after a View/Link event:
class func enableRemoteCommand() { Tealium.instance(forKey: tealiumInstanceID)?.addRemoteCommandID("testCommand", description: "An example remote command block", targetQueue: DispatchQueue.main, responseBlock: { (response: TEALRemoteCommandResponse?) -> Void in print("Remote command response processed - \(response)") // Put any code here that can execute on the main thread - ie content // modification, A/B testing, etc. }) }
In order to trigger this function, you need a "TagBridge Custom Command" tag from the marketplace in your IQ profile, and using the code from above the Command ID field would need to be "testCommand" (obviously you can change this name it just needs to match in your Tag and in your Native code.
Once you trigger a View/Link tracking event, the TagBridge tag will send the data layer in JSON format back to this function - and this should allow you to access the values you've set in your extensions.
Hope that helps.
James
Copyright All Rights Reserved © 2008-2023