JavaScript apps · ~3 min
Install in a JavaScript app
One import for React, Next.js, Vue, or Vite. Same tracker as the HTML snippet.
Examples use Site ID yourdomain.com — replace with yours from onboarding or Settings.
- 01
Import the SDK
Add this in a file that runs in the browser (for Next.js: a client component in the root layout). Swap in your Site ID from Settings.
import { initRevFast } from "https://revfast.app/sdk.mjs"; const ros = await initRevFast({ siteId: "yourdomain.com", origin: "https://revfast.app", cookieless: false, aiTracking: true, ignoreLocalhost: true, }); - 02
Call it once when the app starts
After that, pageviews and in-app navigations are counted automatically. You do not add extra route hooks.
- 03
Track a signup or purchase (optional)
Call these from a button or thank-you page.
ros.goal("signup"); ros.purchase({ orderId: "ord_123", amount: 49, currency: "USD" }); // Or queue before ready: window.gpAnalytics = window.gpAnalytics || []; window.gpAnalytics.push(["goal", "newsletter"]); - 04
Next.js tip
Put init in a small client component mounted from app/layout.tsx, or use next/script with tracker.js (see Next.js guide).
Install with AI
Paste into Cursor or Copilot — swap in your real Site ID first.
Add RevFast analytics to this JS/TS app (Connect key: yourdomain.com · Origin: https://revfast.app).
1. Create a small client module that initializes:
import { initRevFast } from "https://revfast.app/sdk.mjs";
export async function getRos() {
return initRevFast({
siteId: "yourdomain.com",
origin: "https://revfast.app",
cookieless: false,
aiTracking: true,
});
}
2. Call getRos() once from the root client layout / App entry.
3. Keep SPA navigations automatic (do not add manual pageview hooks unless asked).
4. Show me how to call ros.goal("signup") from a button.Related
Stuck? Email hello@revfast.app or open onboarding → Need help?