Setting up e-commerce goals for manual JS trcking



I’m struggling with setting up the e-commerce tracking.

The issue is that I’ve set up all the java scripts as explained on this page ( but either conversions nor product statistics appear on the piwik e-commerce&goals view. I feel that I have to setup the goals first. However in the above mentioned doc not a word talks about it. And if I go to the goal setup view I don’t have an option to setup a goal that will be tracked manually per java script. What am I doing wrong? I would very appreciate if you could point me to my error or explain how to set up a goal for “manual” JS-trcking. Thakn you in advance,


(Matthieu Aubry) #2

You don’t have to setup a Goal first, you only need to “enable Ecommerce” for your website in Piwik website settings.

To debug, I recommend you use “firebug” extension on Firefox and look at the HTTP requests made on your pages supposed to trigger ecommerce carts/orders/etc. and check that the requests are made to piwik (you should see request to piwik.php with your product names as parameters?)


thanks, Matt!

I’ve done precisely this - activated e-commerce and inserted configured addEcommerceItem() and trackEcommerceOrder() calls into the correspondent webpages. However, although I do sell products, nothing is there on the e-commerce&goals view. The only thing I see there is that nothing happens - zero purchases, zero conversions.

Here is an example of code, that I’ve inserted:

<script type="text/javascript">
	var pkBaseURL = (("https:" == document.location.protocol) ? "https://piwik.mysite.tld/" : "http://piwik.mysite.tld/" );
 	document.write(unescape("%3Cscript src=\'" + pkBaseURL + "piwik.js\' type=\'text/javascript\'%3E%3C/script%3E" ));
<script type="text/javascript">
try {
	var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
	addEcommerceItem("200", "Product name", "category name", 150, 1);
	trackEcommerceOrder(some_initialized_unique_numeric_transactionID_var, 150);
} catch( err ) {}

“mysite.tld” stands apparetly for the valid URI of my site.

If I understand the doc right, it should work, but it does not.

Please point me to my error, if any.

Thanks in advance,

(Matthieu Aubry) #4

You should prefix “piwikTracker.” before addEcommerceItem such as:

piwikTracker.addEcommerceItem("200", "Product name", "category name", 150, 1);


Thank you very much, Matt! :)-D

It was it!

How stupid of me not to consider the object’s prefix (:P)


:)I think Google analysis’s “ecommerce tracking” is quite easy and effective among all. And is the answer of your all questions.

E-commerce solution