On this page
The whole thing usually takes under ten minutes. You don't need to touch your backend or redeploy the site; you only need to be able to edit the page template, or find the "custom head code" setting in your site builder.
Before you start
- A domain you can open in a browser.
localhostand files opened straight from disk don't send data by default — see "Testing locally" below. - Access to the page
<head>. On hosted site builders this is usually called "tracking code", "header scripts" or "custom HTML".
Step 1: create a project
After you sign up, the console walks you through creating a project. A project is one set of data and one team. Websites, apps and mini programs can all live in the same project, and reports add them up together.
Pick the time zone carefully. "Today" and "yesterday" in every report are cut by the project time zone, not by your laptop clock. You can change it later, but the day boundaries move with it.
Step 2: register your domain
Open Website analytics › Configuration › SDK code and add your domain. Three things to know:
- Enter the host name only —
shop.example.com, withouthttps://and without a path. - Subdomains are allowed automatically. Registering
example.comalso acceptswww.example.comandblog.example.com. - Data from domains you haven't registered is dropped. That stops anyone who copies your site key from filling your reports with their traffic.
Step 3: add the script
The same page shows a snippet with your site key already filled in:
<script defer src="https://static.pathclue.com/client.js" data-site="YOUR_SITE_KEY"></script>
Put it in the <head> of every page. Most sites have one shared header template, so one edit covers everything.
Questions people usually ask at this point:
- Is the
data-sitevalue a secret? No. It only tells the collector which project the data belongs to, and it is visible in your page source anyway. The API keys used for server-side events are the secret part, and those never appear on a page. - Can I drop
defer? Better not. Withdeferthe script runs after the page has been parsed, so it never delays the first paint. - Will two copies count twice? No. Only the first copy runs; a second one sees the first already running and exits. Remove the duplicate anyway, so a later change to attributes doesn't go to the wrong tag.
Step 4: visit your own site
Open any page on the registered domain, then go to Website analytics › Real-time in the console. Your visit normally shows up within a few seconds, with the same path and page title you just opened.
Still empty after a minute? Work through I installed the snippet but see no data. Most of the time the domain doesn't match, or the browser has Do Not Track switched on.
Single-page apps work out of the box
Sites built with Vue Router, React Router, Next.js or Nuxt change routes through the browser's History API, and the script follows those changes — one pageview per route. Only hash routing (/#/pricing) needs an extra attribute; see Single-page apps and hash routing.
Testing locally
On localhost, 127.0.0.1 and similar addresses the script sends nothing, so development reloads don't end up in your reports. If you really need to test locally, add data-allow-local="true" — in your local template only, never in production.
Next
- Project settings: time zone, excluded paths and site search — exclude yourself and your staging site.
- Invite teammates and choose roles
- To record sign-ups and purchases: Custom events