Highlighted

About mapping hierarchical JavaScript objects

joonas
Visitor
joonas

A large scale site that I'm working with more or less follows the CEDDL 1.0 "spec". In the spec products on, lets say, a product listing page are described in the product attribute of the digitalData object in a form of an array of separate product objects.

I'd need to map the properties of these product objects that are in the array. The amount of the product objects in the array can vary between scopes. What are my options?

The Flatten JSON Objects extension only helps in mapping the last product in the array as it operates in a mode where it doesn't resolve conflicts between object keys in the product objects and thus the data that you're left with is just the data of the last product in the array of products.

The E-Commerce extension seems to understand arrays but it requires the data to be in a very different format than what the data is currently in.

2 REPLIES 2

About mapping hierarchical JavaScript objects

VIP
VIP VIP

Hi @joonas  - sounds like you will need to do some debugging and testing then write a little bit of custom code in a JavaScript extension to convert your array data into something the Ecommerce Extension can work with.  

 

I had to do this on one of my implementations as well - it was a lot of fun to figure it out and satisfying to see it all work.  

About mapping hierarchical JavaScript objects

joonas
Visitor
joonas

Thanks for you comment @mitchellt but that I already know and we have the necessary modifications written. I just wanted to bring this topic up as to me it's rather unbelievable that tracking multiple products in one go seems to be unnecessarily hard for the end users on Tealium and that Tealiums implementation is so far from the what the spec suggest even though they've taken part in writing the spec.