Start free

Practical guide · Search topic: how to add analytics to an HTML website

How to add analytics to a plain HTML website

For a plain HTML website, analytics is commonly installed with a script tag in the shared `<head>` section. If the site has multiple pages, use a shared template or include so the tag stays consistent.

What the query can—and cannot—measure

Create the analytics site first and copy the provider’s exact snippet. Replace only the documented site identifier, preserve privacy settings and avoid copying account secrets into public HTML. If you use a content security policy, allow the tracker’s documented script and connection origins.

A practical way to do it

Publish a test page, open it in a clean browser and check the network request or provider install status. Validate several routes and confirm the site’s registered domain matches the published host.

A useful checklist

  • Copy the provider’s exact public tracking snippet.
  • Insert it once before the closing head tag in the shared template.
  • Test on the deployed domain and inspect one event.

Limits to keep in mind

A script can be blocked by browser settings, CSP, consent tools or extensions; a missing dashboard row does not by itself prove an install error.

Questions

Do I need a different snippet on each page?

Use a shared template where possible and verify all pages load it once.

Can I paste an API key in the HTML?

No; secrets belong on a server, not in public source.

Sources and further reading

Related pages

Install guide & docs · quietstats Under 1 KB script and single-page apps · quietstats cookie-free analytics Zero cookies, privacy built in · quietstats cookie-free analytics

Put your traffic in context

Explore the product, its measurement method and pricing before choosing a tool.

Open the demo See pricing