vTilt
By roleFoundersKnow what to fix firstMarketersSee what happens after the clickCMOsSee what your budget really buys
By businessSaaSTurn signups into active usersEcommerceSee why shoppers abandon cartsAgenciesProve your work to clientsEnterpriseOne customer record for every team
MeasureWeb AnalyticsFind where buyers leaveSession ReplaySee why they left, not just that they didAdsKnow what paid visitors do nextIntegrationsOne snippet feeds your stack
ThinkPeopleOne profile per customerCustomer MemoryvTilt remembers every visitorSite KnowledgeAnswers and audits from your own pages
ActAsk AIAnswers from real behaviorAI ChatChat that knows the visitorEmail CampaignsEmail from real visits
PricingWhy vTiltDocs
Docs / Docusaurus
Getting Started
OverviewInstallInitializeIdentify usersTrack eventsLogout & resetVerify eventsCommon mistakes
Guides
Event forwardingReverse proxyRealtime dashboardSite knowledge
Frontend frameworks
Next.jsNuxt.jsVue.jsReactReact RouterRemixGatsbySvelte / SvelteKitAstroAngularTanStack StartDocusaurus
Backend frameworks
NestJSHonoCloudflare WorkersDjangoFlaskLaravelPhoenixRuby on Rails
Backend languages
PythonPHPRubyElixirGoJava.NET / C#Rust
Stack guides
Vue + PHP
API Reference
Browser SDK
Script bundlesAutocaptureWeb VitalsSession recordingChat widgetFeature readinessRemote configurationDebug logging
Node SDK
Install & setupCapture, identify & aliasContext & shutdownGlobal properties & opt-outError tracking
MCP server
Guides
OverviewAuthenticationOAuthAgent skills (prompts)AI intelligenceSite knowledgeGoogle AdsMeta Ads
Client setup
CursorClaude DesktopVS CodeCodex

Getting Started

OverviewInstallInitializeIdentify usersTrack eventsLogout & resetVerify eventsCommon mistakes

Guides

Event forwardingReverse proxyRealtime dashboardSite knowledge
Next.jsNuxt.jsVue.jsReactReact RouterRemixGatsbySvelte / SvelteKitAstroAngularTanStack StartDocusaurus

API Reference

MCP server

On this page

On this page

  • 1. Add your environment variables
  • 2. Install & initialise
  • 3. Identify visitors (optional)
  • 4. Capture custom events
  • Next steps
DocsGuidesFrontend frameworksDocusaurus

Docusaurus

Last updated July 22, 2026

Integrate vTilt with Docusaurus — npm client module or inline script, automatic SPA navigation pageviews, optional identify.

Docusaurus is a static documentation site generator. vTilt drops in via a client module (npm) or an injected script tag (inline).

#1. Add your environment variables

# .env
VTILT_TOKEN=YOUR_PROJECT_TOKEN
VTILT_HOST=https://www.vtilt.com
text

#2. Install & initialise

Choose how you load the Browser SDK. npm boots the SDK from a client module; the inline script injects a stub via injectHtmlTags with no package to install. Both expose the same window.vt global — the rest of this guide is identical either way.

Install the package:

npm install @v-tilt/browser
bash

Expose the config and register a client module:

// docusaurus.config.js
module.exports = {
  customFields: {
    vtiltToken: process.env.VTILT_TOKEN,
    vtiltHost: process.env.VTILT_HOST,
  },
  clientModules: [require.resolve('./src/vtilt.ts')],
}
javascript
// src/vtilt.ts
import { vt } from '@v-tilt/browser'
import siteConfig from '@generated/docusaurus.config'

if (typeof window !== 'undefined') {
  const { vtiltToken, vtiltHost } = siteConfig.customFields as Record<
    string,
    string
  >

  vt.init(vtiltToken, {
    api_host: vtiltHost,
    autocapture: true,
    capture_pageview: true,
    capture_pageleave: true,
  })
}
typescript

Note

Docusaurus uses the History API for client-side navigation between docs pages. The SDK auto-patches pushState / replaceState, so SPA pageviews fire automatically when capture_pageview: true.

Tip

Need chat on first paint? Swap array.js for array.chat.js and add chat: { enabled: true }. See Script bundles.

#3. Identify visitors (optional)

Most docs sites stay anonymous, but if your site has authentication (e.g. customer-only docs gated through a login proxy), identify users on every page load by reading whatever cookie or local-storage value your auth integration sets.

// src/vtilt.ts (continued)
import { vt } from '@v-tilt/browser'

function readUser() {
  try {
    return JSON.parse(localStorage.getItem('docs_user') || 'null')
  } catch {
    return null
  }
}

export function onRouteDidUpdate() {
  const user = readUser()
  if (user) vt.identify(user.id, { email: user.email })
}
typescript

onRouteDidUpdate is the Docusaurus client lifecycle hook that runs after every route change. Using the inline script? Replace vt with window.vt and drop the import.

#4. Capture custom events

// src/components/CtaButton.tsx
import { vt } from '@v-tilt/browser'

export default function CtaButton() {
  return (
    <button
      onClick={() => vt.capture('docs_cta_clicked', { location: 'sidebar' })}
    >
      Try the API
    </button>
  )
}
tsx

#Next steps

  • Autocapture — what's captured automatically.
  • Identify & alias — full identification model.
  • Reverse proxy — block-resistant ingestion.
  • Common mistakes — integration pitfalls to avoid before you ship.
PreviousTanStack StartIntegration guidesNextNestJSIntegration guides