Hello,
we have integrated Matomo Tag Manager on a website. We use the cloud variant.
Also, the cookie tool OneTrust is implemented on the website.
Since OneTrust pushes the events to the “dataLayer”, we have manually adjusted the Matomo Tag Manager script and replaced “_mtm” with “dataLayer”.
Instead of:
<!-- Matomo Tag Manager -->
<script>
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.async=true; g.src='https://cdn.matomo.cloud/XXXXXX.cloud/container_XXXXXX.js'; s.parentNode.insertBefore(g,s);
</script>
<!-- End Matomo Tag Manager -->
we implemented the following in the website code:
<!-- Matomo Tag Manager -->
<script>
var dataLayer = window.dataLayer || [];
dataLayer.push({'mtm.startTime': (new Date().getTime()), 'event': 'dataLayer.Start'});
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src='https://cdn.matomo.cloud/XXXXXX.cloud/container_XXXXXX.js'; s.parentNode.insertBefore(g,s);
</script>
<!-- End Matomo Tag Manager -->
The page load and automatic events with build-in triggers work and are pushed by Matomo Tag Manager, so the data can be seen in real-time in Analytics. But custom events do not work.
For example, we have integrated the following dataLayer push, which should trigger when a contact tab is clicked:
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({'event': 'contactTab'
});
</script>
The event is also pushed to the DataLayer. The corresponding tag with the correct trigger is also created in the Matomo Tag Manager, however the Tag Manager does not respond.
What could be the reason for this? Thanks for help.