Install
Use the AnalyticFast browser SDK from your project
The repository contains a small browser package at packages/analyticfast. Its manifest is currently private; this guide does not claim a public npm release. The plain script is the available installation path when you do not have a reviewed local package build.
Install on npm browser SDK
Start by adding the website in AnalyticFast and selecting its domain, timezone and currency. These examples use https://t.analyticfast.com; the origin and Site ID shown in your site’s Settings take precedence.
- For the source-package workflow, build the browser SDK in your AnalyticFast checkout with
npm --prefix packages/analyticfast run buildafter installing its build dependencies. - In your website project, install that built local package using its actual absolute path, as illustrated below. Do not substitute an unrelated registry package with the same name.
- Initialize once in a browser lifecycle hook. Supply both your Site ID and
host; omitting host defaults to the website’s own origin and is only suitable for an intentional same-origin deployment. - Call goals from actual completion handlers and read optional attribution IDs immediately before checkout. Remove any existing plain-script installation.
npm install /absolute/path/to/AnalyticFast/packages/analyticfastimport { init, track, identify, attribution, consent } from 'analyticfast';
// In your root browser lifecycle hook:
init({ siteId: 'YOUR_SITE_ID', host: 'https://t.analyticfast.com', consent: 'pending' });
// In the corresponding existing handlers, not during initialization:
// consent(true); // Your banner's Accept action.
// consent(false); // Decline or withdrawal.
// track('signup_completed', { plan: 'starter' });
// identify({ user_id: customerProvidedId });
// const ids = attribution(); // Forward present IDs to your checkout server.Place initialization in the browser
- React / Next.js: call init in a root component’s
useEffect; mark an App Router component'use client'. Render it once from the root layout. - Vue: call init in the root component’s
onMountedhook, not at module evaluation during SSR. - SvelteKit: call init in
onMountin the shared layout. Do not put it in a server load function.
The SDK uses the existing tracker queue and does not require manual pageviews for real SPA navigation. identify accepts customer-supplied identity; it should not scrape a page or manufacture personal data. attribution() can return an empty object: omit missing metadata instead of inventing IDs. This is the browser SDK, separate from scoped-token server APIs.
Verify the published website
- Replace
YOUR_SITE_IDwith the ID for this website, then open its public domain in a normal browser. A builder preview, localhost, webdriver or a visit with?ml_ignore=truemay be ignored. - In browser Network tools, check
https://t.analyticfast.com/js/script.jsand the request to/api/event. A downloaded script or a successful HTTP response alone does not prove that an event was accepted. - Use Verify installation in AnalyticFast and check the last received event. If none arrives, check the Site ID, allowed hostname, consent configuration, duplicate installations and any blocker. Domain ownership verification is a separate step.
If your site has a Content Security Policy, allow https://t.analyticfast.com in both script-src and connect-src. Do not put tokens, customer email addresses or private keys in the snippet, URLs or goal properties.
Consent setup
Use the consent integration described above for this method. The consent guide explains pending, granted and declined states; a tag that never loads cannot record visits. Test the actual behavior of your chosen consent manager.
Official platform references
Instructions reviewed against the repository and official platform documentation on October 31, 2026. Screenshots are reserved placeholders; no live platform installation is claimed here.
Add your website to get its Site ID and installation checklist. Once visits arrive, connect your payment provider.
Questions, answered.
Can I run npm install analyticfast from the public registry?
This repository’s browser package is marked private. This guide only documents a built local package; it does not verify a public release or ownership of any registry package. Use the plain script or the local source workflow until a public release is explicitly documented.
Does installing the script also record purchase revenue?
No. It records visits and goals. Connect a supported payment webhook and pass visitor/session IDs into checkout metadata to connect verified payments with traffic. A Buy click or thank-you pageview is not payment confirmation.
Why does the script load but no visit appears?
Check the real Site ID, accepted hostname, published code, consent settings and blockers. Localhost, automation and ignored visits may be excluded. Use the last received event in AnalyticFast as evidence; the script download alone is insufficient.