Search code examples
google-analyticsanalyticsenhanced-ecommerce

How to handle Analytics Enhanced Ecommerce product float quantity


According to the "Enhanced Ecommerce" product data "quantity" only supports integers.

But, some of the items on our cart are sold by the pound as such the quantity is not an integer but can be. 0.3ls, 1.2lb and etc. Two issues:

  1. When the quantity is less than 0.5 then it seems like it's rounded to 0 and the line is not shown at all.
  2. Even when it's shown e.g. 1.3 rounded to 1 then we loose a lot of data here.

A workaround like moving to work in 1unit=0.01lb before we send it to GA has its own drawbacks and causes a signification data impact.


Solution

  • The workaround you suggest (using a smaller unit) is the only good solution right now, until Google implements float quantities.

    In terms of data signification it actually doesn't have an impact: a product unit is arbitrary anyway, since you could have pounds, ounces, grams, milligrams or any multiple of these or other units as the smallest increment for a product. As long as the price per unit is accurate your data will be correct. Prices can have up to 6 decimals so any rounding errors are negligible.

    To ensure your data is readable, I suggest that you look for a base unit that is low enough (for example a thousandth of a pound) so you can always express orders for your current and future products in integer multiples of it. That way you only have to do one transformation (x 1000) when reading report data, instead of having to remember the base unit for each product.