we are using the Data Layer Enrichment Feature.
Our use case is easy: we have products with "id" and we retrieve the "product_category"
Everything is working as expected with single products.
We have pages with multiple products and would like to retrieve several categories.
I tried to pass an array like this:
id: ["prod_id_1", "prod_id_2"]
Unfortunatly, this is not working, and the file retrieved is prod_id_1,prod_id_2.js
I couldn't find any further information in the documentation.
Can you help on this issue?
Apologies for a late response.
The API will accept a string of data, and that string must reference a single value.
The issue with what you are trying to do is that the response of each successive call will overwrite that response of each prior call.
So let's say you have ["prod_id_1", "prod_id_2"]
And the lookup output for prod_id_1 is:
While the lookup output for prod_id_2 is:
Notice how the output keys are the same.
When the logic runs, prod_id_1 will be imported and set prod_sku and prod_name, then when the following prod_id_2 call occurs it will overwrite prod_sku and prod_name. Meaning you'll only ever have one set of keys available.
Does that help answer you question?
Not at this time. The API was built to serve single item info, for example on a product page.
We would have to make an update to the system to handle a lookup on an array of data, and to append to an array of data. I have submitted the appropriate request to Engineering for review.
We would also need this feature by the way. We have product lists, or a user can have multiple products in his cart or checkout, so there is always the need to grab multiple product's data in one request.
To only allow this for one product is a bit short-sighted imho.
do you have an update on the status on the lookup for multiple products? This is quite a critical issue for us.
Moreover: We would like to be able to do the data layer enrichment not only on pageload, but also on subsequent utag.link events. If I understand correctly, this is not possible right now. Could you please advice on how to get that working and / or extend the extension?
If both features (multiple products + lookup on link events) were available, this would be a great plus compared to other TMS imho.
Thanks and best,
This request has been submitted but not yet added to our roadmap. Please escalate again through your channel manager or account manager so that it can follow the appropriate process. They will need to own the communication within the business and between the agency or client.
I'm going to have to assume the issue you're running up against is that when DLE API is ran on page load, the returned DLE data isn't persisted in the global utag.data object for post page load event tracking. If so, please let me know if the below is what you are looking for.
utag.ut.merge(utag.data,b,1); to a JS extension scoped to All Tags and Before Load Rules so that the DLE data is persisted.
Then pass that DLE data as part of the utag.link call. For example, if you have a jQuery extension that tracks the Add to Cart event and you want to pass the
product_availability DLE variables then you would configure the extension as follows:
Hope this helps!
Hi @dan_george, thanks, we had thought about this ourselves already, but this would require all kinds of major changes to the current tracking. We don't want to change everything around just because of one new feature.
And it would cover only this one use case. There will be others in the future where the ID of a product will only be known later and not on the pageview, so I don't want yet another ugly workaround for these things (Tealium is full of workarounds anyway already)...