Can't collect ecommerce data

Hello guys,

I went through all ecommerce related topics and tried to follow all your tips, but still can’t collect ecommerce data.

  • Added Piwik script through GTM (Custom HTML tag)
  • Configured my tags through PPTM (ViewProduct, AddToCart, Purchase)
  • Debug is correctly displayed and I can see my tags fired when triggering ecommerce events
  • Still nothing in ecommerce reports

I can see Scrolls, JS Errors etc… but only page views, no ecommerce events

Quick sample of my View Product tag:

<script> 
  var _paq = _paq || [];
  var ppEcommerce = {{ DLV - Product - Ecommerce }};
  var ppProducts = ppEcommerce.detail.products;
  
  var ppProductSku = ppProducts[0].id;
  var ppProductName = ppProducts[0].name;
  var ppProductCategory = ppProducts[0].brand;
  var ppProductPrice = ppProducts[0].price;
      
  _paq.push(["setEcommerceView",
             ppProductSku.toString(),       // SKU (stock-keeping unit)
             ppProductName, 		 // name
    		 ppProductCategory, 		 // category
             ppProductPrice        // price
]);
</script>

Anything wrong?

Thanks for your help,
Best,

Docs suggest that this method has to be followed by a page view (_paq.push(["trackPageView"]);). This data will be available in one of the custom vars for the page view.

I’d start the setup with carts update and ecommerce orders which have dedicated reports in the platform.

Thanks Kuba for your quick answer.
I’ve updated the tag as below for the AddToCart event, still nothing:

<script>
 
  var _paq = _paq || [];
  var ppEcommerce = {{ DLV - Product - Ecommerce }};
  var ppProductsAdded = ppEcommerce.add.products;
  
  var ppProductSku = ppProductsAdded[0].id;
  var ppProductName = ppProductsAdded[0].name;
  var ppProductCategory = ppProductsAdded[0].brand;
  var ppProductPrice = ppProductsAdded[0].price;
  var ppProductQuantity = ppProductsAdded[0].quantity;

  _paq.push(["addEcommerceItem",
             ppProductSku.toString(),       // SKU (stock-keeping unit)
             ppProductName, 		 // name
    		 ppProductCategory, 		 // category
             ppProductPrice,        // price
             ppProductQuantity
]);
  _paq.push(["trackPageView"]);
  
</script>

Thanks again for your assistance,
Best

Hi again. It’s better now :slight_smile: But there’s one more thing - this function does not send any data to the tracker. It only prepares the virtual shopping cart to be sent with trackEcommerceCartUpdate or trackEcommerceOrder. So, please call one of those functions instead of trackPageView in this case.

Thanks a lot Kuba, I can now see carts correctly added through ecommerce reports.
Remains the transactions, do I also need to call [trackEcommerceCartUpdate] in addition to [trackEcommerceOrder]?
Below our current tag:

<script>
  
  var _paq = _paq || [];

// track order
  _paq.push(["trackEcommerceOrder", 
     {{ dlv - Confirmation - OrderID }}.toString(),                        // ID
     {{ dlv - Confirmation - orderTotal }},                               // grand total (value + tax + discount + shipping)
     {{ dlv - Confirmation - totalOrderPriceWithoutShipping }},          // sub total (value + tax + discount)
     {{ dlv - Confirmation - orderTotalWithoutTaxWithoutShipping }},    // value (without tax and without shipping)
   
]);
  
</script>

Best regards,
Romain.

No, you don’t have to update the cart. You have to make sure that all the products are added to the cart. In your example that part is missing. Also, make sure that the format of passed arguments is correct (but I see you did that).

Hi Kuba,

I published tag for tracking transactions, but seems I’m missing again something since no data collected.
Below my script:

<script>
  
  var _paq = _paq || [];
  var ppEcommerce = {{ DLV - Product - Ecommerce }};
  var ppProductsConf = ppEcommerce.purchase.products;
  
  ppProductsConf.forEach(function(product){
    _paq.push(["addEcommerceItem",
             product.id.toString(),     // SKU (stock-keeping unit)
             product.name, 		 		// name
    		 product.brand, 		    // category
             product.price,             // price
             product.quantity
    ])
  });  
  
// track order
  _paq.push(["trackEcommerceOrder", 
     {{ dlv - Confirmation - OrderID }}.toString(),                        // ID
     {{ dlv - Confirmation - orderTotal }},                               // grand total (value + tax + discount + shipping)
     {{ dlv - Confirmation - totalOrderPriceWithoutShipping }},          // sub total (value + tax + discount)
     {{ dlv - Confirmation - orderTotalWithoutTaxWithoutShipping }}    // value (without tax and without shipping)
   ]);

</script>

Am I missing anything?
Thanks,

The 4th argument for the order should be the tax amount. Other than that, it looks ok. I might be missing something. Could you check it with the tracker debugger? Do you see any errors in browser’s console? Does this tag generate a request to the tracker endpoint?

A post was split to a new topic: Duplicate pageview after implementing ecommerce