Counting visitors

One line in your site's layout counts visitors, pages, where they came from, countries, devices, the events you choose and Web Vitals. No cookies and nothing stored in the visitor's browser; a visitor is a daily count that can't be linked across days or sites.

Add it

On the project, Attach → Web analytics, with the hostnames it may count from. Overlook makes the site a public key (ws_…) and shows the line with it filled in. Put it in the layout every page shares:

<script defer src="https://overlook.technology/s.js" data-site="ws_…"></script>
Next.js
app/layout.tsx: <Script src="https://overlook.technology/s.js" data-site="ws_…" strategy="afterInteractive" /> from next/script
Astro
the base layout's <head>: <script is:inline defer src="…/s.js" data-site="ws_…"></script>
Plain HTML, GitHub Pages
the <head> of every page, or the shared layout
A bundled app
import { init } from "@overlook/client/web"; init({ site: "ws_…" })

Single-page apps need nothing more: route changes count as page views. Visits show on the project's Analytics within seconds; the page says Tracker live once Overlook has seen it on your site.

If your site sends a Content-Security-Policy, allow https://overlook.technology in script-src and connect-src.

From your own domain

To keep your pages free of anyone else's address, and past ad blockers that block it, serve the script from your own domain. On Vercel or Next.js, rewrite exactly these three paths, then load /_o/s.js; it sends to /_o/e on its own:

// next.config.ts
async rewrites() {
  return ["s.js", "v.js", "e"].map((f) => ({
    source: `/_o/${f}`,
    destination: `https://overlook.technology/${f}`,
  }));
}

A rewrite between two sites on Vercel keeps each visitor's address and location. A proxy elsewhere (nginx, Cloudflare, Netlify) reaches Overlook from its own address, so every visitor would count as one: load the script from overlook.technology there.

Options

data-exclude="/admin/*,/drafts/**"
Pages not to count. Use it for any path that holds a secret or a person's id (a share link, an account page): query strings are dropped, paths are not.
data-outbound="false"
Stops counting clicks on links to other sites and file downloads.
data-hash
The site routes by hash (#/settings), so the fragment names the page.
data-vitals="0.1"
The share of page loads that report Web Vitals; all of them by default.
data-api="/_o/e"
Where hits go, when it isn't next to the script.

Events

Count what visitors do, with up to 20 details each:

<button data-ov-event="Signup" data-ov-prop-plan="pro">Sign up</button>
<script>window.ov=window.ov||function(){(ov.q=ov.q||[]).push(arguments)}</script>
<script>ov("Signup", { plan: "pro" })</script>

Each event shows as a goal with its conversion rate.

Not counting yourself

Open any page of your site with ?ov_ignore=1 once in each browser you use; ?ov_ignore=0 undoes it. Local addresses and automated browsers are never counted.

Your privacy notice

Say what's counted and how to opt out. Something like:

We count visits with privacy-friendly analytics. It sets no cookies and stores nothing on your device unless you opt out; your IP address is used only to make a daily anonymous count and is never stored. To opt out on this site, open any page with ?ov_ignore=1, which this browser then remembers.

Next: API and agents →