umami JavaScript object — and you can mix both freely within the same site.
Limits
Before you start, keep these constraints in mind:- Event names are limited to 50 characters. Names longer than 50 characters will be truncated.
- Event data cannot be sent without an event name. You must supply a name if you want to attach properties.
Using Data Attributes
The data-attribute method requires no JavaScript. Adddata-umami-event directly to any HTML element and Betterumami records an event whenever a user clicks it. This works on buttons, links, form elements, or any other interactive element.
1
Add the event name attribute
Take any element you want to track — for example, a signup button:Add the When a visitor clicks this button, Betterumami records an event named
data-umami-event attribute with the name you want to appear in your dashboard:Signup button.2
Optionally attach event properties
You can pass additional data alongside the event name using the This records the event
data-umami-event-{property} pattern. Each extra attribute becomes a key-value pair in the event payload:Signup button with the properties { plan: 'pro', source: 'homepage' }.All values recorded via data attributes are saved as strings, regardless of what you write in the HTML. If you need to record numbers, booleans, or other data types, use the JavaScript method instead.
Using JavaScript
The JavaScript method gives you full control: you can call it from any event handler, trigger it conditionally, and pass rich data including numbers, booleans, and nested structures.Track a basic event
Track an event with properties
Pass an object as the second argument to attach custom data to the event:Real-world examples
View Your Events
Once events are being recorded, navigate to the Events tab on your website dashboard. You’ll see a chart of event volume over time and a breakdown by event name.Event properties
Open the Properties tab on the Events page to explore the custom data you attached. Betterumami shows every distinct property name you’ve used and a value distribution for each one, so you can immediately see, for example, how many signups came from thepro plan versus the starter plan.