On this page
Wix
Last updated
Install the vTilt snippet on a Wix or Wix Studio site with Custom Code in the site dashboard — all pages, in the head, loaded once. Covers the plan and domain requirement, the cookie banner, and confirming the first event.
If your site is built with Wix or Wix Studio, you can install vTilt from the site dashboard without editing any page. You paste the snippet the dashboard gives you into Custom Code and tell Wix to load it on every page.
#Before you start
- Your site is published and has a connected domain. Wix only runs custom code on sites like that. Connecting your own domain needs a Wix plan, so a free site has to upgrade first.
- You can open the site's dashboard and its Settings.
- 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.
The same Custom Code page is used by Wix Editor and Wix Studio sites.
#1. Add the code
- In your site's dashboard, go to Settings.
- Under Development & integrations, click Custom Code.
- Click + Add Custom Code at the top right.
- Paste your snippet into the text box.
- Enter a name for it, for example
vTilt.
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 where it loads
In the same window:
- Under Add Code to Pages, choose All pages. This also covers pages you add later.
- Choose to load the code once per visit, not on each page your visitor opens. vTilt records every page your visitor moves to by itself, so it only needs to load once.
- Under Place Code in, choose Head.
- Open the Code Type tab and choose the analytics category. Wix asks you to label analytics code this way rather than as essential. See the cookie banner below for what that means.
- Click Apply.
There is nothing else to publish. Custom code takes effect on your live site; it does not run in the Wix editor or its preview.
#3. Confirm the first event
- Open your live site (on your connected domain) 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 looking at the editor or preview
Custom code only runs on the published site. Open the site on its live address, not from the editor.
#Your cookie banner holds the code back
Code labelled as analytics does not load until a visitor accepts cookies, when your Wix cookie banner is on. Accept the banner on your site, then load a page again.
#The domain changed
Wix ties custom code to the site's domain. If you assigned a different domain to the site, the code is removed. Open Custom Code again and check that vTilt is still listed.
#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.