measuremy.site

Add measuremy.site to your site

One script tag, under 1 KB, no cookies. About two minutes on most platforms.

The fastest way: ask your coding agent

Paste this into Claude Code, Cursor or Codex
Add measuremy.site analytics to this project: connect the measuremy.site MCP server at https://a.measuremy.site/mcp for all my projects (claude mcp add --scope user; it signs in with OAuth, no key, and one sign-in covers every site), then tell me how to sign in. Details: measuremy.site/llms.txt

Your agent connects the measuremy.site MCP server. Restart it when asked (in Claude Code: claude -c), sign in on the page that opens in your browser and enter your domain (no key or email goes through the agent), and it adds the snippet to your project's layout and tracks your signups. The steps below do the same by hand. Details for agents: /llms.txt.

Or run one command

From your project's folder, in any terminal (in Claude Code, type ! first):

npx measuremysite init

It opens a sign-in page in your browser, connects Claude Code, Cursor or Codex to your analytics (--agent claude, cursor or codex; detected when run inside one) with the key kept in local config, and prints the script tag and the file it goes in. If you haven't signed in within 90 seconds it exits and shows the link again; run it again afterwards to finish. No dependencies; measuremysite on npm.

1. Get your snippet

Start a free trial, add your domain, and copy the snippet from your site's Setup tab. It looks like this:

<script defer src="https://a.measuremy.site/t.js" data-key="YOUR_SITE_KEY"></script>
  • Put it inside <head> on every page you want counted.
  • The key is public and can only record visits, so it's safe in page source.
  • One site covers its subdomains: example.com also counts www.example.com and blog.example.com. Visits from other hosts, including localhost, are rejected.

2. Add it to your platform

Plain HTML

Paste the snippet inside <head> on every page, or in the shared header template if your pages use one.

Next.js

The quickest way is the component: npm install next-measuremysite, then put <Measuremysite siteKey="pk_..." /> (from import { Measuremysite } from "next-measuremysite") once inside <body> in app/layout.tsx, or in pages/_app.tsx on the Pages Router. It leaves the tracker out of next dev, and NEXT_PUBLIC_MEASUREMYSITE_KEY works instead of siteKey. For events, import { track } from "next-measuremysite" and call track("signup").

Or add the tag by hand. App Router: add it to the <head> in app/layout.tsx:

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <head>
        <script defer src="https://a.measuremy.site/t.js" data-key="YOUR_SITE_KEY"></script>
      </head>
      <body>{children}</body>
    </html>
  );
}

Pages Router: put the same tag inside <Head> in pages/_document.tsx. Client-side route changes are tracked automatically.

React, Vue, Svelte (Vite and other SPAs)

Add the snippet to index.html inside <head>. Route changes made with the History API (React Router, Vue Router, SvelteKit and most others) are counted as pageviews automatically.

Nuxt

Install the module with npm install nuxt-measuremysite, then add it in nuxt.config.ts: modules: ["nuxt-measuremysite"] and measuremysite: { key: "pk_..." } (or set NUXT_PUBLIC_MEASUREMYSITE_KEY). Route changes are counted as pageviews automatically, and useMeasuremysite().track("signup") sends custom events.

Astro, Hugo, Jekyll, Eleventy

Add the snippet to the base layout that renders <head> (for example src/layouts/Layout.astro, layouts/partials/head.html or _includes/head.html).

On Astro you can use the integration instead: npx astro add astro-measuremysite, then pass your key as measuremysite({ key: "pk_..." }) in astro.config.mjs. Starting a new site? npm create astro@latest -- --template developeron29/astro-measuremysite-starter has it set up.

Docusaurus

Install the plugin with npm install docusaurus-plugin-measuremysite, then add plugins: [["measuremysite", { key: "pk_..." }]] to docusaurus.config.js (or set MEASUREMYSITE_KEY where the site builds). Every page gets the tag, page changes are counted as pageviews, and docusaurus start leaves it out. For events, import { track } from "docusaurus-plugin-measuremysite" and call track("signup").

WordPress

Easiest: install a header-code plugin such as WPCode, choose Header, paste the snippet and save. Or, with a child theme, paste it just before </head> in header.php.

Webflow

