Add Datasense to Google Tag Manager
How to load Datasense through Google Tag Manager, and why a direct tag is better.
- Create a tag of type Custom HTML and paste the script.
- Trigger it on All Pages and publish the container.
Ad blockers often block Google Tag Manager itself, and Datasense with it. Add the script to your HTML directly when you can, or use the proxy.
html
<script
defer
data-website-id="YOUR_SITE_ID"
src="https://usedatasense.com/js/script.cookies.js"
></script>Replace
YOUR_SITE_IDwith your site ID from the dashboard.
Verify installation
After you deploy:
- Visit your live website.
- Open the Realtime page of your Datasense dashboard. Your visit shows up within a second, and the setup page says "Receiving events".
Datasense ignores localhost so you don't count your own development traffic. Add
data-allow-localhost="true"to the tag to test locally. More options are in the script configuration reference.