Reply
Highlighted
Visitor
Posts: 1
Registered: ‎05-02-2016

TealiumIOS read data set in Tealium iQ

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?

Reply
0 Kudos
Tealium Employee
Posts: 2
Registered: ‎02-29-2016

Re: TealiumIOS read data set in Tealium iQ

[ Edited ]

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:

https://github.com/Tealium/tealium-ios/blob/master/Samples/iOS_UIKitCatalog%2BTealium_Swift/UIKitCat...

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