Last active
February 15, 2024 11:05
-
-
Save Webmasterei/8304d2fd095fa054119df26abbb1cff8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/* | |
Put this in a Matomo Tag Manager Container in order to copy each fresh event from the dataLayer to Matomo. | |
*/ | |
window.dataLayer = window.dataLayer || []; | |
window._mtm = window._mtm || []; | |
var originalPush = dataLayer.push; | |
dataLayer.push = function() { | |
var args = Array.prototype.slice.call(arguments); | |
originalPush.apply(dataLayer, args); | |
var latestChange = args[args.length - 1]; | |
window._mtm.push(latestChange); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment