01Getting started
Installation
Add one line to your <head> and Gauss counts page views, visits, time on page and traffic sources. Setup for HTML, CMS platforms, site builders and SPAs.
The Gauss tracker takes one line to install. Once it's on your site, it sends page views, time on page, outbound and contact link clicks, and form submissions on its own, with no cookies and no browser storage.
Get your Site ID
A Site ID is a short identifier for your site: 8 to 16 characters, lowercase Latin letters and digits only. You get it, along with a ready-made snippet, when you add a site in your account.
The Gauss dashboard is in private beta. To get access and a Site ID, request an invite at beta application.
The snippet
Paste this line into the <head> of every page and replace YOUR_SITE_ID with your Site ID:
<script defer data-site="YOUR_SITE_ID" src="https://collect.gausslab.io/js/gauss.js"></script>The defer attribute means the script downloads in parallel with the page and runs after the HTML is parsed, so it doesn't block rendering.
| Attribute | Required | What it does |
|---|---|---|
data-site | yes | your Site ID. If the format is wrong, the tracker doesn't start |
data-debug | no | prints every event to the browser console, see Verify your installation |
data-api | no | a different endpoint for events instead of https://collect.gausslab.io/api/event |
Coming soon. Serving through your own domain (first-party proxy), so the script and event collection run from an address like
stats.your-site.com.
Add the snippet only once: two tags on a page produce two page views per navigation.
Site builders and CMS platforms
The rule is the same everywhere: the snippet has to end up in the <head> of every page. Menu names change from one platform version to the next, so below is where to look rather than an exact path.
- WordPress — add the line to your theme header (
header.php, before</head>) or use any plugin for inserting code into the header. Code added to a theme file can be lost when the theme updates, so a plugin or a child theme is safer. - Shopify — in your theme code, in
theme.liquid, before</head>. - Tilda, Webflow, Wix — site settings have a section for custom code in the
<head>. Paste the snippet there and republish the site.
Editor and preview modes inside site builders don't send events: those previews open in an <iframe>, and the tracker doesn't run in iframes. Test on the published site.
SPAs: React, Vue, Next.js and others
Single-page apps need no extra setup. The tracker watches the History API (pushState, replaceState, popstate) and sends a page_view every time the URL changes. If the cleaned URL stays the same, no duplicate view is sent.
Add the snippet once to your shared template: index.html for Vite or Create React App, the root layout in Next.js, app.html or its equivalent in other frameworks.
Coming soon. Hash routing (
/#/catalog). Right now the part of the URL after#is dropped, and navigation that only changes the hash isn't counted as a separate view.
Content Security Policy
If your site sends a Content-Security-Policy header, allow the Gauss domain for loading the script and for sending events:
script-src 'self' https://collect.gausslab.io;
connect-src 'self' https://collect.gausslab.io;script-src covers loading gauss.js; connect-src covers the requests that carry events. If you add the inline queue stub for custom events, it needs a nonce or a hash in script-src, like any inline script. If you use data-api, list that address in connect-src.
Local development
No events are sent from localhost, 127.*, *.local addresses, files opened via file:, or automated browsers. Your test visits stay out of your stats, but it also means you can't confirm a local install through reports. To see events before you go live, see Verify your installation.
Next steps
- What's tracked automatically — the events the tracker sends on its own.
- Verify your installation — how to confirm events are going out.
- Custom events — leads, sign-ups, button clicks.
- What data is collected — what the tracker sends and what it doesn't. Whether you need visitor consent is up to the site owner and their lawyer; see Visitor data statement and Data and privacy.