Ecommerce JS - trackecommerce order question!

If a successful order is placed, what needs to be filled into the JS code below for it to populated accordingly?

“A10000123”, // (required) Unique Order ID
35, // (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)
30, // (optional) Order sub total (excludes shipping)
5.5, // (optional) Tax amount
4.5, // (optional) Shipping amount
false // (optional) Discount offered (set to false for unspecified parameter)

Could someone give me an example code of how it’s supposed to look?

It’s supposed to look like this:


Our site has 1400+ items in our inventory, so if we were to update the code above to work for each and every product…how would that work?

Also, I’ve placed the scripts correctly onto my site but no data is populating. Does anyone know why this is happening?

Also, I’ve placed the scripts correctly onto my site but no data is populating.

What about posting your code here so we can have a look at it?

Oops! You’re right here you go…

This is the code right above the :

and now add to the following line to the piwik tracker code

piwikTracker.trackEcommerceOrder( "YOUR ORDER ID", ORDER TOTAL $$$, ORDER SUBTOTAL $$$ (or leave empty), ORDER TAX $$$ (or leave empty), ORDER SHIPPING $$$ (or leave empty), DISCOUNT $$$ (or set to false));

tracker.setCookieDomain('*'); // Same cookie as:, 
// if this is the checkout-thankyou-page 
// END if this is the checkout-thankyou-page

here’s an example from my own site: 301 Moved Permanently

THANK YOU for your help Wit!

I have some questions I hope you would be able to answer:

  • Where would you find the codes for Order ID, Order TOTAL $$$, etc?
  • I have a main domain that is used to track visitors, then when users are prompted to buy a product they are sent to Volusion (ecommerce software) servers. Would code state above be on both of the sites?

Thank you again!!!

Where would you find the codes for Order ID, Order TOTAL $$$, etc?

This comes from your eCommerce-software (shop-system e.g. magento, oscommerce,…)

they are sent to Volusion (ecommerce software) servers

Do you have access to the volusion system or to the templates used (especially checkout-thankyou page)?

Would code state above be on both of the sites?

No, this code should only be placed on checkout-thankyou page


Thank you again, Wit.

I’ve updated the conversion code on the thank you page, but I’m still having the problem with Piwik to where data is not being tracked. Btw, the code is supposed to track a main domain and subdomain.

Here’s is the code for the main domain:

and this one for the OrderSuccess page:

Seems rigt.

But: i’m missing a “foreach item loop” - or do your customers only buy one item per order?

piwikTracker.addEcommerceItem( "1301", "Magic Marker", "Tools", 2.95, 1 ));

Give me some values - what stands in Order[0] - Order[5] ??

piwikTracker.trackEcommerceOrder( "Order[0]", Order[2], , Order[4], Order[5], false));

Best regards.

I’m not sure what the first statement meant. What does the “for each item” loop mean? The line mentioned is for one specific item. I’m going to add more over time as soon as everything starts working properly.

These are the values provided by the e-commerce tracking software:

Order Array Contents

Order[0] = Order ID
Order[1] = Unused
Order[2] = Payment Amount
Order[3] = Affiliate Commisionable Value
Order[4] = Sales Tax
Order[5] = Total Shipping Cost
Order[6] = Billing City
Order[7] = Billing State
Order[8] = Billing Country

OrderDetails Array Contents

OrderDetails[X][0] = Order ID
OrderDetails[X][1] = Order Detail ID
OrderDetails[X][2] = Product Code
OrderDetails[X][3] = Product Name
OrderDetails[X][4] = (unused)
OrderDetails[X][5] = Product Price
OrderDetails[X][6] = Quantity


The data still isn’t populating for me.

Help, anyone?


Do something like this to loop through products.

Most likely, you won’t be looping through your products in the footer, so you will need to make some changes there.

<script language="text/javascript">
$cnt = 0;
foreach ($OrderDetails AS $OrderDetail) {

^ Thankyou for your reply, but that didn’t fix the issue.

I’m willing to buy someone coffee if they’re able to resolve this issue…Thank you!

You would need to post the part of the code that adds a product. I don’t know what language you are using or naming conventions used.