The Matomo Configuration Variable is a key part of Matomo Tag Manager as it stores essential configuration details for tracking on your website or app such as such as your Matomo site ID and URL instance, consent handling preferences, User ID tracking, and more. This variable streamlines the setup process by acting as a reusable reference point for your Matomo instance.

This variable works with Matomo tags and any custom tags that rely on Matomo’s tracking setup. When you create new tags associated with the Matomo Configuration Variable, the tags inherit the correct tracking settings without needing to manually re-enter details. Updates made to the variable automatically apply to all linked tags.

The default Matomo Configuration Variable makes it easy for users of all skill levels to get started with tracking right away using the default configuration.

Advanced users can leverage the variable’s settings for deeper customisation and enhanced tracking capabilities:

  • Customise tracking parameters
    You can enhance the Matomo Configuration Variable by adding advanced parameters such as custom dimensions, enabling cross-domain tracking, and adjusting cookie behaviour.

  • Work with multiple websites
    If you’re tracking multiple websites, you can create separate Matomo Configuration Variables for each site and link them to the relevant tags, ensuring precise tracking setups across your portfolio.

  • Advanced integration
    The variable supports advanced tracking use cases like enabling heartbeat timers for more accurate time-on-page metrics, JavaScript error tracking and setting up User ID tracking for advanced user segmentation.

  • Versioning flexibility
    If you need to test different configurations, Matomo Tag Manager allows you to create new versions of your container with updated Matomo Configuration Variables. This can be useful when running A/B tests or experimenting with tracking adjustments.

How to add the Matomo Variable

When you install Matomo Tag Manager for the first time, a default container is automatically generated and includes the Matomo tracking tag, Pageview trigger, and Matomo Configuration Variable.

The auto-generated setup ensures you have a working configuration immediately, with the configuration variable linked to the default tracking tag. This provides the foundational setup for capturing default tracking data such as page views and outlinks.

  1. To add a Matomo Configuration Variable, navigate to Tag Manager and click the settings icon next to the container you want to edit.
  2. Go to Variables and click Create New Variable.
  3. Select the Matomo Configuration Variable and modify the default settings as required for your tracking configuration.
  4. Click Create New Variable to save.

You can now use this variable for any Matomo-related tracking tags.

Debug and Test

Use Matomo Tag Manager debug tool to test your Matomo Configuration Variable. In Preview mode, you can verify which tags are firing, confirm the configuration variable is applied correctly, and test changes in real-time without affecting live tracking.