Custom events
Pageviews tell you where people go. Custom events tell you what they do: join, pass an age gate, start a game, subscribe or buy. Each custom event counts as one event toward your monthly allowance.
With HTML attributes (no JavaScript)
Add data-umami-event to any button or link. A click sends an event with that name.
<button data-umami-event="Join free">Join free</button>
Add properties with extra data-umami-event-* attributes:
<a href="/join"
data-umami-event="Join"
data-umami-event-plan="monthly"
data-umami-event-placement="hero">Join now</a>
With JavaScript
Once the snippet has loaded, a global umami object is available.
// A named event
umami.track('Age gate passed');
// A named event with properties
umami.track('Game started', { game: 'snake', mode: 'ranked' });
// A purchase or tip; Umami's revenue reports read these two properties
umami.track('Checkout', { revenue: 19.99, currency: 'USD' });
If your code may run before the script loads, guard the call: window.umami && umami.track('Signup').
Ideas for common sites
| Site | Events worth tracking |
|---|---|
| Creator or membership site | Age gate shown and passed, free signup, subscription started, tip sent, creator page viewed |
| Browser games | Game started, level reached, game over, shared score, ad viewed |
| Shop or affiliate site | Add to cart, checkout started, outbound offer clicked |
| Publisher or blog | Newsletter signup, read to end, outbound link clicked |
Then build a funnel in the dashboard, for example Age gate shown → Age gate passed → Signup, to see where people drop off.
Rules of thumb
- Keep event names short and consistent, for example
Signuprather than a sentence. Umami limits event names to 50 characters. - Never send personal or sensitive data in event names or properties: no names, email addresses, passwords, card numbers, government IDs or health information. Our acceptable-use policy prohibits it.
- Each
umami.track()call is one event. Avoid firing events on scroll or mouse movement unless you need them, so they do not eat your allowance.