Site settings → Custom code → Head code, paste the snippet, save, then publish the site. Custom code requires a paid site plan.

Framer

Site settings → General → Custom Code, paste into Start of <head> tag, then publish.

Shopify

Online Store → Themes → … → Edit code, open layout/theme.liquid and paste the snippet just before </head>. Save.

Squarespace

Settings → Advanced → Code Injection → Header, paste and save. Code injection needs a Core plan or higher.

Wix

Settings → Custom Code → Add Custom Code, paste the snippet, choose All pages and Head, apply. Requires a premium plan with a connected domain.

Ghost

Settings → Code injection → Site header, paste and save.

Google Tag Manager

Prefer pasting the snippet directly. If you must use GTM, create a Custom HTML tag with the snippet, fire it on All Pages, and publish the container. Ad blockers that block GTM will also block it. Because the snippet isn't in your page's HTML, verify your domain with the DNS TXT record on the Setup tab.

3. Track conversions

Pageviews are automatic. To learn which channels bring customers, record the moments that matter with measuremysite.track(name, props):

// after a successful signup
measuremysite.track("signup", { plan: "free" });

// a purchase or upgrade
measuremysite.track("purchase", { plan: "pro", value: 29 });

// a button click, from code
document.querySelector("#book-demo").addEventListener("click", () => measuremysite.track("demo_request"));

For clicks and form submits you don't need any JavaScript. Add data-measuremysite-event to the element, and optionally data-measuremysite-props with a JSON object:

<a href="/signup" data-measuremysite-event="signup_click">Start free</a>
<button data-measuremysite-event="add_to_cart" data-measuremysite-props='{"sku":"tee-01"}'>Add to cart</button>
<form action="/subscribe" data-measuremysite-event="newsletter_submit">...</form>

A click anywhere inside the element counts, including its children. A form is tracked when it is submitted.

  • Any custom event counts as a conversion for the channel the visitor arrived from (same day).
  • Names up to 100 characters; props are optional, up to 2 KB of JSON. Don't put personal data (emails, names) in props.
  • The script loads with defer. If you call track very early, guard it: window.measuremysite && measuremysite.track("signup").

4. See where visitors drop off

A funnel is an ordered list of steps. Each step is a page (starts with /, and /docs/* matches everything under it) or an event name. Create one on your site's Funnels tab, or ask your agent: "create a funnel from the homepage to signup and tell me where people drop off".

/
/pricing
signup_click
signup

For each step you see how many visitors got there, the share of the first step and of the previous step, and the biggest drop. Visitors are matched within one UTC day because visitor ids rotate daily, so a visitor who finishes the funnel on a later day isn't counted as converting. Up to 10 funnels per site, 2 to 8 steps each.

5. Use campaign links

Links with UTM tags are attributed to that campaign. Create them on your site's Campaigns tab, or ask your agent to call create_tracked_link. Either way the campaign is logged so spikes and conversions are credited to it.

https://example.com/pricing?utm_source=newsletter&utm_medium=email&utm_campaign=october-launch

5. Check it works

  1. Open your site in a normal browser window (not one with an ad blocker that blocks analytics).
  2. The first visit verifies that you own the domain: we fetch your homepage and look for your site key. Nothing is recorded until then. If the snippet isn't in your homepage's HTML (for example, it's added through Google Tag Manager), add the DNS TXT record shown on your site's Setup tab instead.
  3. Open your site's Overview in the dashboard and pick 24h. The visit appears within seconds.
  4. Spikes and AI explanations are computed hourly and need a few days of history to compare against.

Troubleshooting

"Not verified" on your siteThe snippet must be in the HTML your homepage returns, or the TXT record must be set. Use Check now on the Setup tab; we also re-check hourly.
No visits showingCheck the page source contains the snippet, and that the page's domain matches the site you added (or is a subdomain of it).
Content Security Policy errorsAdd https://a.measuremy.site to both script-src and connect-src.
Fewer visits than expectedSome ad blockers block analytics scripts; bots and crawlers are filtered out on purpose.
Visits stoppedYour plan's monthly limit was reached (we email you at 80% and 100%), or your free trial ended. Your dashboard shows which; choose or upgrade a plan to resume.

Next: connect your AI agent →