tests/e2e/specs/events.spec.ts), and tests/webpath follows
them into Umami.
For wallet connect events from the Stellar Wallets Kit, see wallets-kit.md.
Sending a custom event
Two ways, both from Umami’s documented integration, so existing Umami instructions work as they are. From HTML, with no JavaScript. A click on an element withdata-umami-event sends an event of
that name. Every data-umami-event-<key> attribute on the same element becomes one data entry:
signup-click with the data { "plan": "free" }. Attribute values are always strings.
A same-tab link with the attribute waits for the event before it navigates, so the click is not lost.
From JavaScript, with umami.track(name, data):
umami.track("plan-chosen", { plan: "pro", seats: 3, annual: true }). umami.track() returns a
promise. The visitor may block the tracker, so call it as window.umami?.track(...) and never let
your own code depend on it. The framework guides show the same call in React, Vue, Svelte and
Next.js components.
If you installed the npm package instead of the script tag, init({ siteId, host })
installs the same window.umami, so both ways above work unchanged.
Limits
The tracker checks every event before it sends anything, and the gateway checks again.
“Rejects” means the promise returned by
umami.track() is rejected with a TypeError that names
the problem, for example umami: event data has more than 16 keys, and nothing is sent. The
tracker does not drop the extra keys for you, because silently losing data would hide the mistake;
the error shows up in your browser console instead.
A client that skips the tracker and posts such an event to the gateway directly gets 400 and the
event is not stored.
Lengths are counted in UTF-16 code units, the way JavaScript counts string.length.
What is removed before an event is stored
The gateway redacts personal and secret values in the event name, every data key and every string data value (and in the page URL, referrer and title) before the event is queued. It replaces:
Stellar keys are matched by their checksum, also when lower-cased or glued to other text. So
umami.track("seed-check", { note: "key SB..." }) is stored with the data
{ "note": "key {redacted-secret}" }. Redaction is a safety net, not a licence: never put a secret
seed, an address or any other personal value into event data in the first place. If two keys of one
event redact to the same text, only one of them is kept.
Numbers and booleans are stored unchanged.