Before you start
You need permission to publish the site and your Datalyr workspace ID. In Datalyr, open Settings → Install. New workspaces also show the same snippet on the dashboard until the first event arrives.Install the snippet
Copy your snippet
Open Settings → Install and copy the snippet shown for your workspace. The workspace ID is already filled in.
Paste it in the head
Add it inside the
<head> of every page, before the closing </head> tag. Put it in the shared site template when possible.Publish the site
A local or draft change cannot send production visits. Deploy or publish it before testing.
What starts automatically
The snippet records page views, sessions, anonymous visitors, URLs, referrers, UTM parameters, supported ad click IDs, and browser context. It also tracks route changes in single-page applications. Automatic tracking does not know who a visitor is or which product action matters to you. Addidentify after sign-in and custom events for actions such as signup, lead submission, or checkout.
Install with npm
Use the package when your application owns its JavaScript lifecycle.Common framework placement
| Platform | Where to install |
|---|---|
| Next.js | Root layout or a client-side analytics component loaded once |
| React or Vue SPA | Application entry point, initialized once |
| WordPress | Site-wide header through the theme or a header-injection tool |
| Webflow or Framer | Global custom code in the site head |
| Custom HTML | Shared <head> template on every page |
Verify the install
Open Events and look for a recentpageview with the URL you visited. If it is missing, confirm the published HTML contains dl.js, the workspace ID is correct, and an ad blocker or consent setting did not block analytics.
Next, run the full verification checklist.