Track ecommerce

Necessary tools: Analytics + Tag Manager

If you run an online store and want to track transactions along with web analytics data, you can use ecommerce tracking and ecommerce reports in Piwik PRO. In this article, we’ll explain how to do that.

Set up ecommerce tracking

Ecommerce tracking allows you to use JavaScript code to collect data for events like adding a product to the cart, updating the order value, completing an order, and the like. To make the tracking work, you’ll need to code ecommerce elements that you want to track in Tag Manager.

Visitor flow in on an ecommerce website.

Here’s the list of core JavaScript functions that you’ll need to use to track ecommerce:

  • Add to cart: This function tracks when a product is added to the cart. It automatically creates an abandoned cart. In other words, every uncompleted order is tracked as an abandoned cart in Piwik PRO. It also tracks when a product is removed from the cart.
addEcommerceItem(productSKU[, productName, productCategory, price, quantity])
  • Checkout: This function tracks when a visitor clicks the checkout button and updates the total cart value. At this stage, the cart is still treated as an abandoned cart.
trackEcommerceCartUpdate(grandTotal)

Note: Payment in the shopping process is usually processed by an external payment gateway like PayPal or Google Pay, and therefore can’t be tracked.

  • Order completed: This function tracks when a visitor is redirected to the thank-you page after paying for the order. It automatically updates the cart from an abandoned cart to order.
trackEcommerceOrder(orderId, orderGrandTotal[, orderSubTotal, orderTax, orderShipping, orderDiscount])

The full list of JavaScript functions used in ecommerce can be found in our technical documentation.

Note: Coding ecommerce tracking requires technical knowledge, so if you’re not a tech-savvy person, team up with an expert in your company and contact our support. Our technical team can help you with the setup.

Track other shopping stages

Besides JavaScript functions dedicated to ecommerce tracking, you can also use custom events, content tracking, and other web analytics methods to collect data about shoppers. Here’s a list of possible tracking options in Piwik PRO.

Shopping stage Tracking method
View a product Page view and content tracking
Click product details Custom event
Add to a cart JavaScript function
Remove from a cart JavaScript function
Checkout JavaScript function
Shipping information Custom events and user flow
Order JavaScript function
Promotions Custom events and content tracking
Promo codes Custom events

Display ecommerce reports in Analytics

At the same time, when you’re setting up ecommerce tracking, you need to turn on ecommerce reports in Analytics. Ecommerce is the additional section in Analytics that is not displayed by default and can be turned on or off at any moment. In this section, you’ll see all data tracked for your store.

To turn on ecommerce reports, follow these steps:

  1. Go to Menu > Administration.
  2. Select a website you want to work with.
  3. Navigate to Settings.
  4. In Integrations, toggle Ecommerce reports.
  5. Ecommerce reports in Piwik PRO.
  6. After doing that, you will see an ecommerce section in Analytics. Reports in this section will fill up with data as soon as you set up tracking for each ecommerce element.

For more, read our article about ecommerce reports.

Was this article helpful?

Be the first to rate this article.

Technical Support

If you have any questions, drop us a line at support_SPC@piwik_SPC.pro.

We’re happy to help!