Trackthemetric Logo

Trackthemetric + Google Tag Manager (GTM)

Use Google Tag Manager to deploy Trackthemetric across your site without changing your codebase.

1
Create a Custom HTML tag

1. Log in to Google Tag Manager and open your container.

2. Go to TagsNew, name it (e.g. , Trackthemetric Analytics), then click Tag Configuration and choose Custom HTML.

3. Paste the following code (Custom HTML):

<script>
  (function() {
    var script = document.createElement('script');
    script.defer = true;
    script.id = 'TrackTheMetric';
    script.setAttribute('data-website-id', 'YOUR_WEBSITE_ID');
    script.setAttribute('data-domain', 'YOUR_DOMAIN.COM');
    script.src = 'https://app.trackthemetric.com/tracker.js';
    document.head.appendChild(script);
  })();
</script>

Replace the YOUR_WEBSITE_ID and YOUR_DOMAIN.COM with your actual values from your Trackthemetric dashboard.

4. Click Triggering, select All Pages, then click Add.

5. Click Save, then Submit Publish.

2
Troubleshooting

  • Use GTM Preview mode and verify the tag is firing on pages.
  • Double check Website ID and domain values are correct.
  • Ensure CSP doesn't block loading from app.trackthemetric.com.
  • Fire the tag on the earliest appropriate event so it runs early during page load.

3
Verify analytics

  • Visit your site with the published GTM changes.
  • Open your Trackthemetric dashboard.
  • You should see data within a few minutes.