# Ecommerce tracking doesn't send any data

**URL:** <https://community.piwik.pro/t/ecommerce-tracking-doesnt-send-any-data/2393>\
**Category:** Data collection and tags\
**Created:** [June 19, 2023, 6:29am UTC](https://community.piwik.pro/t/ecommerce-tracking-doesnt-send-any-data/2393 "2023-06-19T06:29:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Petr\_Pakosta](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/petr_pakosta/32/1934_2.png) [@Petr\_Pakosta](https://community.piwik.pro/u/Petr_Pakosta)\
**Post date:** [June 19, 2023, 6:29am UTC](https://community.piwik.pro/t/ecommerce-tracking-doesnt-send-any-data/2393/1 "2023-06-19T06:29:07Z")

</div>

Hi! A week ago I have set up Piwik… it works fine! But I can’t get any data into ecommerce module, I tried different settings, but without success. Now, I display this code on final order page:

window.dataLayer.push({  
event: “order\_confirmation”,  
products: [  
{  
sku: “342”,  
name: “Klimt, Gustav - Portrét Adele Bloch Baurer I”,  
category: “101”,  
price: 760,  
quantity: 1  
},],  
{orderId: “2306195637”,  
grandTotal: “760”  
}

});

var \_paq = \_paq || ;  
var products = {{ products }};  
products.forEach(function(product){  
\_paq.push([“addEcommerceItem”,product.sku, product.name,product.category, product.price, product.quantity])  
});  
\_paq.push([“trackEcommerceOrder”,{{ order\_id }}, {{ grand\_total }}]);

and below it is:

(function(window, document, dataLayerName, id) {  
window[dataLayerName]=window[dataLayerName]||,window[dataLayerName].push({start:(new Date).getTime(),event:“stg.start”});var scripts=document.getElementsByTagName(“script”)[0],tags=document.createElement(“script”);  
function stgCreateCookie(a,b,c){var d=“”;if(c){var e=new Date;e.setTime(e.getTime()+24_c_60_60_1e3),d=“; expires=”+e.toUTCString()}document.cookie=a+“=”+b+d+“; path=/”}  
var isStgDebug=(window.location.href.match(“stg\_debug”)||document.cookie.match(“stg\_debug”))&&!window.location.href.match(“stg\_disable\_debug”);stgCreateCookie(“stg\_debug”,isStgDebug?1:“”,isStgDebug?14:-1);  
var qP=;dataLayerName!==“dataLayer”&&qP.push(“data\_layer\_name=”+dataLayerName),isStgDebug&&qP.push(“stg\_debug”);var qPString=qP.length\>0?(“?”+qP.join(“&”)):“”;  
tags.async=!0,tags.src=“[https://slavneobrazy.containers.piwik.pro/“+id+”.js](https://slavneobrazy.containers.piwik.pro/%22+id+%22.js)”+qPString,scripts.parentNode.insertBefore(tags,scripts);  
!function(a,n,i){a[n]=a[n]||{};for(var c=0;c\<i.length;c++)!function(i){a[n][i]=a[n][i]||{},a[n][i].api=a[n][i].api||function(){var a=.slice.call(arguments,0);“string”==typeof a[0]&&window[dataLayerName].push({event:n+“.”+i+“:”+a[0],parameters:.slice.call(arguments,1)})}}(i[c])}(window,“ppms”,[“tm”,“cm”]);  
})(window, document, “dataLayer”, “5c9c3752-3297-492b-8a6d-99dcf8a5f2fc”);

and console.log says: Uncaught TypeError: Cannot read properties of undefined (reading ‘push’)

Any hint welcomed!

Thank you

Petr

---

<div class="post-metadata">

**Author:** ![asinior](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/asinior/32/1905_2.png) [@asinior](https://community.piwik.pro/u/asinior)\
**Post date:** [June 19, 2023, 8:59am UTC](https://community.piwik.pro/t/ecommerce-tracking-doesnt-send-any-data/2393/2 "2023-06-19T08:59:43Z")

</div>

Hi,

Make sure that you are following Piwik PRO’s help center article while creating the ecommerce setup. Here is a link to the article: [Set up ecommerce tracking | Piwik PRO help center](https://help.piwik.pro/support/getting-started/track-ecommerce/)

From what you described in the thread, I see that you might be using old ecommerce methods (trackEcommerceOrder, addEcommerceItem). You can find the new ecommerce methods here: [API — Piwik PRO Analytics Suite 17.3 documentation](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/api.html#e-commerce-v2)

Also, I noticed that you missed a closing tag in your \_paq.push([‘ecommerceProductDetailView’, …])  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/5/5f347b633d5196ac317667064047e99bbdc4bd48.png)

---

<div class="post-metadata">

**Author:** ![Petr\_Pakosta](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/petr_pakosta/32/1934_2.png) [@Petr\_Pakosta](https://community.piwik.pro/u/Petr_Pakosta)\
**Post date:** [June 19, 2023, 9:59am UTC](https://community.piwik.pro/t/ecommerce-tracking-doesnt-send-any-data/2393/3 "2023-06-19T09:59:24Z")

</div>

Thank you! it was a last version from this forum ([How to set up ecommerce tracking?](https://community.piwik.pro/t/how-to-set-up-ecommerce-tracking/79))… I change the code:

\_paq.push([  
“ecommerceOrder”,  
[  
{  
sku: “2128”,  
name: “Renoir, Auguste - Váza chryzantém (Dahlias)”,  
category: “101”,  
price: 714,  
quantity: 1  
},],  
{ orderId: “2306195640”,  
grandTotal: “714”}]);

and I got any parser error but this: “Uncaught ReferenceError: \_paq is not defined”. I guess that I need to initialize all the \_paq function somewhere… But I don’t know how 🙂

---

<div class="post-metadata">

**Author:** ![asinior](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/asinior/32/1905_2.png) [@asinior](https://community.piwik.pro/u/asinior)\
**Post date:** [June 19, 2023, 10:51am UTC](https://community.piwik.pro/t/ecommerce-tracking-doesnt-send-any-data/2393/4 "2023-06-19T10:51:58Z")

</div>

Please try adding **var \_paq = window.\_paq || [];** before the \_paq.push([“ecommerceOrder”, …]) method.

---

<div class="post-metadata">

**Author:** ![Petr\_Pakosta](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/petr_pakosta/32/1934_2.png) [@Petr\_Pakosta](https://community.piwik.pro/u/Petr_Pakosta)\
**Post date:** [June 20, 2023, 6:48am UTC](https://community.piwik.pro/t/ecommerce-tracking-doesnt-send-any-data/2393/5 "2023-06-20T06:48:24Z")

</div>

Yes! It works now 🙂 Thank you so much!
