Docs

Plain HTML

Works with any site or static generator. One line, before the closing </head> tag.

Add the snippet

Paste this just before </head> on every page (or in your shared layout/template):

<script defer src="http://localhost:3000/analytics.js" data-website-id="YOUR_TRACKING_ID"></script>

The script is deferred and non-blocking: it never slows down your page or affects Core Web Vitals.

Single-page apps

No extra work: the script hooks pushState, replaceState and popstate, so client-side navigations are tracked automatically.

Optional attributes

Add these to the script tag when you need more control:

  • data-debug: log every event to the console.
  • data-heartbeat: per-page time heartbeat interval in seconds; 0 disables it (default 30).
  • data-include / data-exclude: regular expressions matched against location.pathname to allow or deny tracking.

Track custom events

Call the global lumen function with a name and optional properties:

lumen("Signup", { plan: "pro" });

Outbound link clicks and file downloads are tracked automatically. No extra code.

Verify

Reload the page and open the site's real-time view in your dashboard. The event should appear within seconds.