Snowplow not tracking "add to basket" events


#1

Hi everyone,

We are using Snowplow in parallel to Google Analytics. So far so good except with the enhanced ecommerce tracking.

The problem occurs with the “add to basket” events on the product details page: it is added under the ecommerce object in the dataLayer without flushing the previous ecommerce events.

Consequently, the event “add” is labelled as “detail”:

In short, the ecommerce object contains 2 objects: “detail” and “add” but unlike Google Analytics which takes only the latest one, Snowplow records “detail” instead of “add”:

We followed, very seriously the snowplow documentation for enhanced ecommerce events (https://github.com/snowplow/snowplow/wiki/Integrating-Javascript-tags-with-enhanced-ecommerce) but cannot find out why this is happening (and why we are the only one having the issue :stuck_out_tongue: ).

Thank you for your help.

Aymeric.


#2

Hi @aflaisler,

Would you be able to share the code that generates the event?

Perhaps that could give us some hints as to what is happening.

Thanks,
Leon


#3

Hi Aymeric,

Looks like you’re pushing a product detail view and add to cart event in the one push. Here’s what Google recommends pushing:

// Measure adding a product to a shopping cart by using an 'add' actionFieldObject
// and a list of productFieldObjects.
dataLayer.push({
  'event': 'addToCart',
  'ecommerce': {
    'currencyCode': 'EUR',
    'add': {                                // 'add' actionFieldObject measures.
      'products': [{                        //  adding a product to a shopping cart.
        'name': 'Triblend Android T-Shirt',
        'id': '12345',
        'price': '15.25',
        'brand': 'Google',
        'category': 'Apparel',
        'variant': 'Gray',
        'quantity': 1
       }]
    }
  }
});

Source: https://developers.google.com/tag-manager/enhanced-ecommerce#add

Try pushing each event separately and see if that works.

Edit: Also if you’re pushing the dataLayer[n].ecommerce object as a data layer variable in GTM. Try setting it to version 1. That will ensure the variable is treated as a full object and ignore values pushed in previous events for detail, impression etc.


Snowplow not tracking a part of the order baskets