Event tracking

Event tracking records what visitors do on a page beyond loading it: submitting a form, clicking a button, starting a checkout or downloading a file. Each action is sent to analytics as a named event, optionally with properties such as plan=pro. Events turn a pageview count into a picture of what people actually did.

By the Onfus teamUpdated 17 November 2026

Event tracking

Definition
Recording actions on a website beyond pageviews, such as signups, button clicks or downloads.

How does event tracking work?

Your site calls a small JavaScript function when something happens, or marks an element with an attribute that the analytics script listens to. The script sends the event name, the page and any properties to the analytics server, where it's counted alongside pageviews.

Pageview
Sent whenA page loads or the route changes
Example/pricing
Custom event
Sent whenYour code or an HTML attribute fires it
ExampleSignup with plan=pro
Automatic event
Sent whenThe script detects it once you switch it on
ExampleOutbound link click, file download

Pageviews, custom events and automatic events

Questions about event tracking.

Which events are worth tracking?

Track actions that sit between a visit and revenue: signup, trial started, checkout opened, contact form sent, demo booked. Tracking every click creates noise and, on event-priced plans, cost.

How does Onfus handle it?

Send an event with window.onfus('Signup', { props: { plan: 'pro' } }), or add data-onfus-event="Signup" to a button or form, with no JavaScript. Outbound link clicks (data-outbound-links) and file downloads (data-file-downloads) are opt-in. Every event counts toward the plan's monthly events, and properties are capped at 20 keys and 1 KB.

Do events count toward my Onfus plan?

Yes. Pageviews and custom events both count as events, pooled across your sites.

Can I track events without writing JavaScript?

Yes. Add data-onfus-event to a button (clicks) or a form (submits), and data-onfus-prop-* attributes for properties.

Know what to fix by tomorrow.

Paste one line and start tracking in a minute. See where visitors drop off and what to fix. Free for 14 days, no cookie banner.