Configuration
Use Google Tag Manager
The Umami tracker can be installed using Google Tag Manager.
Normally, you would install the Umami tracker by using the following code:
<script
defer
src="http://mywebsite.com/script.js"
data-website-id="94db1cb1-74f4-4a40-ad6c-962362670409"
></script>However, Google Tag Manager strips custom data-* attributes from script tags. To work around this, create the script element dynamically using a Custom HTML tag in GTM:
<script>
(function () {
var el = document.createElement('script');
el.setAttribute('src', 'http://mywebsite.com/script.js');
el.setAttribute('data-website-id', '94db1cb1-74f4-4a40-ad6c-962362670409');
document.body.appendChild(el);
})();
</script>GTM setup steps
- In Google Tag Manager, go to Tags and click New.
- Choose Custom HTML as the tag type.
- Paste the code above, replacing the
srcanddata-website-idvalues with your own. You can find these values in your Umami website settings under Tracking code. - Set the trigger to All Pages.
- Save and publish your changes.