Matomo Tag Manager
The open-source tag manager bundled with Matomo — triggers, variables, and versioned containers served from your own infrastructure.
INTEGRATES: matomo
ALTERNATIVES: google-tag-manager · adobe-launch · tealium-iq
Matomo Tag Manager uses the same mental model as GTM — tags, triggers, variables, a data layer, preview
mode — but ships as a GPL-licensed component of Matomo itself. Containers are versioned and published to
environments, and on a self-hosted install the container script is served from your own Matomo instance
at https://{your-matomo}/js/container_{ID}.js, so tag delivery never depends on a third-party CDN and
stays inside whatever data-residency boundary your Matomo deployment already satisfies.
The data layer is a plain JavaScript queue called _mtm. The embed snippet initializes it in the page
head, pushes an mtm.Start event with a timestamp, then loads the container asynchronously — structurally
the same pattern as GTM’s dataLayer, just under a different global. If you run multiple containers on
one page, both snippets push into the same _mtm array. Migrating from GTM is therefore mostly a
find-and-replace on the push target plus rebuilding tags and triggers by hand; the concepts map one to
one, but there is no automated container import to lean on.
Two implementation details are worth knowing before you commit. First, an environment’s embed code only exists once a container version has been published to that environment — if the install code is missing from the admin tracking settings, you have not deployed to that environment yet. Second, Matomo documents self-hosting the container file elsewhere (for example, to dodge blockers that filter your Matomo URL), but doing so disables preview/debug mode and means every publish requires manually re-copying the file — treat that as a last resort, not a default.
Extensibility is real but developer-shaped. New tag templates are written as Matomo plugins: a console
generator (./console generate:tagmanager-tag) scaffolds a PHP class holding metadata and parameters
plus a .web.js file whose fire() method contains the actual tag logic. That is more work than
dropping a template from GTM’s community gallery, so in practice deploying an unusual third-party vendor
means either a custom HTML tag you maintain or a small plugin you write once. There is no server-side
container.
Licensing differs by hosting model: Tag Manager is free with no tag limits on self-hosted On-Premise, while on Matomo Cloud it is bundled from the Business plan up (Starter excludes it), with container allowances tied to plan tier. Access controls let you restrict who can publish, so a review-then-deploy workflow is possible without extra tooling.
Use it when you already run Matomo — especially self-hosted for data-sovereignty reasons — and want tag management under the same roof and license. Look past it when you need a deep vendor template ecosystem, server-side tagging, or a tag manager independent of your analytics platform.