GET STARTED
Lovable
Ask Lovable's AI to add the Attrifast snippet to every page of your app — copy-paste prompt included — and see your first pageview after you publish.
On Lovable you don't edit files by hand — you tell the AI what to build. Installing Attrifast is one prompt: have it put the script tag in the <head> so it loads on every page, publish, done.
Event collection requires an active subscription or trial — start the 7-day free trial during onboarding (no charge today, cancel anytime). On the free plan, the verify step below won't light up because events aren't collected.
Step 1 — Get your snippet
Add your site in Attrifast (onboarding step 1, or the dashboard), then open onboarding step 2 "Install script", or Dashboard → Settings → Install script. Copy your snippet — it looks like this, with your own tracking ID:
<script defer data-tracking-id="YOUR_TRACKING_ID" src="https://api.attrifast.com/af.js"></script>
Step 2 — Prompt Lovable
Paste this prompt into Lovable, replacing the tracking ID with yours:
Add Attrifast analytics to this app. Insert exactly this script tag into the
<head> of index.html so it loads on every page and every route:
<script defer data-tracking-id="YOUR_TRACKING_ID" src="https://api.attrifast.com/af.js"></script>
Rules:
- Put it in index.html's <head>, NOT inside a React component.
- Keep the defer attribute and the data-tracking-id attribute exactly as given.
- Add it once — do not duplicate it per page or per route.
- Do not wrap it in any consent or lazy-loading logic.
Then confirm where you placed it.
The rules matter: the most common failures are the script landing inside a single React component (so only one route tracks), the AI "helpfully" rewriting the attributes, or the tag being added twice. Route changes inside the SPA are tracked automatically once the script is in index.html — see Install the tracker.
Step 3 — Publish and verify
Click Publish in Lovable (top right) — the script only exists on the live site after publishing. Then open your published app: the Verify installation status in Attrifast onboarding flips to "First pageview received — tracking is live.", usually within a minute.
The domain registered in Attrifast must match the domain your app is served from — for a Lovable subdomain register it as-is (e.g. yourapp.lovable.app); if you later attach a custom domain, add it under Dashboard → Settings → General → Allowed hostnames.
If nothing shows up
Ask Lovable: "Show me where the Attrifast script tag is. Is it in index.html's head, and does it appear on every route?" Then check DevTools on the live site — you should see af.js load and a request to /api/collect. Nine times out of ten the tag is missing from index.html or the tracking ID got altered.