On this page
Webflow
Last updated
Install the vTilt snippet on a Webflow site with site-wide Head code in Site settings — plan and role requirements, save, publish, and confirm the first event on the published site.
If your site is built with Webflow, you can install vTilt for the whole site from Site settings. You paste the snippet the dashboard gives you into the site's Head code, save, and publish.
#Before you start
- Your site can use custom code. Webflow allows it if you have a Core, Growth, Agency or Freelancer Workspace, or if the site has an active Site plan.
- You are a Site manager or Designer on the site. Those roles can add custom code. To publish, you need publishing rights on the site as well.
- 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. Add the snippet to Head code
- Open your site's Site settings.
- Open the Custom code tab.
- Paste your snippet into the Head code section.
- Click Save changes.
Code in Head code goes in the head of every page of your site.
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. Publish
Saving is not enough: custom code only goes live when you publish the site.
- Click Publish.
- Check the domain or domains you want to publish to. Choose your live domain so your visitors get the snippet.
- Click Publish to selected domains.
#3. Confirm the first event
- Open your published 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
#You are testing in the Designer
Webflow's preview mode shows your site without custom code by default, so vTilt does not load there. Test on the published site instead.
#The change is not published
Custom code saved in Site settings stays off your site until you publish. Publish again, and make sure the domain you are testing on was checked.
#You published to a different domain
If you published only to the staging subdomain (yoursite.webflow.io), your custom domain still has the old version, and the other way round. Open the domain you published to.
#An ad blocker is in the way
Ad blockers can block analytics scripts. Test in a private window with extensions turned off. For visitors, a reverse proxy keeps vTilt's requests from being blocked.
#The token does not match
Check that the token in the snippet is the one shown for this project in Settings → Project → Installation. See Common mistakes.