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 Custom HTML tag
- In Google Tag Manager, open your container and go to Tags, then New.
- Choose Tag Configuration, then Custom HTML, and paste the snippet.
- Choose Triggering, then All Pages (Page View).
- Save the tag, then click Submit and Publish. A saved tag that is not published does not run on your site.
<!--
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.
Check that the data is arriving
- Open your site in a browser and load any page.
- 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 nothing arrives, open your browser devtools on the Network tab and reload. You should see a request to /api/tracker.js that returns 200, then a request to /api/v1/c when you move or scroll.
Keeping Google Analytics while you compare
Most containers that get this tag already have a Google Analytics tag in them, and the two do not interfere: put ours on the same All Pages trigger and leave yours where it is. Nothing is shared between them, we set no cookie and read none, and neither knows the other is there. Expect the numbers to differ rather than match: we count a visit without a cookie, so ad blockers and consent walls that hide traffic from GA still reach us, and bounce rate is measured differently in each product. Running both for a week is the cheapest way to see the gap on your own site before deciding. If you also want your GA history in VeritaMetrics, that is a separate one-off import under Settings then Integrations, not something GTM does.
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.