Bring Embedded Data from variables present on page's datalayer | XM Community
Skip to main content

Hello, I have an intercept being presented on a page with a some data fields that I need to bring as embedded data on the responses, but I could not find a way to make it work - the fields related to them are always in blank. 

From what I could understand, the fields are from a Google Tag Manager

The things I’ve already done, without success:

  • declare the field’s value type as “HTML on site” (this works on other pages from the same client, but I imagine this page can be developed differently);
  • declare the field’s value type as “Google Data Layer”;
  • declare the field’s value type as “Value from cookie” (just for testing, I could not find them on cookies);
  • Configured the event tracking on the intercept with the name of the event (“delivery_tracking”).

Below it follows a datalayer viewer extension to refer as they are shown (the fields I want to bring are the ones under the event “delivery_tracking”, like “service_type”, “origin” and “destination”):

 

Any tips on how to bring this data to the intercept responses will be much appreciated. Thanks!

Seems you have to pass html css selector for that variablr to capture dame as embedded field. 


Seems you have to pass html css selector for that variablr to capture dame as embedded field. 

Thanks for the tip! Any clue on how to do this?


First, here’s the documentation for Google Tag Manager and Integrating Google Data Layer. Please confirm that you have followed all of the steps just to make sure everything is set up correctly, or nothing will work.

You’re likely having this problem because the value you’re trying to get from the Datalayer is nested within another.   The documentation only lists examples that are key-value pairs and are flat-hierarchy, for lack of a better term.

The data that you’re trying to capture is under a Data layer item called “dl.infos”.  The usual practice is to add that, then a period, then the name of the data element you’re trying to capture, like this: dlinfos.tracking_code.

But you face an additional issue, which we are also facing: the data is contained within a Custom Event called delivery_tracking, and it’s not clear how to account for that.  I’ll post as soon as I get an answer, but the info above should keep you busy for now.


Leave a Reply