# Matomo Tag Manager (https://webmetic.de/docs/en/installation/matomo-tag-manager)

If a Matomo Tag Manager container already runs on your website, you add the tracking code there as a tag of its own. At the end you'll have:

- the tracking code on every page that loads your container
- your website with the status **Active** in Webmetic
- the message **Data received** in the **Quick check**

## Before you start [#before-you-start]

- **Time**: The first data arrives after a few minutes. The first companies appear within minutes to hours, depending on how much traffic your website gets.
- **Account**: You need a Webmetic account with your website listed under [**Menu** > **Websites**](https://app.webmetic.de/?menu=websites).
- **Access**: A Matomo Tag Manager container already runs on every page of your website.
- **Rights**: In Matomo, only admins or users with the **Publish Live Container** capability can publish to Live. You don't need admin rights in Webmetic.
- **Plan**: The tracking code works on every plan and costs no credits. You can watch session recordings during the trial and on the Growth plan or higher.

The [Webmetic plugin for Matomo](https://webmetic.de/docs/en/integrationen/matomo-plugin) is a different thing: it shows the identified companies inside Matomo, but it doesn't add the tracking code.

The labels below come from Matomo 6, and a few of them differ slightly in Matomo 5.

## 1. Copy the tracking code [#1-copy-the-tracking-code]

1. Open [**Menu** > **Tracking code**](https://app.webmetic.de/?menu=tracking_code), where **HTML snippet** is already selected under **Choose a method**.
2. Under **Copy the snippet**, decide whether the **Session recording** option stays ticked.
3. Click **Copy**. The copied code already contains your account ID, so there's nothing to change in it.

![The Tracking Code window with HTML snippet, Session recording, and the Copy button](https://webmetic.de/docs/media/en/light/trackingcode-drawer.webp)

**Session recording** captures mouse movement, clicks, and scrolling, and Webmetic hides anything typed into form fields. If your plan includes session recording, leave the box ticked. Otherwise, untick it.

You copy the text for your privacy policy in the **Tracking Code** window under **Privacy notice**. You'll also find the text in German and English under [Add the privacy notice](https://webmetic.de/docs/en/installation/alle-plattformen#4-add-the-privacy-notice).

The code from the dashboard loads only once, even if it's also in your website's source code by mistake. [Tracking code in the HTML](https://webmetic.de/docs/en/installation/alle-plattformen) shows what the code looks like.

## 2. Create the tag [#2-create-the-tag]

1. In Matomo, open **Tag Manager**.
2. At the top, choose your website's container in the **Choose a container** list.

![Choosing the container in Matomo Tag Manager (German interface)](https://webmetic.de/docs/media/en/light/matomo-container.webp)

3. Open **Tags** and click **Create new tag**. Matomo shows the list of tag types.
4. In the **Custom** category, choose the type **Custom HTML**.

![The tag types in Matomo with Custom HTML (German interface)](https://webmetic.de/docs/media/en/light/matomo-tag-typ.webp)

5. Paste the tracking code into the field for the HTML code.
6. Under **Position**, choose **Head End**, which matches the spot directly before `</head>` that the dashboard names.

The default is **Body End**: the code works there too, but it sends the page view later, because it sits further down the page.

If **Custom HTML** is missing from the list, an admin may have blocked this tag type. Ask your Matomo administrator to unblock it or to create the tag for you.

## 3. Set the trigger [#3-set-the-trigger]

1. In the section **Configure when the tag should do this**, choose the trigger **Pageview**, which Matomo creates by default.
2. Save the tag so that it fires on every page view. Matomo confirms that the tag was created and offers a link to publish a new version.

![The finished tag in Matomo with name, code, position, and the Pageview trigger (German interface)](https://webmetic.de/docs/media/en/light/matomo-tag-formular.webp)

The image shows the short form of the tracking code and the default position **Body End**. Both work. We recommend the code from the dashboard and **Head End**.

![The confirmation after saving with the link to publish (German interface)](https://webmetic.de/docs/media/en/light/matomo-tag-gespeichert.webp)

If the **Pageview** trigger is missing, create it under **Triggers** > **Create new Trigger** > **Pageview**. Matomo has no separate trigger for all pages like Google Tag Manager, and **Pageview** serves the same purpose.

## 4. Publish a version [#4-publish-a-version]

1. In the left menu, click **Publish**.
2. Enter a name for the version, for example `Webmetic`.
3. Choose **Live** as the environment so that the version reaches your website.
4. Click **Create new version and publish release**, and from now on every page with your container loads the tracking code.

![Create a new version with version name, environment Live, and the publish button (German interface)](https://webmetic.de/docs/media/en/light/matomo-version-veroeffentlichen.webp)

<Accordions>
<Accordion title="Test the tag in the preview first">

Before you publish, you can check the container in the preview:

1. In Matomo, click **Preview / Debug**.
2. Enter the address of the page you want to test.
3. Click **Debug** to start the preview.

</Accordion>
</Accordions>

## Check your installation [#check-your-installation]

1. Open your website in a new browser window and visit a few pages.
2. In Webmetic, open [**Menu** > **Tracking code**](https://app.webmetic.de/?menu=tracking_code) and click **Quick check** under **Verify installation**. Webmetic shows the message **Data received**.

![The quick check with the result Data received](https://webmetic.de/docs/media/en/light/trackingcode-schnellpruefung.webp)

The quick check reports data as soon as any website in your account sends data. If you have several websites, also open [**Menu** > **Websites**](https://app.webmetic.de/?menu=websites) and check that your website shows **Active** there.

### If nothing arrives [#if-nothing-arrives]

If the quick check shows the message **No data yet**, wait a few minutes and click **Check again**. If the message stays, confirm these points:

- The new version is published to the **Live** environment.
- The tag uses the **Pageview** trigger.
- The container runs on the page you visited.
- No cache is still serving the old version of your pages.

<Accordions>
<Accordion title="Consent">

Webmetic sets no cookies of its own and processes the data in pseudonymised form. If present, however, the script reads the identifier of a Google Analytics cookie.

Whether the code may load before consent is a question for your data protection advisor. If it loads only after consent, Webmetic records only the visits after consent.

If the code should load only after consent, you set that up yourself. Your consent tool then blocks the tag until consent, or you fire the tag in Matomo only after consent. Webmetic has no setting of its own for this.

</Accordion>
</Accordions>

## Next steps [#next-steps]

- [Check your installation](https://webmetic.de/docs/en/installation/pruefen): Status, deep check, and common causes when no data arrives.
- [Special cases](https://webmetic.de/docs/en/installation/sonderfaelle): Several domains, caching, consent tools, and staging sites.
- [How Webmetic works](https://webmetic.de/docs/en/wie-webmetic-funktioniert): How a visit to your website becomes a company.
