Skip to content
Skip to main content
← All platform guides

Install on Google Tag Manager

A Custom HTML tag on the All Pages trigger installs analytics without touching your site code, and leaves your other GTM tags alone.

Before you paste anything

Every snippet below shows YOUR-SITE-ID . Replace it with your own site id, which is on the Tracking Code page of the site in your account. If you do not have an account yet, creating one and adding your domain takes about a minute.

Create a free account

Create a Custom HTML tag

  1. In Google Tag Manager, open your container and go to Tags, then New.
  2. Choose Tag Configuration, then Custom HTML, and paste the snippet.
  3. Choose Triggering, then All Pages (Page View).
  4. Save the tag, then click Submit and Publish. A saved tag that is not published does not run on your site.
GTM: Custom HTML tag
<!--
  VeritaMetrics: Google Tag Manager Custom HTML Tag

  Install: Create a new "Custom HTML" tag in GTM, paste this code,
  and set the trigger to "All Pages" (or your preferred trigger).

  After installing this base tag, you can track custom events and
  revenue from other GTM tags using:

    window.verita('trackEvent', 'event_name', { key: 'value' });

    window.verita('trackRevenue', {
      orderId: 'ORDER-123',
      amount: 49.99,
      currency: 'USD',
      products: ['product-a', 'product-b']
    });
-->
<script>
  (function () {
    if (typeof window === 'undefined' || typeof document === 'undefined') return;

    var siteId = 'YOUR-SITE-ID';
    var trackingDomain = 'www.veritametrics.com';

    // 1. Initialize the async command queue
    window.verita =
      window.verita ||
      function () {
        (window.verita.q = window.verita.q || []).push(arguments);
      };
    window.verita.l = new Date().getTime();

    // 2. Load the tracker script
    var script = document.createElement('script');
    script.src = 'https://' + trackingDomain + '/api/tracker.js?siteId=' + siteId;
    script.async = true;
    script.defer = true;
    script.dataset.siteId = siteId;
    script.dataset.trackingDomain = trackingDomain;
    document.head.appendChild(script);

    // 3. Send initial pageview
    window.verita('trackPageView');
  })();
</script>

Note: Other GTM tags can send events once this one has run: call window.verita('trackEvent', 'name', { key: 'value' }) from any later tag. We have not verified this install end to end on a live, published container; the steps above follow Google's own documentation for a Custom HTML tag.

Check that the data is arriving

  1. Open your site in a browser and load any page.
  2. In VeritaMetrics, open the site and click Tracking Code in the sidebar. The status turns active and your visit appears in the recent-pageviews list within a few seconds.

If you're comfortable checking yourself: open your browser's developer tools (right-click the page and choose Inspect, or press F12), open the Network tab, and reload. A working install shows a request to /api/tracker.js succeed (status 200), then a second request when you move the mouse or scroll.

Running this alongside Google Analytics

This tag serves two different readers. If you are comparing us before switching, run both for a week: ours counts without a cookie, so a visit blocked by an ad blocker or declined at a consent banner still lands here, and the two totals will not match. If you are staying on GA4 for traffic and want our dashboard, the behavioural reports or the insight feed on their own merits, leave both running for as long as you like: nothing is shared between the two tags, we set no cookie and read none, and neither script knows the other is there. Two things hold in both cases. GA4’s cookie banner is still required; adding our tag does not touch that obligation. A second tag also means a second company receives the same visit, and running both does not shrink that cost. The weight is the part you can check yourself: our script runs to about 6% of the roughly 145KB gtag.js already on the page. A GA history import is separate, and GTM does not run it. Start it under Settings then Integrations.

Saving a tag is not publishing it

GTM keeps your edits in a workspace until you click Submit and then Publish. Until you do, Preview mode shows the tag firing while the live site sends nothing, so the tag looks installed and the dashboard stays empty.

Guides for other platforms

The same install, on a different stack.

Explore the documentation

Jump to another guide.