On this page
Google Tag Manager
Last updated
Install the vTilt snippet through Google Tag Manager with a Custom HTML tag — no change to your site's HTML. Create the tag, fire it on Initialization - All Pages, preview, publish, and confirm the first event.
If you cannot edit your site's HTML, install vTilt through Google Tag Manager (GTM). You paste the same snippet the dashboard gives you into a Custom HTML tag. Nothing in the snippet needs changing for GTM.
#Before you start
- GTM is already on your site, and you can publish in that container.
- You have your vTilt snippet. Copy it from Get started → Paste the snippet, or from Settings → Project → Installation. Your project token is already filled in there.
#1. Create the tag
- In GTM, open Tags and click New.
- Name the tag
vTilt. - Click Tag Configuration and choose Custom HTML.
- Paste your snippet into the HTML box.
- Leave Support document.write unchecked.
The snippet looks like this:
<script>
!function(t,e){var o,n,p,r;function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}if(!e.__SV&&!(window.vt&&window.vt.__loaded)){window.vt=e,e._i=[],o="init capture identify setUserProperties resetUser getUserIdentity getDeviceId getUserState alias getConfig getSessionId updateConfig setConsent on once off startAutocapture stopAutocapture startSessionRecording stopSessionRecording openChat closeChat toggleChat showChat hideChat sendChatMessage gtag setGoogleUserData".split(" ");for(n=0;n<o.length;n++)g(e,o[n]);e.init=function(i,s,a){(p=t.createElement("script")).type="text/javascript",p.crossOrigin="anonymous",p.async=!0,p.src=s.script_host?s.script_host+"/array.js":s.api_host+"/dist/array.js",p.onerror=function(){console.error("vTilt: Failed to load library script:",p.src)},(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="vt",u.toString=function(t){var e="vt";return"vt"!==a&&(e+="."+a),t||(e+=" (stub)"),e},n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1}}(document,window.vt||[]);
vt.init('YOUR_PROJECT_TOKEN', {
api_host: 'https://www.vtilt.com',
});
</script>#2. Choose the trigger
- Click Triggering.
- Choose Initialization - All Pages.
- Click Save.
Why Initialization and not Page View? Initialization fires before every other trigger except Consent Initialization. vTilt is in place before your other tags run, so the first page view is counted as early as possible, and any tag that calls vt.capture() or vt.identify() finds window.vt ready. Consent defaults set on Consent Initialization are already applied by then.
The All Pages (Page View) trigger also works. It only fires a little later.
#3. Preview
- Click Preview in the top right of GTM.
- Enter your site's address and click Connect. Your site opens in a new tab.
- Go back to the Tag Assistant tab. Click Initialization in the left list.
- Check that
vTiltis listed under Tags Fired.
Preview runs only in your browser. Your visitors do not get the tag yet.
#4. Publish
- Click Submit in the top right of GTM.
- Add a version name, for example
Add vTilt. - Click Publish.
#5. Confirm the first event
- Open your live site in a new tab and load any page.
- Go back to Get started in vTilt. It is waiting for your first event and switches to your dashboard by itself when the event arrives. This normally takes a few seconds.
To watch events arrive one by one, open the Debug View — see Verify events.
#If nothing arrives
#The tag is not published
A tag that works in Preview is not live until you click Submit → Publish. Open Versions in GTM and check that the latest version contains the vTilt tag and is marked Live.
#Consent is blocking the tag
If the container uses consent mode or a cookie banner template, a tag can be held back until the visitor agrees.
- In GTM, open the
vTilttag, then Advanced Settings → Consent Settings. If it requires additional consent, the tag does not fire before the visitor accepts. Accept the banner on your site and test again. - In vTilt, if Require consent is turned on for the project, events are held until your banner reports a choice. See Driving consent from your own CMP.
#It is the wrong container
The tag must be published in the container that is installed on your site. Compare the container ID at the top of GTM (GTM-XXXXXXX) with the one in your page: open your site, view the page source, and search for GTM-. If they differ, you published to another container. If you find no GTM- at all, GTM is not installed on that page.
#An ad blocker is in the way
Ad blockers often block Google Tag Manager itself, and then no tag in the container runs, vTilt included. Test in a private window with extensions turned off.
For visitors, a reverse proxy keeps vTilt's own requests from being blocked. It cannot help when GTM is blocked. If that matters to you, ask whoever maintains the site to paste the snippet straight into the HTML — see Install.
#The token does not match
Check that the token in the tag is the one shown for this project in Settings → Project → Installation. See Common mistakes.