Website builders · 2 min setup

How to add analytics to a Framer site

To add VisitTrack to Framer, open Site Settings → General → Custom Code, paste the script tag into End of <head> tag, and publish. Framer switches pages without a full reload, and VisitTrack counts each of those page changes automatically.

Updated

Custom code needs a paid Framer site plan (Mini or above) and only runs on the published site — not in the canvas or Preview. Because Framer sites behave like a single-page app, many analytics tools need an extra "SPA mode" setting there; VisitTrack's script listens to the browser's History API out of the box, so the plain tag is all you need.

Framer at a glance

Where the tag goes
Site Settings → General → Custom Code → End of <head> tag
Plan needed
A paid site plan (Mini or above)
Page changes
Tracked automatically (client-side navigation)
Goes live
After you Publish
Button tracking
A code override, or page goals for thank-you pages

How to install VisitTrack on Framer

  1. Step 1: Copy your site id

    Add your Framer domain as a site in VisitTrack and copy the snippet from the install step (or Settings → General). Replace SITE_ID below.

  2. Step 2: Open Site Settings → General → Custom Code

    In your Framer project, open Site Settings, stay on General, and scroll to Custom Code. You'll see four boxes: start and end of <head>, start and end of <body>.

  3. Step 3: Paste the tag into End of <head> tag

    Paste the snippet into End of <head> tag. Don't also add it per page in Page Settings — two copies would count every page twice.

    End of <head> tag
    <script defer data-site="SITE_ID" src="https://visitrack.app/tracker.js"></script>
  4. Step 4: Publish

    Click Publish (top right). Custom code isn't active in Preview, so check the result on the published URL.

How to check VisitTrack is working on Framer

  1. Open the published site and click through two or three pages using your nav.
  2. VisitTrack's live view shows you within seconds, and the Pages tab lists each page path — including CMS detail pages.
  3. In DevTools → Network, each page change sends a POST to visitrack.app/api/collect without a full page reload.

Framer changes pages client-side, updating the URL with the History API. The tracker wraps history.pushState and replaceState and listens for popstate, so every page change — and the back button — is one pageview with the right path. You don't need Framer's framer:pageview events or a custom listener.

Scrolling to a section with an anchor link (/#pricing) doesn't change the path, so it isn't a new pageview. Use a scroll event (below) if you want to know who reached a section.

How to track custom events and goals in Framer

Automatic events need no setup: outbound link clicks feed the Outbound tab, and mailto:/tel: clicks, file downloads and form submits are recorded as events. If your form redirects to a thank-you page on success, create a page goal for that path in VisitTrack's Settings → Goals — the simplest conversion you can track on Framer.

For a specific button, add a code override (Assets → Code → New file → Override) and apply it to the button in the right panel. It calls window.visitrack() on click and keeps the button's own behavior.

Overrides.tsx
import type { ComponentType } from "react";

declare global {
  interface Window { visitrack?: (name: string, props?: Record<string, unknown>) => void }
}

export function withSignupTracking(Component): ComponentType {
  return (props) => (
    <Component
      {...props}
      onClick={(e) => {
        window.visitrack?.("signup_click", { location: "hero" });
        props.onClick?.(e);
      }}
    />
  );
}

Wherever you can paste HTML (an Embed component), data-vt-goal="name" on an element and data-vt-scroll="name" on a section work without any code.

Script options you might need on Framer

All optional — add them to the same tag. Full reference: script configuration.

AttributeWhat it does
data-cookielessStore nothing in the browser; the server derives a daily-rotating id. See cookieless mode.
data-exclude="/app/*"Never track these paths (comma-separated, * wildcard). Checked on every navigation.
data-allow-localTrack on localhost and *.local — for testing an install only.
data-debugLog every event the script sends, and why it skipped one, to the console.
data-auto="false"Turn off automatic events (downloads, contact clicks, form submits, rage clicks, JS errors, 404s).

Framer troubleshooting

The Custom Code boxes are locked

Custom code requires a paid site plan. Upgrade the site, then paste and publish.

Nothing in VisitTrack while previewing

Expected — custom code doesn't run in Preview or the canvas. Test on the published URL.

Every page is counted twice

The tag is in Site Settings and again in a page's own Custom Code, or pasted into both head boxes. Keep a single copy.

Traffic from *.framer.app / *.framer.website mixed in

Save your custom domain under VisitTrack's Settings → General → Allowed hostnames so other hosts are dropped.

Framer analytics FAQ

Where do I add custom code in Framer?

In Site Settings → General → Custom Code. For analytics, use the End of <head> tag box so the script loads on every page. Page Settings has a per-page Custom Code section too, but site-wide is what you want here.

Does VisitTrack track page changes on Framer sites?

Yes. Framer navigates between pages client-side, and VisitTrack's script listens to the History API, so each page change is counted with no extra configuration.

Do I need a paid Framer plan to add analytics?

For custom code, yes — Framer requires a paid site plan (Mini or above). The VisitTrack tag goes into that custom code setting.

How do I track Framer button clicks?

Apply a small code override that calls window.visitrack("name") on click, or send people to a thank-you page and create a page goal for it in VisitTrack.

Is VisitTrack better than Framer's built-in analytics?

They serve different needs. Framer's analytics shows traffic inside the editor; VisitTrack adds revenue attribution, funnels, journeys, session replays, AI-crawler tracking, an API and an MCP server.

Will VisitTrack slow down my Framer site?

It's about 5 KB gzipped and loads with defer, so it doesn't block rendering. Its real-user Web Vitals let you check performance on your actual visitors.

Keep going

Add VisitTrack to your Framer site

Cookie-free analytics with revenue attribution, live visitors, funnels and session replays. One script tag, every feature on every plan. 14 days free, no card required.

Not on Framer? See all 29 integration guides.