Skip to main content
For hand-written pages and for sites built by a static site generator. Tested by the example site examples/static-html, which runs in the browser test matrix.

Where the tag goes

Paste the tag from the console into the <head> of every page. In the example, the build replaces the comment <!-- tracker --> with the tag (it does so only so that tests can use their own site id); on your site the tag itself stands there:
With the example values from the quickstart, the line becomes:
A static site generator usually has one head template or base layout that every page uses. Put the tag there, outside any helper that escapes HTML, and check one generated page to see that it came out unchanged. Pages without the tag are not counted. Each full page load is one pageview. A jump to an anchor on the same page (#details) is not a pageview.

Counting clicks

Any element with a data-umami-event attribute sends an event of that name when it is clicked; each data-umami-event-<key> attribute adds one data entry:
From your own script, call umami.track(). Keep page code in a file of its own if your site has a content security policy:
custom-events.md lists the limits for names and data.

What the browser tests check

In Chromium, Firefox and WebKit: one pageview per full load, no pageview for an anchor jump, the page title and a same-site referrer as a path, both kinds of custom event, no request at all with Global Privacy Control, the tracker refused when its file was tampered with, and every page served with the content security policy from content-security-policy.md (tests/e2e/specs).