GTM Integration
After launching an instance in AWS with RDS and verifying everything is configured properly, I tried to add the umami tracker to a website using Google Tag Manager (GTM) to handle pixels and trackers.
It does not work smoothly!
After a few minutes of research I discovered that GTM strips custom data attributes from <script> tags, so the tag got loaded without the website id, making it useless.
A possible workaround for anybody facing this issue, is to put in GTM this, instead of the script generated by default :
<script>
(function() {
var el = document.createElement('script');
el.setAttribute('src', '<umami-url>');
el.setAttribute('data-website-id', '<website-id>');
document.body.appendChild(el);
})();
</script>
Could this maybe be added to the documentation for future use? (I'm pretty sure I got lucky with discovering a fix)
Thanks for the tip. You free to write content for the website here, https://github.com/mikecao/umami.is