Disable heatmap when using Tag Manager

Hello,
I am a beginner with Matomo.
On our site, we use the Tag Manager script to manage activity tracking:

<!-- Matomo Tag Manager -->
<script>
  var _mtm = window._mtm = window._mtm || [];
  _mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
  (function() {
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src='https://cdn.matomo.cloud/.../container_....js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Matomo Tag Manager -->

We’ve been asked to disable heatmaps (for CNIL Compliance) using this instruction:

_paq.push(['HeatmapSessionRecording::disable']);

But it would appear that this instruction is specific to Matomo’s JS tracker, and not the Matomo Tag Manager.

If this is the case, how do you disable heatmaps from the Tag Manager? Does this require a developer action?

Hi @Bilaal_Y
You can totally disable the heatmap / session recording from Matomo UI if you want.

If you want to disable it only in some cases through MTM, you should trigger a first JavaScript tag containing the _paq.push(['HeatmapSessionRecording::disable']); script…

Hello @heurteph-ei

Thank you for your reply ! It solved my issue perfectly.

1 Like