Frameworks
Add CrispStats to a plain HTML site
To add analytics to a plain HTML site, paste one script tag inside the head of every page and publish. CrispStats then counts pageviews, sources and time on page with no build step, no cookies and nothing stored on the visitor's device.
Updated
Set up CrispStats on HTML
- 01
Step 1: Copy the snippet with your key
In the dashboard, open your site’s Settings and select Tracking code. The HTML tab shows the tag with your public key (it starts with
cs_pk_) and your domain filled in. You can also copy it from the command menu with Copy tracking snippet.Replace the highlighted values with your own.
<scriptdeferdata-site="cs_pk_your_site_key"data-domains="example.com"src="https:/ / in. crispstats. com/ d. js"></script> - 02
Step 2: Paste it inside the head on every page
Put the tag inside
<head>. If your pages share a header include or a template in your static site generator, add it there once; if every page is its own file, add it to each one. Keepdefer(or useasync) and do not addtype="module": the script reads its options from its own tag, which a module script cannot do.index.html<!doctype html><html lang="en"><head><meta charset="utf-8" /><title>Example</title><scriptdeferdata-site="cs_pk_your_site_key"data-domains="example.com"src="https:/ / in. crispstats. com/ d. js"></script></head><body><h1>Hello</h1></body></html> - 03
Step 3: Publish and open the live site
Upload the files or push to your host, then open the live site in a normal browser window. Pages on
localhost,127.0.0.1,[::1]andfile://are ignored, so opening the file from your disk or a local preview does not count, and neither do automated browsers (localhost and testing). - 04
Step 4: Turn on optional modules
Each module starts working when its attribute is on the tag:
data-outboundfor clicks on links to other sites,data-downloadsfor file downloads,data-vitalsfor LCP, INP, CLS, FCP and TTFB,data-errorsfor uncaught JavaScript errors, anddata-404for pages that contain<meta name="crispstats:404">. The switches under Extra events on the Tracking code tab add them for you.<scriptdeferdata-site="cs_pk_your_site_key"data-domains="example.com"data-outbounddata-downloadsdata-vitalsdata-errorsdata-404src="https:/ / in. crispstats. com/ d. js"></script> - 05
Step 5: Count a button with no JavaScript (optional)
Add
data-cs-eventto any element to count clicks on it as a custom event. Properties come fromdata-cs-prop-attributes.<button data-cs-event="newsletter signup" data-cs-prop-place= "footer">Subscribe</button>
Check that it works
The status row at the top of Settings, Tracking code checks the install every five seconds while the tab is open. It moves from Waiting for the first event… to Receiving events. once the first event is stored, and the visit appears on Realtime. If it stays waiting, check for an ad blocker in your own browser, a cached copy of the page without the tag, a Content Security Policy that does not allow in.crispstats.com, or localStorage.crispstats_ignore set in your browser.
CrispStats on HTML
What you get
- Pageviews, unique visitors, sessions and time on page for every page that carries the tag.
- Where visitors come from: search, social, referrers, UTM campaigns and AI assistants such as ChatGPT and Perplexity.
- Countries, devices and browsers, from a visitor id that is a daily rotating hash, never a cookie.
- Outbound clicks, downloads, 404s, web vitals and JavaScript errors, each from one attribute.
- A core script of about 2.2 KB gzipped, about 3.8 KB with every module on, loaded with defer so it never blocks rendering.
Notes and limits
- A static site with many hand-written files needs the tag in every file. A page without it is simply not counted, with no error anywhere.
data-domainslimits counting to the hostnames you list. A copy of the site on a staging host or a preview URL sends nothing until you add that hostname.- If the site’s URLs look like
/#/pricing, adddata-hashso each hash route counts as a page. Ordinary anchors such as#faqare not pages. - A purely static host runs no code of yours, so the forwarding proxy for ad-blocked visitors needs a host or CDN that can forward a path, such as Cloudflare, Netlify, Vercel or nginx: see the proxy guide.
- Only a Plausible export can be imported. Otherwise history in CrispStats starts the day the tag goes live.
The docs page covers the optional steps this guide leaves out.
Setup questions. Straight answers.
What people ask before they connect it.
Inside the head element, on every page you want counted. With defer it loads after the page has been parsed, so the position inside the head does not delay rendering.
Yes. The script is one tag that loads from the collector host, so a site of plain files with no package manager, bundler or framework is fully supported.
Local pages are ignored by default. Add data-debug and add localhost to data-domains while you test: each event is logged in the browser console and nothing is sent.
Nothing for the first 14 days: every account starts with a 14-day free trial with every feature and no card. After that Starter is $5 a month for 250,000 events, which covers most small sites. There is no free plan.
Not answered here? Write to hello@crispstats.com
Go further
Related
- Cookieless analytics explained
How cookieless analytics counts unique visitors with a daily rotating hash instead of a cookie, what it can and cannot tell you, and the trade-offs.
- Privacy-friendly analytics for bloggers
See which posts get read to the end, where readers come from, including AI assistants, and keep your site free of analytics cookies.
- Web vitals from real visits
LCP, INP and CLS measured on real visits, by page and device.
- UTM builder
Build UTM-tagged links one at a time or in bulk from pasted rows, with presets, checks for capitals and spaces, CSV export and a channel preview.
- Install through Google Tag Manager
Load CrispStats through a Google Tag Manager Custom HTML tag that fires on All Pages.
Guides
- How to improve Core Web Vitals: the fixes that move LCP, INP and CLS
How to improve Core Web Vitals metric by metric, from Google's web.dev guidance: what to fix first for LCP, INP and CLS, with a worked LCP breakdown.
- Google Tag Manager vs Google Analytics: what each one does
Google Analytics measures visits and reports on them; Tag Manager only loads tags.
Other integrations
Frameworks
Site builders
Ecommerce platforms
Tag managers
Your traffic, crisp and clear
One script, no cookies, and every feature from the first day. Set up takes about as long as pasting a snippet.