Piwik provides advanced ecommerce analytics features. This page will guide you through the following steps:
- Enable Ecommerce on your website’s tracking.
- Modify the Piwik tracking code to track Ecommerce data, products, orders on your website.
- An overview of the Ecommerce analytics reports to help you understand and improve your online shop!
Enable Ecommerce Tracking
Ecommerce reporting is disabled by default. To enable Ecommerce analytics reporting, click on Settings > Websites > Edit” and select Ecommerce enabled from the dropdown in the Ecommerce column.
Once Ecommerce is enabled for a website, the Goals menu will be renamed to Ecommerce & Goals and will display Ecommerce reports.
If you do not see the Goals menu, it is probably because the Goals plugin is disabled.
Go toSettings & Pluginsto enable the Goals plugins.
Using a Piwik plugin for your Ecommerce Software
If your platform is not in this list, please consider developing an open source plugin to enable Ecommerce Tracking for the software you use. We would be glad to add it the Plugin List and have the whole community benefit!
Once you have enabled Ecommerce tracking for a website, you need to implement tracking of the various Ecommerce interactions on your website. There are three main Ecommerce interactions that are tracked with Piwik:
- Ecommerce Orders (and products),
- Ecommerce Cart update (and products),
- Product (and/or category) page views.
Tracking Ecommerce Orders & Items Purchased (required)
Tracking Ecommerce orders and product details will allow Piwik to process reports on:
- Product SKU,
- Product name,
- Top Product categories and general overview of Ecommerce performance in your online shop.
- addEcommerceItem(productSKU, productName, productCategory, price, quantity) This adds a product into the order, and must be called for each product in the order. productSKU is a required parameter, it is also recommended that you send other parameters if they are applicable in your Ecommerce shop.
- trackEcommerceOrder(orderId, grandTotal, subTotal, tax, shipping, discount) This tracks an Ecommerce order and sends the data to your Piwik server, for both this order and products previously added. Only orderId and grandTotal (ie. revenue) are required.
Here’s an example of tracking an Ecommerce order containing two products – this code should be inserted in the “Order confirmation” page, once the visitor has checked out and issued payment. If you installed Piwik correctly, your pages should already have a tracking code. The Ecommerce code below must be added and generated based on the Order:
[...] // add the first product to the order _paq.push(['addEcommerceItem', "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 ]); // Here you can add other products in the order [...] // Specifiy the order details to Piwik server & sends the data to Piwik server _paq.push(['trackEcommerceOrder', "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) ]); // we recommend to leave the call to trackPageView() on the Order confirmation page _paq.push(['trackPageView']); [...]
Important notes about the functions parameters:
- orderId parameter is a unique string identifier for the order. If the page containing the trackEcommerceOrder() call is refreshed by the customer a few hours or days after the initial Order, Piwik will automatically discard the order as it is already recorded. You can use the same orderId for different Websites id, but for a given website, orderId must be unique.
Tracking Add to Cart & Items Added to the Cart (optional)
Every time a visitor adds (or updates, deletes) an item from his/her cart, you can use Piwik to track the latest cart subtotal as well as products left in the cart. Tracking cart updates will allow you to see how much revenue was left in your visitors’ carts for each day/week/etc, as well as getting reports on which products are most often left in the cart and which product categories are most often left abandoned in carts. Also, you can visualize each visit and the content of the cart they abandoned in the Visitor Log.
Some frequent causes for cart abandonment are:
- high shipping prices,
- complicated forms for new users (lack of “Anonymous checkout” option),
- complicated / lengthy checkout process,
- slow website,
- visitor was just browsing the site or wanted to compare total cost with competitor.
When you make changes to your website to lower the cart abandonment rate, and try to increase your revenues, you can use Piwik to understand if your changes are making a positive impact.
Example tracking an Ecommerce order containing two products:
the code is added every time the “cart” page is loaded, or when the “Add to cart” button is clicked:
[...] // add the first product to the order _paq.push(['addEcommerceItem', "9780786706211", // (required) SKU: Product unique identifier "Endurance: Shackleton's Incredible Voyage", // (optional) Product name ["Adventure Books", "Best sellers"], // (optional) Product category, string or array of up to 5 categories 8.8, // (recommended) Product price 1 // (optional, default to 1) Product quantity ]); // Here it is important to add all other products found in the cart, even the products not updated by the current "Add to cart" click [...] // Records the cart for this visit _paq.push(['trackEcommerceCartUpdate', 15.5]); // (required) Cart amount _paq.push(['trackPageView']); [...]
Tracking Product Page Views & Category Page Views (optional)
Tracking product page views, and/or category page views lets Piwik process the conversion rate for each product and/or category.
It can be useful to know which product or category pages have converted your visitors into customers. For example, perhaps some product pages have below average conversion rates but generate high revenue. You may decide to improve these product pages and check their conversion rates over time.
To track a product or category page view, the function setEcommerceView( productSKU, productName, categoryName, price ) is used, just before the call to piwikTracker.trackPageView() on the product/category page.
Example Tracking a Product Page View
In this example, the following code is added to the Product page for the book “Endurance” which is in the category “Adventure Books”:
[...] // all parameters are optional, but we recommend to set at minimum productSKU and productName _paq.push(['setEcommerceView', "9780786706211", // (required) SKU: Product unique identifier "Endurance: Shackleton's Incredible Voyage", // (optional) Product name "Adventure Books", // (optional) Product category, or array of up to 5 categories 20.11 // (optional) Product Price as displayed on the page ]); _paq.push(['trackPageView']); [...]
Example tracking a Category page view
This code is added on the Category page “Adventure Books”
[...] // on a category page, productSKU and productName are not applicable and are set to false _paq.push(['setEcommerceView', productSku = false, // No product on Category page productName = false, // No product on Category page category = "Adventure Books" // Category Page, or array of up to 5 categories ]); _paq.push(['trackPageView']); [...]
Ecommerce reports in Piwik
In your Piwik interface, you can find Ecommerce reports by clicking on the main menu on “Ecommerce & Goals”.
Assuming you have set up Ecommerce tracking as explained above, Piwik will provide the following Ecommerce reports
- Ecommerce Metrics
- Ecommerce orders
- Total revenue
- Average order value
- Ecommerce conversion rate
- Purchased products
- Abandoned carts metrics: Visits with abandoned carts, revenue left in carts
- Ecommerce Reports
- Ecommerce overview: revenue, orders, conversion rate, AOV (Average Order Value), etc.
- Best productSKUs
- Best product Names
- Best product Categories
- Ecommerce Log – displays all visits containing an Ecommerce Order, so you can visualize your customers clickpath
- Improved standard Reports
- Existing reports will now include the “Ecommerce revenue” in the processing of the “Revenue” column.
- These standard reports will also have a new metric column: “Ecommerce conversion rate”
Ecommerce Activity Overview
By default, Piwik will display the Ecommerce metrics for the selected date range, as well as a graph showing historical values for the selected metric.
Best Products & Best Categories
Piwik processes the list of Top Products sold, ordered by any of the Product metrics: Revenue, Quantity purchased, Unique Purchases, Average price, Average quantity, Visits or Conversion rate.
You can get the top products reports by Product SKU, by Product Name or by Category.
Note that you can access a help definition for each column by hovering on the column name.
Ecommerce Activity log
With Piwik, you can view (in real time!) the detailed Ecommerce log, showing all visits that have made a purchase on your website, as well as all visitors who have abandoned their shopping cart with products left in them.
Ecommerce Metrics in Standard Reports
Existing reports will now display the Ecommerce metrics in column list, so that Ecommerce performance can be visualized in any existing report and not only in the Ecommerce report page.
Advanced Ecommerce Statistics API
All the data available in the User Interface Ecommerce reports is also available via the Piwik Analytics API.
You can easily request the list of products purchased on your site, either grouped by Product SKU, Product Name or Product Category.
For each entry; the following metrics are returned:
- Total revenue
- Total quantity
- Average price
- Average quantity
- Number of orders (or abandoned carts) containing this product
- number of visits on the Product page
- Conversion rate
You can request these reports for Ecommerce orders, and also for abandoned carts.
Check out the full documentation and example links at: Ecommerce Analytics API Reference
We hope you enjoy using Piwik to track your Ecommerce shop(s), and that Ecommerce analytics helps you to generate more revenue from your website, as well as keeping your customers happy.
If you have any feedback or question about this documentation, please post a message in the Forums or in the feedback form below.