If you are tracking Ecommerce events in Google Tag Manager (GTM), you can send the event data to Matomo to analyse visitor interactions with your online store. This enables tracking and reporting on Ecommerce events such as product views, cart updates, and purchases without duplicating your setup across both tag managers.

This guide explains how to track GTM Ecommerce Events in Matomo. This does not require additional setup within Matomo Tag Manager. All you need is an active Matomo instance with the MTM container code added to your website.

Important: Always consider user consent requirements before tracking.

Set up Ecommerce tracking in Google Tag Manager

This configuration assumes that Ecommerce tracking is already set up in Google Tag Manager (GTM).

To configure GTM to send Ecommerce events to Matomo, you can use a community-developed tag to track defined events such as adding items to the cart or completing a purchase. GTM sends Ecommerce data to Matomo based on the settings defined within the tag.

Add the Matomo Analytics Configuration Tag

  1. In your Google Tag Manager workspace, go to Tags.

  2. If you are using Matomo Cloud, you can add the Matomo Tracking Tag for Matomo Cloud (developed by matomo-org) found in the community gallery.
    Alternatively, you can use the Matomo Analytics – Configuration Tag (developed by data-marketing-school) for Matomo Cloud or Matomo On-Premise found in the community gallery.

  3. Select the setup type. For Client-Side, enter the Matomo Instance URL and Matomo Site ID.

  4. You can optionally customise additional tracking settings based on your setup.

  5. In the Ecommerce settings, enable the Delay Page View option if your website loads eCommerce data asynchronously. If product views are not being tracked, this option is not required.
    GTM configure matomo config tag

  6. Add the relevant trigger that will execute the tag, e.g., a Page View or Initialisation Trigger.

  7. Save the new trigger and tag.

Add the Matomo Analytics Ecommerce Tracking Tag

  1. In your Google Tag Manager workspace, go to Tags.

  2. Add the Matomo Analytics Ecommerce Tracking Tag (developed by data-marketing-school) found in the community gallery.

  3. Choose the type of Ecommerce Event Type you want to track and and complete the relevant fields for the selected type. If tracking multiple Ecommerce event types, create separate tags for each.
    Category View: Assign a variable to the Category Name field.
    Product View: Provide values for Product ID, Category, Name, and Price using appropriate variables.
    Cart Update: The items array defaults to ecommerce.items. If your setup differs, override the values as needed.
    Order: Assign variables for the relevant order details. For example, set Order ID using {{transaction_id}}.

  4. Go to Advanced Settings > Tag Sequencing.

  5. Enable Fire a tag before this tag fires and select the Matomo tag previously set up, e.g., the Matomo Tracking Tag for Matomo Cloud or Matomo Analytics – Configuration Tag.

  6. Add a Custom Event Trigger to fire the Ecommerce tracking tag.

  7. Set the Event Name (e.g., add_to_cart, purchase), depending on the selected event type.

  8. Configure the trigger to fire on Some Custom Events and define the condition (e.g., Event equals purchase).
    GTM ecommerce tag for matomo

  9. Save the new trigger and tag.

  10. After successfully testing the configuration, deploy your GTM container changes to production.

Test and validate the configuration

The following testing steps can help to ensure the Matomo Ecommerce tracking in Google Tag Manager (GTM) is working correctly.

  1. In your Google Tag Manager workspace, click Preview.
  2. Enter your website’s URL and click Connect.
  3. Once the GTM Debug panel opens, navigate through your site and perform the Ecommerce action you are tracking with Matomo Ecommerce tag (e.g., view a product, add an item to the cart, or make a purchase).
  4. In the GTM Debug panel, look for the expected event and click on it to view the Tags Fired section.
  5. Check the Matomo Configuration and Matomo Ecommerce tags fired correctly.
  6. If the tag does not fire, check the trigger settings and event conditions in GTM.
  7. Log in to Matomo and go to Visitors > Real-time Log to view the events sent from GTM.
    matomo visits log ecommerce events
  8. After testing, allow some time for data to appear in Matomo’s Ecommerce report.

Troubleshooting

If your Ecommerce events are not appearing in Google Tag Manager (GTM) Preview mode or Matomo reports, use the troubleshooting steps to diagnose and fix common issues.

Ecommerce events do not appear in GTM Preview mode

If the Matomo Ecommerce tag is not firing, the issue may be with event triggers or configuration.

  • Ensure that your GTM Custom Event Trigger is defined with the correct event names (e.g., add_to_cart, purchase).
  • Check the trigger is firing on Some Custom Events and that the condition is valid.
  • Test on an incognito window as browser extensions or caching may interfere with the GTM Preview mode.

Ecommerce events do not appear in Matomo reports

If Ecommerce events are firing in GTM but not appearing in Matomo, data may not be reaching your Matomo instance.

  • Verify the Matomo configuration contains the right settings for your instance (in the Matomo Tracking Tag for Matomo Cloud or the Matomo Analytics – Configuration Tag). This tag should fire before the Ecommerce Tag.
  • Matomo tracking can be blocked by ad blockers, privacy extensions, or browser settings. Disable them while testing.
  • If you are using a consent manager, ensure consent is granted before tracking fires.

Next steps

For further troubleshooting and optimisation, explore the Matomo forums and additional resources:

By following these resources and testing best practices, you can ensure that your Matomo Ecommerce tracking is accurately capturing Ecommerce interactions and transactions.

Disclaimer: The use of any third-party tools (plugins, extensions, platforms, APIs, widgets, etc.) is at your own risk. Matomo does not own, control, maintain or support any third-party tools that integrate with our product. We recommend checking your privacy setup is correctly configured across your environment when using any third-party tools.

Previous FAQ: How to track Google Tag Manager Events in Matomo