Setting up Ecommerce tracking via Launch from the GA ecom datalayer?

kasperk28581810

18-01-2019

Is it possible do pull info from the GA enhanced ecommerce datalayer already in place or do I need to have my developers to also set a datalayer specifically for Adobe?

Accepted Solutions (1)

Accepted Solutions (1)

StewSchilling

MVP

22-01-2019

Yes. This should be doable using the Data Layer Manager, Adobe Analytics, and AA Product String Builder Extensions.

The first step will be to install and configure the Data Layer Manager extension.

Assuming that your GTM data layer is the default name, window.dataLayer, I'd suggest the following config:

Screen Shot 2019-01-22 at 8.00.45 AM.png

Once this is done and built to your dev library, there will be a custom event dispatched whenever a JSON object that includes an "event" key set. As an example, let's say that this GTM EEC payload is pushed:

When it is pushed, the Data Layer Manager will dispatch a custom event with the type, "GA_EEC:AddToCart".  You can easily trigger a Launch rule using the CORE > CustomEvent trigger as below:

Screen Shot 2019-01-22 at 8.07.19 AM.png

Note a couple things: 

  1. The Custom Event Type is determined by combining the Custom Event Prefix from the Data Layer Manager config and the "event" value from the payload that is being pushed.
  2. Select the "specific elements" radio button, and enter "#triggerNode" as the CSS selector.  Again, we are matching up with the configuration of the Data Layer Manager. 

Step 2:

Install the Adobe Analytics and AA Product String Builder extensions. We will be adding actions from both of these extensions.  In the end, it will look like this:

Screen Shot 2019-01-22 at 8.24.31 AM.png

On the same rule triggered by the event described in Step 1, add the Clear Variables action and a Set Variables action from the Adobe Analytics Extension.  Set the "prodView" event and any other values that you'd like to send on the same beacon.

Then Add a Set Variables action from the AA Product String Builder extension as below:

Screen Shot 2019-01-22 at 8.19.28 AM.png

The only trickery here is the value entered in "Root Data Object". 

That value is %event.detail.__meta.computedState% .  It points to into the context of the event that triggered the rule.  Within that context is the __meta.computedState object which is provided by the Data Layer Manager whenever an event is pushed to the data layer.

The other values are just paths to attributes within the "products" array.  In this case, we are mapping:

  • ecommerce.add.products[n].id to the AA productID in the product string.
  • ecommerce.add.products[n].quantity to AA event1 in the product string and events variable.
  • ecommerce.add.products[n].name to AA eVar1, using merchandizing syntax in the product string.
  • ecommerce.add.products[n].brand to AA eVar2, using merchandizing syntax in the product string.
  • ecommerce.add.products[n].category to AA eVar3, using merchandizing syntax in the product string.

Once this is done, add a "Send Beacon" action to the end of this action sequence. Then save the rule, build your library and test!

Just in case you need it, there is another tutorial on this subject here.  It is not specific to the GTM EEC data layer structure, but it demonstrates the same concepts.

Cheers,

-Stew

Answers (0)