[solved] Ecommerce tracking

Hi all,

I need some help setting up the tracking of ecommerce. Somehow I can’t seem to get i working. Here is my code (note that it’s taken from the examples on this site):

"9780786706211", // (required) SKU: Product unique identifier
"Endurance: Shackleton's Incredible Voyage", // (optional) Product name
"Adventure Books", // (optional) Product category. You can also specify an array of up to 5 categories eg. ["Books", "New releases", "Biography"]
8.8, // (recommended) Product price
1 // (optional, default to 1) Product quantity
"130", // (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)


I can see the cart in the header of the visitors log (where browser/ip/etc is) but the ecommerce screen stays empty and the cart does not show in the pages-section of the visitors log.

Can someone see what is wrong here?

Ok I have tested some more. If I remove the piwikTracker.addEcommerceItem call and the piwikTracker.trackEcommerceCartUpdate call, it will show the cart and Revenue: 350 € in the pages section of the visitors log and the orders are added to the ecommerce section.

But I still can’t see what product is ordered and the documentation clearly shows I need to call addEcommerceItem first

Any help is welcome

I’m not sure if it is related but I seem to have the same problem with custom variables

piwikTracker.setCustomVariable(1,"test","test2" ) ;

does not seem to work.

All these cases should work fine. If you can, prepare a test file with your JS calls that don’t work and open in a different browser. if you really have no tracking and no error in the logs, put the code to reproduce here and we’ll investigate!

Well it’s exactly like the code I gave above:

This is the verion I’m using now:

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);

piwikTracker.trackEcommerceOrder("151", 100);


} catch( err ) {document.title=err.message}

This will give the following in the user log (note the [ordererd] bit):

Fri 30 Mar - 22:11:14 (1s)   [Netherlands, Provider Upc]   [Chrome 17.0, Plugins: flash, java, quicktime, windowsmedia, silverlight]   [Linux, 1920x1080]   #0  - [ordered] - IP: x.x.x.x
Direct Entry
Pages:  [Title - Fri 30 Mar 22:11:14] 

Now if I remove the addCommerce line:

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);

piwikTracker.trackEcommerceOrder("152", 100);


} catch( err ) {document.title=err.message}

It will show this in the visitors log

Fri 30 Mar - 22:21:57 (10 min 46s)   [Netherlands, Provider Upc]   [Chrome 17.0, Plugins: flash, java, quicktime, windowsmedia, silverlight]   [Linux, 1920x1080]   #0  - [ordered] - IP: x.x.x.x
Direct Entry
Pages:  [Title - Fri 30 Mar 22:11:14] Revenue:  100 € 

There is nothing in the apache error log and there is no php error log and both logger_error and logger_exeption tables are empty.

Can I somehow see the contents of the ecommerceItems variable (I’m not too good in js)?

Ok Using firebug I can see it creates the following raw request:


and after the getRequest call:


Do you see anything strange in that?

I have tried in different browsers and I have with a new database but I can’t get it working. :frowning:

I found it, this old server still had magic quotes on which screwed things up a bit. Disabling that (which should have been done anyway) fixed the issue.