Skip to content
VaultLens Studio

Install the live sync snippet

The live sync snippet is a few lines of JavaScript that tell VaultLens when records change. You install it once per app. Only workspace owners and admins can see and install it.

You’ll find the snippet in two places:

  • In the last step of Set up analytics, under Step 1 · Install live sync.
  • In the app’s Live sync tab at any time.

1. Copy the snippet

Under 1. Copy this snippet, click Copy snippet.

The snippet loads a small script from VaultLens and contains a token for this app. The token only routes changes to the app. It isn’t a password, and it can’t read or change your data.

2. Paste it into your Knack app

  1. In the Knack Builder, open your app and go to Settings → API & Code → JavaScript.
  2. Paste the snippet at the end, below any code that’s already there. It doesn’t change your existing code.
  3. In a Next-Gen app, make sure custom JavaScript is switched on.
  4. Save.

The same snippet works in Classic and Next-Gen apps. It detects which kind of app it’s running in.

3. Open your live app to verify

  1. Open any page of your live Knack app, or refresh one that’s already open.
  2. Go back to VaultLens. Within a few seconds, step 3 shows Connected and when VaultLens last heard from your app. It also shows whether the app is Classic or Next-Gen.

In the setup wizard, Start clone unlocks as soon as step 3 shows Connected.

If you see Waiting for your app…, check that:

  • you saved the JavaScript in the Builder;
  • custom JavaScript is switched on (Next-Gen apps);
  • you opened the live app, not the Builder;
  • your app runs on *.knack.com. If it runs on your own domain, add the domain under Custom domains on the Live sync tab.

Keep it working

The snippet checks in each time someone opens the app. If VaultLens doesn’t hear from it for 7 days, the Live sync tile shows Not heard from recently. The snippet may have been removed from your app’s JavaScript, or nobody has used the app since. Changes are still caught by the scheduled sync.

VaultLens also sends a Live sync health notification if the snippet goes quiet after it had been working. See Notifications.

If you get a new snippet token, replace the old snippet in Knack. The old one stops working within 30 seconds. See Live sync.