umami object with two core functions: umami.track() for recording pageviews and events, and umami.identify() for attaching a Distinct ID or custom properties to the current session. By default the tracker handles everything automatically, but calling these functions directly gives you precise control over what gets recorded, when, and with what data attached.
Function Signatures
Pageviews
By default, Betterumami automatically records a pageview when your page loads and on every client-side navigation. You only need to callumami.track() manually if you’ve disabled automatic pageview collection with data-auto-pageview="false".
Track the current page
string
The hostname of the current page, for example
www.acme.com.string
The visitor’s browser language, for example
en-US.string
The referring URL that brought the visitor to this page.
string
The visitor’s screen dimensions, for example
1920x1080.string
The current
document.title value.string
The current page URL path.
string
required
Your Betterumami website ID. Injected automatically from
data-website-id.Track with a custom payload
Pass a plain object to override specific properties on a single pageview:When you pass a plain object, only the properties you provide are sent. The tracker does not merge in the auto-collected defaults. If you want to keep the defaults and only override a few fields, use the function form below.
Merge auto-collected properties with overrides
Pass a function that receives the defaultprops object and returns a merged payload:
Events
Track a named event
Track a named event with data
Pass any JSON-serialisable value as the second argument. The properties you provide appear in the Events → Properties tab of your dashboard.umami.track(name, data) is equivalent to:
Event data limits
Event data can include any JSON-compatible value, subject to the following limits to maintain dashboard performance:Override the event timestamp
You can backfill historical events or correct a timestamp by passing a UNIX timestamp (seconds) in the payload:Sessions and Identify
Theumami.identify() function attaches a Distinct ID and optional session-level properties to the current visitor’s session. Session data lets you segment your analytics by attributes like subscription plan, company, or user role — properties that describe who the visitor is rather than what they did on a specific page.
Assign a Distinct ID
user@example.com. If the same identifier appears in another session (another device or browser), Betterumami shows the combined activity under one profile.