Highlighted

How to merge data from two utag.view calls?

Silver Contributor
Silver Contributor

I'd like to merge data from another call made by a targeting tool and send it to Adobe in the main call than through a second call, on the page.

 

As of now, I cancel only the adobe call(extension scoped to Adobe and return false;) and let the tool call utag.view(with just it's own extra variables).

 

As, the utag.view from the targeting tool, doesn't have all variables in utag_data - just it's own variables. So, Adobe call is incomplete.

 

How can I merge utag_data from both and do a single Adobe call?

4 REPLIES 4
Highlighted

How to merge data from two utag.view calls?

Tealium Employee

Hi Samrat,

The following code will do this for you. Be aware that this code will merge the utag_data on ALL page views, so you may wish to wrap it inside an "if" statement to ensure that you only merge data for specific view events.

 

if (a === "view") {
    for (prop in utag_data) {
        if (utag_data.hasOwnProperty(prop) && !b[prop]) {
            b[prop] = utag_data[prop];
        }
    }
}
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.
Highlighted

How to merge data from two utag.view calls?

Silver Contributor
Silver Contributor

Thanks, that worked.

Highlighted

How to merge data from two utag.view calls?

Silver Contributor
Silver Contributor
Hello Craig,
Is the same method for utag.link? Just changing (a === "view") for (a === "link")?
Highlighted

How to merge data from two utag.view calls?

Employee Emeritus

@jmillan,

 

That is correct.  If you want to merge data from a utag.link then you can use a === "link"