Ecommerce Analytics

Ecommerce

Matomo offers advanced Ecommerce analytics features. This page will guide you through the following steps:

  • Enable Ecommerce on your website’s tracking.
  • Modify the Matomo 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.

Ecommerce Analytics - 图2

Once Ecommerce is enabled for a website, the Goals menu will be renamed to Ecommerce & Goals and will display Ecommerce reports.

Ecommerce Analytics - 图3

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 you use a popular Ecommerce Software platform such as Magento, Prestashop, Zen Cart, oxid, VirtueMart or osCommerce, there could already be a Matomo Plugin that will install the tracking automatically on your pages.Click on this link and then download the Matomo plugin, install the plugin in your Ecommerce app, enter the Matomo URL, Website Id in the plugin settings. Your Ecommerce pages should then be automatically tagged with the Javascript code and track Cart Updates, Orders and Products/Category views.

Ecommerce Analytics - 图4Ecommerce Analytics - 图5Ecommerce Analytics - 图6

Ecommerce Analytics - 图7Ecommerce Analytics - 图8Ecommerce Analytics - 图9

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!

If you use a custom-made Ecommerce software, you must implement Ecommerce Tracking using the Javascript function calls, in your website pages. Learn more below

Ecommerce Analytics reports

Matomo 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 will provide the following Ecommerce reports.

Ecommerce Metrics:

  • 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 cartsEcommerce Reports:

  • 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 deviceImproved 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 will display the Ecommerce metrics for the selected date range, as well as a graph showing historical values for the selected metric.

Ecommerce Analytics - 图10

Best Products & Best Categories

Matomo 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.

Ecommerce Analytics - 图11

Note that you can access a help definition for each column by hovering on the column name.

Ecommerce Activity log

With Matomo, 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.

Ecommerce Analytics - 图12

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

Ecommerce Analytics - 图13

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 Analytics - 图14

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”.

Ecommerce tracking

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.The following sections explain how to set up Ecommerce tracking, using the JavaScript Tracker Ecommerce tracking methods.

Tracking Ecommerce Orders & Items Purchased (required)

Tracking Ecommerce orders and product details will allow Matomo to process reports on:

  • Product SKU,
  • Product name,
  • Top Product categories and general overview of Ecommerce performance in your online shop.To track Ecommerce orders, two Javascript functions are used:

1) 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.

2) trackEcommerceOrder(orderId, revenue, subTotal, tax, shipping, discount)

This tracks an Ecommerce order and sends the data to your Matomo server, for both this order and products previously added. Only orderId and revenue are required.

Example 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 correctly, your pages should already have a tracking code. The Ecommerce code below must be added and generated based on the Order:

  1. [...]
  2. // add the first product to the order
  3. _paq.push(['addEcommerceItem',
  4. "9780786706211", // (required) SKU: Product unique identifier
  5. "Endurance: Shackleton's Incredible Voyage", // (optional) Product name
  6. "Adventure Books", // (optional) Product category. You can also specify an array of up to 5 categories eg. ["Books", "New releases", "Biography"]
  7. 8.8, // (recommended) Product price
  8. 1 // (optional, default to 1) Product quantity
  9. ]);
  10. // Here you can add other products in the order
  11. [...]
  12. // Specifiy the order details to Matomo server & sends the data to Matomo server
  13. _paq.push(['trackEcommerceOrder',
  14. "A10000123", // (required) Unique Order ID
  15. 35, // (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)
  16. 30, // (optional) Order sub total (excludes shipping)
  17. 5.5, // (optional) Tax amount
  18. 4.5, // (optional) Shipping amount
  19. false // (optional) Discount offered (set to false for unspecified parameter)
  20. ]);
  21. // we recommend to also track a page view on the Order confirmation page
  22. _paq.push(['trackPageView']);
  23. [...]

Description of functions parameters

