Add Millimetry to a website
The tracker is one script, about 0.7 KB compressed. It sends a page view when a page loads and on every single-page-app navigation, and the custom events you send.
It never sets cookies. It writes nothing to localStorage, sessionStorage, IndexedDB or any cache, and it reads no fingerprinting signals (canvas, audio, fonts, plugins). It does nothing on localhost, 127.0.0.1 or file: pages, in automated browsers, or on a prerendered page until someone sees it.
1. Create the site
Section titled “1. Create the site”In the dashboard, choose Add an app or site, name the site, and add every origin it is served from, such as https://example.com and https://www.example.com. Millimetry refuses events from any other origin. Copy the site key (wk_…).
2. Add the script
Section titled “2. Add the script”Add one line to every page, for example in your layout’s <head>:
<script defer src="https://e.millimetry.app/s.js" data-key="wk_…"></script>That’s all. Page views appear in the dashboard’s live view within seconds.
If your visitors use ad blockers, consider serving the script from your own domain: see proxied installs.
From a builder’s chat
Section titled “From a builder’s chat”Building with Lovable, Bolt, Replit, v0 or another app builder? Paste this into its chat, with your key in place of wk_…, and it does the install:
Add Millimetry analytics to this site. Put exactly this tag in the <head> of every page:<script defer src="https://e.millimetry.app/s.js" data-key="wk_…"></script>Page views are automatic. For the actions that matter (sign-up, purchase, the key feature), callmillimetry("event_name") on success, with names in snake_case and no personal data in them.Do not add cookies, consent banners or any other analytics for this. Then tell me which events you added.With Replit, add the Millimetry MCP server instead and ask the Agent to set it up.
Custom events
Section titled “Custom events”window.millimetry("signup_click", { plan: "pro" });Calls made before the script has loaded are kept if you add this line before the tracker:
<script>window.millimetry=window.millimetry||function(){(window.millimetry.q=window.millimetry.q||[]).push(arguments)}</script>Event names are 1 to 64 characters. pageview and names starting with $ are reserved (send pageview only with manual page views, below). Properties are strings, numbers or Booleans, up to 25 per event. Never send personal data.
Paths with IDs in them
Section titled “Paths with IDs in them”A single-page app whose paths carry identifiers (/orders/8231, /users/jane@example.com) would store them with every page view. Report the route instead: add data-pageviews="manual" to the tag, and send each page view yourself with your router’s pattern for the page.
<script defer src="https://e.millimetry.app/s.js" data-key="wk_…" data-pageviews="manual"></script>// On every route changewindow.millimetry("pageview", undefined, { url: "/orders/:id" });// A custom event can name the same pagewindow.millimetry("refund_requested", { reason: "late" }, { url: "/orders/:id" });With data-pageviews="manual" the tracker sends no page view on its own, on load or on navigation, so send exactly one per route change. url is a path on your site; only its path and its utm_ parameters are kept. Calls queued before the script loads keep their url.
What is stored
Section titled “What is stored”From each page view:
- the hostname and path;
- the referring site’s name (
Google,news.ycombinator.com), never its full URL; utm_source,utm_mediumandutm_campaign, and no other part of the query string or fragment (with the referrer, they give each session its channel: Direct, Search, AI assistants, Social, Email, Paid or Referral; see AI traffic);- the browser and OS with their major versions;
- a screen-size class (mobile, tablet, laptop, desktop);
- the country and region.
Visits are grouped into sessions on the server. A session ends after 30 minutes without a page view.