Setting up basic tracking in Matomo Tag Manager (MTM) is quick and easy. This guide walks you through the steps to get started, including using the default container, understanding its components, and adding the MTM code to your website.

Default container configuration

Matomo Tag Manager comes with a default container configured with the essentials for basic tracking. Here’s what the default setup includes:

Matomo Analytics Tag

This tag is a snippet of code that automatically gets inserted into your website code to send tracking data (like page views) from your website to your Matomo instance. It is pre-configured to include your Matomo tracking URL and site ID, so you don’t need to customise it unless you have specific requirements.

Matomo Variable

A default variable, named Matomo Configuration, stores the settings for your Matomo instance, such as the tracking URL and site ID. This variable is used by the Matomo Analytics tag to ensure the data is sent to your Matomo server.

Pageview Trigger

The default pageview trigger is configured to fire the Matomo Analytics tag on every page load. This ensures that pageviews are tracked automatically whenever someone visits your site.

Together, these components provide the basic functionality needed to start tracking visitor activity on your website.

Manually set up a container and components

  1. Navigate to Tag Manager > Manage Containers.
  2. Click Create a New Container, provide a name, and enable the settings as required. Read more about how to synchronise events from the GTM dataLayer.
  3. Go to the Tags and click Create New Tag.
  4. Select Matomo Analytics as the tag type.
  5. In the configuration screen, click on the link Create New Variable.
  6. The default Matomo Configuration Variable displays; save the new variable and you will automatically be directed back to the tag’s set up.
  7. Further down in the settings, you will need to add a trigger. Click on the link, Create a new trigger now.
  8. Choose the Pageview trigger. You can optionally set up conditions on which the trigger fires.
  9. Click Create New Trigger and you will return to the tag configuration.
  10. To accept all the defaults for basic tracking, click Create New Tag to save.

Add the MTM code to your website

To activate tracking, you need to add the Matomo Tag Manager container code to your website.

  1. Navigate to Tag Manager > Manage Containers and click on the mtm container settings iconsettings icon to open the container.
  2. In the left menu, click on Install Code and the MTM code is displayed for you to copy.
    mtm container install code
  3. Add the copied code to the section of your website’s HTML. This ensures the tracking script loads as soon as the page is opened.
  4. If your site uses a Content Management System (CMS) like WordPress, add the code using the theme editor or a plugin designed for managing scripts.
  5. Once the container code is added to your site, publish your container in MTM to make your tracking configuration live.

Verify tracking is working

After adding the MTM code and publishing your container, verify that tracking is working. In your Matomo dashboard, go to the Visits in real-time widget to see if visits to your site are being tracked. By using the default container and adding the MTM code to your website, you can quickly enable basic tracking and start collecting valuable insights into your website’s performance.

From here, you can customise your setup further to track ecommerce, events and more.

Previous FAQ: Choosing your tracking method: Matomo Tag Manager or Matomo JS