Install on your platform
Statlark is one line in the <head> of every page. These guides show where that line goes on each platform, and how to check it works.
Using an AI coding tool?Hand it the prompt below, or point it at this page as markdown: install.md
Next.js
Add the tracker to your root layout with next/script, and it counts every page, client-side navigations included.
WordPress
Add the tracker to every page with the free WPCode plugin, or from a child theme if you'd rather not add a plugin.
Shopify
Paste the tracker into your theme so Statlark sees your storefront. Checkout and orders need a call from your server.
Webflow
Add the tracker to Webflow's site-wide head code, then publish.
Google Tag Manager
Load the tracker from a Custom HTML tag that fires once on every page.
npm
Install @statlark/web and start the same tracker in code, with a typed API and a React provider.
Anything else
On any other platform, add the tag to the template every page shares, inside <head>. Copy it from Settings → Install, where your site ID is filled in.
<script
defer
src="https://statlark.com/script.js"
data-website-id="YOUR_SITE_ID"
></script>The tag sets a first-party analytics cookie as soon as it loads. Where the law asks for consent first, such as for visitors in the EU or UK, install the consent banner in its place: it loads the tracker only after the visitor accepts. Or switch on cookieless mode, which stores nothing on the device.
Hand this to your AI
For AI tools: this is the prompt a customer pastes in to start this task. If you are already following it, don’t start again: use the rest of this page as the guide.
Paste this into Claude Code, Cursor or another AI coding tool, in your project. Replace YOUR_SITE_ID first, or copy the prompt from Settings → Install, where it’s filled in. On Next.js, WordPress, Shopify or with npm, that platform’s page has a more specific prompt.
Add Statlark analytics to this project for my site.
Add this script to the <head> of every page, exactly once:
<script defer src="https://statlark.com/script.js" data-website-id="YOUR_SITE_ID"></script>
If the data-website-id above isn't a real site ID (they start with sl_), ask me for it.
1. First check the site doesn't already load Statlark, whether through this script, consent.js, @statlark/web or a first-party proxy. If it does, stop and tell me.
2. Statlark sets first-party analytics cookies. Ask me whether this site has visitors in the EU or UK; you can't tell from the code. If it does, or I'm not sure, stop before adding the script, because it may need to load through the consent banner: https://statlark.com/docs/consent.md
3. Put it in the shared layout or template, so every page gets it. Use the project's normal way of adding a head script, such as the root layout in Next.js or index.html in a single-page app.
4. If the site has a Content Security Policy (check its server or framework config and any <meta http-equiv="Content-Security-Policy"> tag), allow https://statlark.com for scripts and https://collect.statlark.com for connections.
5. Don't change anything else. Finish by telling me what you changed, and remind me to confirm it in Statlark under Settings, Install, Verification.Once it’s in, check it’s working.
Last reviewed