Skip to main content
Send a custom event to measure an action that matters to your product — a signup, a purchase, a plan upgrade. You call 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 signup or purchase. An empty name is rejected.
  • Properties — an optional object of key/value pairs. Use them to break the event down later (for example, purchase by plan).
Pick a small set of event names and reuse them. Put the things that vary into properties rather than encoding them in the name, so purchase with { plan: 'pro' } and { plan: 'free' } stay one event you can compare.

When is window.tinyanalytics available?

The tracking script loads with defer, 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:
You then see which missing URLs your visitors hit by breaking the 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

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).
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.
No. tinyanalytics already captures outbound links, downloads, button clicks, copies, and form submissions automatically. Use window.tinyanalytics.event() for actions specific to your app that auto-capture can’t infer, such as a signup or a plan upgrade.

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.