When tracking an ecommerce order the following values can be set:

  • revenue: the order Revenue grand total (including tax, shipping, and subtracted discount)
  • subTotal: the order sub total which is typically the sum of items prices for all items in this order (excluding any Tax and Shipping costs)
  • tax: the total tax amount
  • shipping: the shipping amount
  • discount: any discount offeredAlso please note the following:

  • price (parameter of addEcommerceItem() function), as well as grandTotal, subTotal, tax, shipping, discount (parameters of trackEcommerceOrder() function) must be supplied as integer or floats, not as string. For example, all the following values are not valid: “14.4$”, “EUR14.4”, “14,4”, “14.4”. The following values are valid: 5, 3.3, 5.44. If your Ecommerce software provides the values as string only, you can call the Javascript function parseFloat() after making sure the string does not contain currency symbol or other characters, for example: parseFloat(“554.20”). Note that the Javascript parseFloat() does not support comma separated decimal values “25,3” so you might have to replace the commas with dots before calling parseFloat().

  • 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 will automatically discard the order as it is already recorded unless you have enabled the setting “Anonymize Order ID” in the privacy management. The same order ID may be tracked multiple times if “Anonymize Order ID” is enabled and you should make sure to not track the same orderId twice. You can use the same orderId for different Websites id, but for a given website, orderId must be unique.
  • If you print out some of these parameters in the HTML code, make sure that the Product SKUs, Names and categories are escaped in particular the ” character (double quotes), otherwise it may create Javascript parse errors.

Additional functions you may find useful

The following options are most likely used if your Ecommerce shop is a Single Page App:

  • removeEcommerceItem(productSKU) – This removes a product from the order by SKU. You still need to call trackEcommerceCartUpdate to record the updated cart in Matomo.
  • clearEcommerceCart() – This clears the order completely. You still need to call trackEcommerceCartUpdate to record the updated cart in Matomo.
  • getEcommerceItems() – Returns all ecommerce items currently in the untracked ecommerce order. The returned array will be a copy, so changing it won’t affect the ecommerce order. To affect what gets tracked, use the addEcommerceItem()/removeEcommerceItem()/clearEcommerceCart() methods. Use this method to see what will be tracked before you track an order or cart update.

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 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 to understand if your changes are making a positive impact.

To track Shopping Carts with Matomo, you would call the javascript function trackEcommerceCartUpdate() every time a user is adding, updating or deleting a product from the cart.

Example tracking an Ecommerce cart update containing two products

The code is added every time the “cart” page is loaded, or when the “Add to cart” button is clicked:

  1. [...]
  2. // add the first product to the order
  3. _paq.push(['addEcommerceItem',
  4. "9780786706211", // (required) SKU: Product unique identifier
  5. "Endurance: Shackleton's Incredible Voyage", // (optional) Product name
  6. ["Adventure Books", "Best sellers"], // (optional) Product category, string or array of up to 5 categories
  7. 8.8, // (recommended) Product price
  8. 1 // (optional, default to 1) Product quantity
  9. ]);
  10. // 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
  11. [...]
  12. // Records the cart for this visit
  13. _paq.push(['trackEcommerceCartUpdate',
  14. 15.5]); // (required) Cart amount
  15. // it is optional to call trackPageView when tracking a cart update
  16. _paq.push(['trackPageView']);
  17. [...]

Tracking Product Page Views & Category Page Views (optional)

Tracking product page views, and/or category page views lets Matomo 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”:

  1. [...]
  2. // all parameters are optional, but we recommend to set at minimum productSKU and productName
  3. _paq.push(['setEcommerceView',
  4. "9780786706211", // (required) SKU: Product unique identifier
  5. "Endurance: Shackleton's Incredible Voyage", // (optional) Product name
  6. "Adventure Books", // (optional) Product category, or array of up to 5 categories
  7. 20.11 // (optional) Product Price as displayed on the page
  8. ]);
  9. // Calling trackPageView is required when tracking a product view
  10. _paq.push(['trackPageView']);
  11. [...]

Example tracking a Category page view

This code is added on the Category page “Adventure Books”

  1. [...]
  2. // on a category page, productSKU and productName are not applicable and are set to false
  3. _paq.push(['setEcommerceView',
  4. productSku = false, // No product on Category page
  5. productName = false, // No product on Category page
  6. category = "Adventure Books" // Category Page, or array of up to 5 categories
  7. ]);
  8. // Calling trackPageView is required when tracking a product category view
  9. _paq.push(['trackPageView']);
  10. [...]

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 rateYou 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

More information

We hope you enjoy using Matomo 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.