In web analytics, events are atomic records of user interactions that aren’t limited to page loads. An event logs that “something happened,” when it happened, and optional context about the thing. Typical examples: button click, video play, file download, form submit, scroll depth, or an in-app purchase. Unlike a pageview, events can represent any meaningful touchpoint within or beyond a page.
Why events matter
Events let you measure micro-interactions that lead up to outcomes. They connect user intent to results, helping you build better funnels, diagnose UX issues, and attribute value. Events roll up naturally into sessions and users (unique visitor), and specific events often define a conversion.
Event structure (minimal schema)
An event typically includes:
event_name
– canonical action (e.g.,signup_submit
)timestamp
– when it happened (UTC)user_id
/device_id
– who did itsession_id
– which sessionparameters
(a.k.a. properties) – contextual key–value pairs
Tiny example table
event_name | parameters (key → value) | scope |
---|---|---|
cta_click | button_text → "Start free trial" | per event |
video_play | video_id → "hero-intro", position → 0 | per event |
form_submit | form_id → "lead-gen", valid → true | per event |
purchase | order_id → 8452, revenue → 39.00, currency | per event |
Quick metrics
- Event Count: total number of a given event.
- Event Rate: how often an event occurs relative to traffic.
Formula:Event Rate = (Event Count / Sessions) × 100%
Example: 2,400 cta_click
over 30,000 sessions → 8%
.
Implementation notes (battle-tested)
- Use a strict naming convention: verb_object (
add_to_cart
,newsletter_subscribe
). - Keep parameters stable and typed (string, int, boolean). Avoid free-text where possible.
- Ensure idempotency (don’t double-fire on SPA route changes or retries).
- Add client + server events for critical actions (e.g., purchase) and reconcile with attribution and cohort analysis.
- Sample only noncritical events; never sample conversions.
When to choose events vs pageviews
Use events for actions within a page or app state changes; use pageviews for navigations. For modern SPAs, simulate pageviews as events with a dedicated page_view
name, but keep the semantics clear.