Install guide

Add Servoki to your site in two minutes

One small script. No cookies, no consent banner, no performance hit. Paste it once and you're collecting privacy-first analytics. Pick your platform below.

Your snippet

The one line that does it all

This is the only code you need. It's about 1.5 kB, loads asynchronously, sets no cookies, and starts counting page views the moment it runs. Replace the domain with your site, or ?site=yourdomain.com in this page's URL to pre-fill it everywhere.

Put it inside the <head> (or just before </body>) on every page you want to measure. That's it — the rest of this page is just where, exactly, to paste it for your stack.

Two ways to identify your site

By domain (shown above) is the simplest. Note that data-site is a fixed label, not your live hostname — use the same value on staging, preview deploys and localhost so they all report to the one site.

By numeric ID is an alternative for when your domain might change, or one site spans several domains. Every site has a stable 5-digit code (from 10000), shown on its dashboard. Swap the domain for the number — everything else is identical:

Platform guides

Where to paste it

1

Open your site's HTML template

Find the file that renders the <head> on every page — often index.html, layout.html, or a shared header partial.

2

Paste the snippet before </head>

3

Deploy and load any page

Open your site, then check the Realtime view in your Servoki dashboard — your visit should appear within a few seconds.

1

New tag → Custom HTML

In Google Tag Manager, go to Tags → New → Custom HTML and paste the snippet.

2

Trigger on All Pages

Set the trigger to All Pages (or Initialization) so it fires everywhere. Leave "Support document.write" unchecked.

3

Submit & publish

Hit Submit to publish the container, then load your site and confirm the visit in Realtime.

1

Easiest: a header-snippet plugin

Install a plugin like WPCode or Insert Headers and Footers, then paste the snippet into the Header box and save. No theme editing needed.

2

Or edit the theme directly

In a child theme, add the snippet to header.php just before </head>. Avoid editing the parent theme — updates would overwrite it.

3

Clear caches

If you run a caching plugin (WP Rocket, LiteSpeed, W3 Total Cache), purge the cache so the new markup ships, then check Realtime.

1

App Router — use next/script

Add it to app/layout.tsx so it loads on every route.

2

Pages Router — add to _document

In pages/_document.tsx, drop the standard snippet inside <Head>.

3

Count client-side route changes

The script auto-fires one page view on load. For App Router / Pages Router navigations, fire a page view yourself on route change — see the single-page app guide for the exact useEffect snippet.

1

Add it to index.html

Vite, Create React App and most SPA setups have a single index.html. Paste the snippet inside its <head> — no component or hook required.

2

Count client-side route changes

The script fires one page view on load. For React Router / TanStack Router navigations, call window.servoki.track('pageview') on each route change — the single-page app guide has a drop-in hook.

1

Edit your theme code

In Shopify admin go to Online Store → Themes → ⋯ → Edit code, open layout/theme.liquid.

2

Paste before </head>

3

Track purchases server-side

For accurate, ad-blocker-proof revenue, also confirm orders from your backend with the Server API — see the dashboard's Server tracking guide. The browser snippet alone still counts checkouts, but server events are the source of truth.

1

Find the custom-code / head section

Webflow: Project Settings → Custom Code → Head Code.
Framer: Site Settings → General → Custom Code → End of <head> tag.
Squarespace: Settings → Advanced → Code Injection → Header.

2

Paste the snippet and publish

Save, then publish the site (custom code usually only runs on the published site, not the editor preview).

Verify it works

Confirm you're collecting data

Watch Realtime

Open your site in one tab and the dashboard's Realtime view in another. Your visit shows up within a few seconds — that's the round trip working end to end.

Check the network request

In your browser's DevTools → Network, filter for event. A 200 to servoki.com/api/event on page load means the beacon is firing.

Go further

Track more than page views

+

Custom events

Call window.servoki.track('signup') anywhere in your JavaScript to record an action. Add properties as a second argument — full reference in the custom events guide:

+

First-party collection (recommended)

Serve the script from a subdomain of your own site (e.g. stats.yourdomain.com) so it's first-party — invisible to ad blockers and durable under Safari's ITP. Set this up under Sites → Custom domain in the dashboard.

+

Server-confirmed conversions

For revenue you can trust, send conversions from your backend with the Server API. Browsers drop events; your server doesn't. Full code samples live in the dashboard under Server tracking.

Stuck on installation?

Send this page to whoever manages your site, or open the dashboard to grab your snippet and watch data arrive live.

Open the dashboard