Set up ecommerce tracking

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.
    _paq.push(['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.

    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.
    _paq.push(['trackEcommerceOrder',orderId, orderGrandTotal, orderSubTotal, orderTax, orderShipping, orderDiscount]);

For developers: For more information on ecommerce tracking, read our developer guides.

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 the site you want to work with.
  3. Navigate to Reports.
  4. Turn on  Show ecommerce reports.
  5. Done! Now you can 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.
    Ecommerce reports in Piwik PRO

For more, read our article about ecommerce reports.

Was this article helpful?

Technical support

If you still have some questions, visit our community.
There’s always someone ready to help!

Related articles

Back to help center