Skip to main content

Tag-manager-WIP

Basics

  • Tags - A tag is a snippet of code which can be executed on your site. Tags will be executed as soon as the condition of a connected trigger is met.
  • Triggers - Defines when a tag should be fired or blocked.
  • Variables – Lets you retrieve data which can be used by tags and triggers.

Loading a container from your website

The disadvantage is, that the debug/preview feature won't work out of the box and you always need to update the JavaScript file whenever you publish a new version to an environment.

Triggering an event

Keep in mind that this does not send an event to Matomo, but allows you to create a tag in Matomo Tag Manager that reacts based on this event.

Migration from Google Tag Manager

If you have used Google's Tag Manager in the past and have specified a data layer on page load for example like this: dataLayer = {'orderTotal': 100} you will be happy to hear that we are supporting this as long as you have configured the data layer variable as early as possible within your website. The variable needs to be defined before the container is loaded. Please note we do not support any renamed data layer variable.

Environments

Dev

<!-- Matomo Tag Manager -->
<script type="text/javascript">
var _mtm = (window._mtm = window._mtm || []);
_mtm.push({ "mtm.startTime": new Date().getTime(), event: "mtm.Start" });
var d = document,
g = d.createElement("script"),
s = d.getElementsByTagName("script")[0];
g.type = "text/javascript";
g.async = true;
g.src =
"https://whitespace.analys.co/js/container_CNziL8XS_dev_cfb0b6acda44d01d1e7fb6f8.js";
s.parentNode.insertBefore(g, s);
</script>
<!-- End Matomo Tag Manager -->

Stage

<!-- Matomo Tag Manager -->
<script type="text/javascript">
var _mtm = (window._mtm = window._mtm || []);
_mtm.push({ "mtm.startTime": new Date().getTime(), event: "mtm.Start" });
var d = document,
g = d.createElement("script"),
s = d.getElementsByTagName("script")[0];
g.type = "text/javascript";
g.async = true;
g.src =
"https://whitespace.analys.co/js/container_CNziL8XS_staging_4386f5e639401089224a3290.js";
s.parentNode.insertBefore(g, s);
</script>
<!-- End Matomo Tag Manager -->

Live

<!-- Matomo Tag Manager -->
<script type="text/javascript">
var _mtm = (window._mtm = window._mtm || []);
_mtm.push({ "mtm.startTime": new Date().getTime(), event: "mtm.Start" });
var d = document,
g = d.createElement("script"),
s = d.getElementsByTagName("script")[0];
g.type = "text/javascript";
g.async = true;
g.src = "https://whitespace.analys.co/js/container_CNziL8XS.js";
s.parentNode.insertBefore(g, s);
</script>
<!-- End Matomo Tag Manager -->