Install Tracking

Add one line of code to your website. No cookies, no consent banner, no complex setup.

The snippet

<script defer data-site="YOUR_SITE_ID" src="https://your-app.com/api/script.js"></script>

Replace YOUR_SITE_ID with your site ID from the Analytics dashboard, and update the src URL to point to your Zero to One instance.

The tracking script is under 1KB and loads with the defer attribute, so it never blocks page rendering. It uses navigator.sendBeacon to send data without affecting page performance or navigation.

Framework guides

Plain HTML

Add the snippet before the closing </head> tag:

<!DOCTYPE html>
<html>
<head>
  <title>My App</title>
  <script defer data-site="YOUR_SITE_ID" src="https://your-app.com/api/script.js"></script>
</head>
<body>
  ...
</body>
</html>

Next.js (App Router)

Use the next/script component in your root layout:

// app/layout.tsx
import Script from "next/script";
 
export default function RootLayout({ children }) {
  return (
    <html>
      <head>
        <Script
          defer
          data-site="YOUR_SITE_ID"
          src="https://your-app.com/api/script.js"
          strategy="afterInteractive"
        />
      </head>
      <body>{children}</body>
    </html>
  );
}

React (Vite / Create React App)

Add the snippet to your index.html in the <head>:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>My App</title>
  <script defer data-site="YOUR_SITE_ID" src="https://your-app.com/api/script.js"></script>
</head>
<body>
  <div id="root"></div>
  <script type="module" src="/src/main.tsx"></script>
</body>
</html>

Vue / Nuxt

Add to your Nuxt config:

// nuxt.config.ts
export default defineNuxtConfig({
  app: {
    head: {
      script: [
        {
          defer: true,
          "data-site": "YOUR_SITE_ID",
          src: "https://your-app.com/api/script.js",
        },
      ],
    },
  },
});

Astro

Add to your base layout:

---
// src/layouts/Layout.astro
---
<html>
  <head>
    <script defer data-site="YOUR_SITE_ID" src="https://your-app.com/api/script.js"></script>
  </head>
  <body>
    <slot />
  </body>
</html>

SvelteKit

Add to your app.html:

<!-- src/app.html -->
<!DOCTYPE html>
<html>
<head>
  %sveltekit.head%
  <script defer data-site="YOUR_SITE_ID" src="https://your-app.com/api/script.js"></script>
</head>
<body>
  <div>%sveltekit.body%</div>
</body>
</html>

WordPress

Option A: Go to Appearance > Theme Editor > header.php and paste the snippet before </head>.

Option B: Use a plugin like "Insert Headers and Footers" to add the snippet without editing theme files.

Webflow / Squarespace / Wix

Go to your site's Custom Code settings (usually under Settings > Advanced > Custom Code) and paste the snippet in the "Head Code" section.

Verifying the installation

  1. Add the snippet to your website
  2. Visit your website in a browser
  3. Go to the Analytics dashboard in Zero to One
  4. You should see your page view appear within seconds

If you're testing locally, make sure your Zero to One instance is also running locally. The snippet sends data to the same origin it was loaded from.

Privacy compliance

The tracking script collects no personal data:

  • No cookies or local storage
  • No IP addresses (we derive country from timezone, not IP)
  • No browser fingerprinting
  • No cross-site tracking

This means you do not need:

  • A cookie consent banner (GDPR)
  • A "Do Not Sell" link (CCPA)
  • A PECR consent mechanism

The script is compliant out of the box with GDPR, CCPA, PECR, and ePrivacy regulations.