What is a Tag Manager?

Matomo Tag Manager lets you manage all your tracking and marketing tags in one easy to use place. Tags are also known as snippets or pixels. Such tags are typically JavaScript code or HTML and let you integrate various features into your site in just a few clicks, for example: Analytics, Conversion Tracking, Exit popups and surveys, Remarketing, Social widgets, Affiliates, Ads, and more.

It makes your life easier when you want to modify any of these snippets on your website as you will no longer need a developer to make the needed changes for you. Instead of waiting for someone to make these changes and to deploy your website, you can now easily make the needed changes yourself.

How can I get the Matomo Tag Manager?

If you don’t have a running Matomo, first install Matomo. Then you can activate the Tag Manager either through the top menu “Tag Manager” or by going to “Administration => Plugins”.

The Tag Manager is also available on the Matomo Cloud.

How do I can configure the available environments?

Environments let you deploy different versions of a container to different environments. For example you may first want to deploy a specific version to your development environment, then to the test or staging environment before you publish a container on the “live” environment.

How do I block custom templates that let Matomo admins run JavaScript on the website like “Custom HTML” or “Custom JS Function”?

Disabling “Custom Templates” can improve the security on your website. When you configure a trigger, tag, or a variable, some of them may allow a Matomo user to enter HTML or JavaScript which will be executed on your website. Entering custom code cannot only break the container in case there is an error, but also allows them to execute any JavaScript code on your website. This can be misused to steal for example sensitive information on your website. If you do not want to allow your team members to enter any JS code, you can disable these templates by going to “Administration => General Settings”. There you can disable them in one click under the “Tag Manager” category.

How do I block certain tags, triggers, or variables?

If you self host Matomo, you can block the usage of any tag, trigger, or variable through your “config/config.ini.php” file like this:

[TagManager]
disable_tags[] = “CustomImage”
disable_triggers[] = “DataLayer”
disable_variables[] = “DomElement”
disable_variables[] = “Cookie”

How do I use variables within the Custom HTML tag?

When you define the content of a Custom HTML, you can access the content of any variable within the container through curly brackets. You can assign the variables to a JavaScript variable, to a CSS style, and use it within HTML:

<script>
    // correct
    var myVariable = {{PageUrl}};
    var screenWidth = {{ScreenWidth}};
    var pageWidth = myVariable + screenWidth;

    // not correct (do not put quotes around it)
    var myVariable = '{{PageUrl}}';
    // not correct (do not put two variables next to each other)
    var pageWidth = {{PageUrl}}{{ScreenWidth}};
</script>

<style>
    // correct (can only be used as a value)
    body {
        width: {{ScreenWidth}};
    }

    // not correct
    body {
        {{myVar}}: 15px;
    }
</style>

<div>{{PageUrl}} <a href="{{PageUrl}}">Click Me</a></div>

Not sure about the name of a variable? Simply click on the icon next to the text field and a variable selector will open and automatically insert the needed placeholder for the variable.

What is the CSS style value “mTmKpwoqM”?

If you assign a variable as part of a CSS style, the resulted value may be “mTmKpwoqM” if the variable has not returned any value. For example you may notice a body{ color: mTmKpwoqM; }. This value was chosen to keep your CSS syntax “valid” and so you can find this FAQ article.

Who can create custom templates like “Custom HTML” or “Custom JS Function”?

During the beta of the tag manager, all admins and super users can create tags, triggers, and variables that execute custom JavaScript on your website. As this could break some features of your website or be misused to steal sensitive information, you may want to disable these features. When the Tag Manager is out of beta, there will be new permissions available so you can grant only certain Matomo users access to these templates. For example only to developers.