google-analyticsenhanced-ecommerce

Enhanced ecommerce - possible to add & remove a product in same payload?


After reading through the documentation and some posts I'm still unclear on whether sending a remove and add product data type will work in the same hit. Something like this:

eccomerce: {
   add: {
      products: [...]
   },
   remove: {
      products: [...]
   }
}

When I test this GTM does not complain, but some of what I've seen written says that you can only send one action, I'm not clear on whether I'm breaking this or not.

Can anyone confirm whether the above is supported?


Solution

  • If you look at the specification of the Product action in the Measurement Protocol reference, you can see, that:

    Must be one of: detail, click, add, remove, checkout, checkout_option, purchase, refund.

    Compared to other product related dimensions, like Product name for example, which is allowed to have an index, Product action can have a single value. Therefore, it is not possible to combine multiple actions into one hit.

    This is the same, that I have seen during testing this scenario. You can provide multiple product actions for GTM, but the final payload will contain only one of them. (E.g. when looking at the actual call in the Developer Console and checking pa= parameter value, or by examining it with Google Analytics Debugger extension. Not to mention the data finally populated in enhanced ecommerce reports.)