window.tinyanalytics.event() with a name and optional properties, and the event appears in your Events reports where you can break it down and build funnels and goals from it.
Many interactions are already captured for you — outbound links, downloads, button clicks, copies, and form submissions. Use custom events for actions that are specific to your app and that auto-capture can’t infer. See auto-capture.
Send an event
The API takes an event name and an optional properties object:- Name — a short, stable string like
signuporpurchase. An empty name is rejected. - Properties — an optional object of key/value pairs. Use them to break the event down later (for example,
purchasebyplan).
purchase with { plan: 'pro' } and { plan: 'free' } stay one event you can compare.
When is window.tinyanalytics available?
The tracking script loads withdefer, so window.tinyanalytics becomes available after the page’s HTML has parsed. Calls made in response to user actions — clicks, form submits, route changes — are always safe, because they happen well after load.
If you need to send an event very early in the page (before the script has run), guard the call:
How do I track 404 pages?
Send a custom event from your not-found route. A “page not found” screen rendered by your app still returns a normal page, so the tracking script can’t detect it on its own:not_found event down by its path property.
Verify it’s working
1
Trigger the event
Do the action in your browser — sign up, click the button, or load the page that fires the event.
2
Check the Events report
Open your site’s Events report in tinyanalytics. Your event appears by name within a few seconds, with its properties available for breakdowns.
Your custom event is working when it appears by name in the Events report within a few seconds of you triggering it, with its properties available for breakdowns.
Frequently asked questions
Why isn't my tinyanalytics custom event showing up?
Why isn't my tinyanalytics custom event showing up?
Two causes account for most cases. First, the event name can’t be empty — tinyanalytics rejects an empty name. Second, the call must run after the tracking script has loaded; if you call
event() very early in the page, guard it with if (window.tinyanalytics).Should variable data go in the event name or in the properties?
Should variable data go in the event name or in the properties?
Put it in the properties. Pick a small set of stable event names and reuse them, so
purchase with { plan: 'pro' } and { plan: 'free' } stay one event you can compare. Encoding the variable part into the name splits it into separate events instead.Related
Identify users
Attach a user ID so events are tied to a person.
Configure the script
Turn auto-capture on or off, and tag events.
Verify your setup
Confirm events are arriving.
How tinyanalytics works
Where events go after you send them.