Matomo (Piwik) offers advanced Ecommerce analytics features. This page will guide you through the following steps:
- Enable Ecommerce on your website’s tracking.
- Modify the Matomo (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 Administration > Websites, 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 to Administration > Plugins to enable the Goals plugins.
Using a Matomo 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!
Ecommerce Analytics reports
Matomo (Piwik) offers several useful and important ecommerce reports and metrics. In your Matomo 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, Matomo (Piwik) will provide the following Ecommerce reports.
- Ecommerce orders
- Total revenue
- Average order value
- Ecommerce revenue per visit
- Ecommerce conversion rate
- Purchased products
- Abandoned carts metrics: Visits with abandoned carts, revenue left in carts
- Ecommerce overview: revenue, orders, conversion rate, AOV (Average Order Value), etc.
- Best product SKUs
- Best product Names
- Best product Categories
- Ecommerce Log – displays all visits containing an Ecommerce Order, so you can visualize your customers clickpath
- Sales by Marketing Channels
- Sales by Country
- Number of days before Customer purchases
- Number of visits to purchase
- Sales by device
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”
Advanced custom Reports:
- Pull out the information you need to make your Ecommerce business even more successful. It will only take you a few clicks with the Custom Reports premium feature.
Ecommerce Activity Overview
By default, Matomo (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
Matomo (Piwik) displays 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 Matomo (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.
Sales by Marketing channel
Ecommerce sales by marketing channel is reported (for all channels, search, websites, campaigns, social), and useful metrics for each channel: Total revenue, average conversion rate, average basket revenue, number of purchased products, revenue per visit, and more.
You can also apply attribution models to discover the true value of each marketing channel using the Multi Channel Conversion Attribution premium feature.
Sales by country, city, region
Purchased products historical performance
You can see the historical performance of a particular Product, or a Product category. On the historical graph you can plot any of the key ecommerce metrics: Product revenue, Quantity, Unique Purchases, Visits, Average Price, Average Quantity, Product conversion rate.
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. In the report footer, click the visualisation icon and click “Display a table with Ecommerce metrics”.
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 Matomo:
- 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 Matomo (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 Matomo (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 Matomo (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 Matomo server & sends the data to Matomo 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 also track a page view 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, Matomo (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.
- removeEcommerceItem(productSKU) This removes a product from the order by SKU.
- clearEcommerceCart() This clears the order completely.
Generally, you only need to call these method if you don’t track the order all at once and it’s possible for a user to edit their cart after addEcommerceItem() is called. Otherwise, if you track an order after or as it is placed, then you just need to add the items and track the order.
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 Matomo (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 Matomo (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 // it is optional to call trackPageView when tracking a cart update _paq.push(['trackPageView']); [...]
Tracking Product Page Views & Category Page Views (optional)
Tracking product page views, and/or category page views lets Matomo (Piwik) calculate 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 ]); // Calling trackPageView is required when tracking a product view _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 ]); // Calling trackPageView is required when tracking a product category view _paq.push(['trackPageView']); [...]
Advanced Ecommerce Statistics API
All the data available in the User Interface Ecommerce reports is also available via the Matomo Analytics (formerly 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 Matomo (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.