StatelessID

Netlify

Netlify supports two install methods: editing your source layout directly, or using Netlify's snippet injection feature in the site settings to add the tag without touching your code.

Method one: edit the source layout

Open your site's source repository and find the base layout template for your static site generator. Paste the StatelessID snippet before the closing </body> tag. Commit and push. Netlify's continuous deployment will build and publish the update automatically.

This method works for every static site generator — Hugo, Jekyll, Eleventy, Astro, Next.js static export, and plain HTML sites. The snippet lives in your repository, so it is version-controlled, reviewable, and portable. If you ever move the site off Netlify, the snippet moves with it.

After the deploy completes (check the Deploys tab in your Netlify dashboard for the green Published status), load your site in a browser and check the StatelessID dashboard for the first page view.

Method two: Netlify snippet injection

Netlify can inject HTML snippets into every page it serves without requiring changes to your source code. In your Netlify site settings, go to Site configuration → Build & deploy → Post processing → Snippet injection. Click Add snippet.

Give the snippet a name (e.g., "StatelessID"), choose "Insert before </body>" from the position dropdown, and paste the entire script tag into the HTML field. Save. Netlify will add the tag to every HTML response it serves, including all pages across the site.

This method is useful if your source repository is owned by a third party or if you do not want to add third-party tags to your source code. The downside is that the snippet is stored in Netlify settings rather than in your repository, so it is less visible to other developers working on the project.

Custom domains on Netlify

Netlify assigns your site a netlify.app subdomain (e.g., mysite.netlify.app). If you set a custom domain in Domain settings, visitors will arrive via the custom domain. Use the custom domain as the site identifier in your StatelessID dashboard and use that key in the snippet.

Netlify provisions free SSL certificates via Let's Encrypt automatically when you add a custom domain. Within minutes of DNS propagating, your site will be served over https://. Make sure your StatelessID site registration uses https:// as the protocol.

If you previously installed the snippet with the netlify.app key and are switching to a custom domain, update the key in your snippet injection settings or in your source layout, and add a new site registration for the custom domain.

Netlify's caching and edge behavior

Netlify's edge network caches static assets aggressively but HTML pages less so by default. If you do not see changes after a redeploy, try a hard refresh in your browser (Ctrl+Shift+R or Cmd+Shift+R). You can also trigger a cache purge from the Netlify dashboard.

If your Netlify site uses a netlify.toml file to set custom headers, check whether you have a Content-Security-Policy header defined. If so, add connect-src https://statelessid.com to it so the beacon is allowed to fire.

Netlify Functions and Edge Functions are separate from static page serving. The StatelessID snippet runs in the visitor's browser when an HTML page loads — it does not interact with your Netlify Functions. No special configuration is needed for function-backed pages.

Troubleshooting

I used snippet injection but the tag is not appearing in the HTML. Snippet injection requires that Netlify's post-processing is enabled. Go to Site configuration → Build & deploy → Post processing and confirm it is not disabled. Also confirm the snippet was saved with the correct position setting.

The snippet fires but the data-k value in the live page is wrong. If you used both the source layout method and snippet injection, you may have two script tags on the page — one with the correct key and one with a stale key. Check the HTML source for duplicate asset.js tags and remove the old one.

My Netlify deploy previews are counting in my production dashboard. Netlify preview deploys use the same snippet injection settings as production. To exclude them, use the source layout method and add a conditional that checks the hostname — or accept that preview visits add a small number of page views to your data.

Similar pages