Guide5 min read

How to add privacy-friendly analytics to any site in 60 seconds

A step-by-step guide to installing cookie-free analytics with a single script tag, plus notes for Next.js, WordPress and single-page apps.

Most analytics installs are heavier than they need to be. A privacy-first tool should take one line of HTML and no configuration. Here is the whole process.

1. Get a tracking ID

Create an account, add your website's domain, and copy the tracking ID from the site's settings. The ID identifies the site receiving events; it is safe to expose in your page source.

2. Paste one script tag

Add this before the closing </head> tag on every page you want to track:

<script defer src="https://cdn.lumenlytic.com/analytics.js" data-website-id="YOUR_TRACKING_ID"></script>

The defer attribute keeps the script off the critical path, so it does not block rendering. There are no dependencies and no cookies to configure.

3. Verify it works

Load your site, then open the real-time view in the dashboard. A pageview should appear within a few seconds. If nothing shows up, check for an ad blocker, a strict browser privacy mode, or a missing data-website-id.

You can also add ?lumen_debug to your URL to log what the script sends to the console while you test.

Notes for common setups

  • Next.js App Router: load the script once in the root layout with next/script and strategy="afterInteractive".
  • WordPress: add the tag through your theme's header hook or a small snippet plugin.
  • Single-page apps: the script listens for pushState, popstate and hashchange automatically, so client-side navigation is tracked without extra code.
  • Custom events: call lumen("Signup", { plan: "pro" }) wherever the action happens.

What you will see

Within a minute you get pageviews, referrers, UTM campaigns, device and browser breakdowns, and Core Web Vitals. No consent banner is needed for the tracking itself, because there are no cookies and no personal data stored.

That is the entire install. If a tool needs more than this to start counting, it is probably collecting more than you need.