On this page
Common mistakes
Last updated
Integration pitfalls to avoid — identify on login only, premature resetUser(), wrong install path, init timing, ad-blockers, and event naming.
The mistakes below account for most broken vTilt integrations. AI agents should read this page before shipping — it is the single canonical pitfalls URL.
#Calling identify() only at login time
Fix: Call vt.identify(currentUser.id, { … }) on every page load when the user is already logged in — wherever your app resolves auth (after vt.init() or when your session hook finishes loading), not only in the login-success handler. The call is idempotent. See Identify users.
#Calling resetUser() on anonymous page loads
Fix: Wait for loading === false. Reset only when getUserState() === 'identified' and the app user is null (real sign-out). See Logout & reset.
#Loading the SDK twice (inline stub and npm)
Fix: Pick one install path — see Install. Both are fully supported; the inline script is the recommended default, and the npm package is a great fit for bundled apps. Just don't combine them.
#Initializing too late
Fix: Run init() in <head> (script stub), beforeInteractive (Next.js), or your app entry before paint. See Initialize the SDK.
#Wrong or missing project token
Fix: Copy the token from Settings → Project in the dashboard. Check Verify events.
#Ad-blocker blocking ingest
Fix: Route traffic through your own domain with a reverse proxy. The SDK logs a warning pointing at that guide when transport fails repeatedly.
#Event naming that breaks dashboards
Fix: Use snake_case verbs (button_clicked, purchase_completed). See Track events.
#Mixing identify() ids in one session
Fix: Use your stable internal user id (UUID, integer). Use alias() to link two known ids. Call resetUser() between distinct users on a shared device.
#Using email as the distinct id
Fix: Use your internal user id. Attach email as a property: vt.identify(user.id, { email: user.email }).
#Skipping verification
Fix: Open Verify events, reload your site, and confirm a live $pageview within ~2 seconds.