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.
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.
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.
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.
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.
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.