# Event tracking

Event tracking records what people do in your product (clicks, signups, purchases) as named events with properties, so you analyze behavior instead of page traffic.

Source: https://pug.sh/glossary/event-tracking

Event tracking is the practice of recording the specific actions people take in your product (a page view, a button click, a signup, a purchase) as discrete events, each with a name and properties, so you can analyze behavior rather than page traffic alone.

*Live event stream: events appearing seconds after they happen, with page, value, and location context*

A live feed of tracked events arriving: page views, clicks, and signups, each with its own name and properties.

## What an event is

An event is a record that *something happened*: a name (what), a person or anonymous visitor (who), a timestamp (when), and a set of **properties** (the details). `purchase` with `amount`, `currency`, and `productId` tells you far more than a raw page view ever could. Collect events consistently and every behavioral question (what do people do before they convert, who comes back, where do they drop off) becomes answerable.

## Why events beat page views

Classic web analytics counts page views and sessions. That’s fine for traffic, but most products care about *actions*, and many of the actions that matter (clicking a feature, completing a step, hitting an error) aren’t page loads at all. Event tracking captures those actions directly, which is what makes [funnels](https://pug.sh/glossary/funnel-analysis), [retention cohorts](https://pug.sh/glossary/retention-cohort), and per-person timelines possible. See [product analytics vs web analytics](https://pug.sh/learn/product-analytics-vs-web-analytics) for the fuller distinction.

## Autocapture and manual tracking

There are two ways to collect events, and the best setups use both. **Autocapture** records common interactions automatically the moment the SDK is installed, with no per-button code. **Manual tracking** means calling `track('order_completed', { ... })` for the events unique to your product. Standardizing those names pays off downstream; see [well-known events](https://pug.sh/blog/well-known-events) for why.

## Identity ties events to people

On its own, an event belongs to an anonymous visitor. When you call `identify()`, the anonymous history merges into a single person, so every event before and after sign-in reads as one timeline across devices. That’s [identity resolution](https://pug.sh/glossary/identity-resolution), and it’s what turns a stream of events into a [unified customer profile](https://pug.sh/glossary/unified-customer-profile).

## A worked example

Compare what each model lets you ask. A page view of `/checkout/success` tells you a sale happened. A tracked event tells you *what*:

```
track('purchase', { amount: 49, currency: 'USD', plan: 'pro', coupon: 'LAUNCH' })
```

Now “revenue by plan this month”, “coupon redemption rate”, and “average order value by source” are each one query away, because the detail lives in the event’s properties.

## How Pug does event tracking

Pug autocaptures page views, clicks, scrolls, and form submits (plus rage and dead clicks) after one `init()`, and you add named events with `track()`. Well-known events get typed, validated properties. Every event is enriched with geo, device, and UTM on ingest, then flows into [trends, funnels, retention, and user flows](https://pug.sh/analytics). Plan your events first with the free [tracking-plan generator](https://pug.sh/tools/event-tracking-plan-generator). See the [SDKs](https://pug.sh/sdks) to start.

- [Autocapture](https://pug.sh/glossary/autocapture)
- [Conversion rate](https://pug.sh/glossary/conversion-rate)
- [Unified customer profile](https://pug.sh/glossary/unified-customer-profile)

## Event tracking: common questions

### What is event tracking?

Event tracking is recording the discrete actions people take in your product (a page view, a click, a signup, a purchase) as named events with properties. Instead of only counting page traffic, you capture what users did, so you can analyze behavior.

### What is the difference between event tracking and page tracking?

Page tracking counts page views: useful for traffic, blind to behavior. Event tracking records specific actions (added_to_cart, signup, video_played) with context, so you can build funnels, retention, and per-person timelines. A page view is one kind of event among many.

### What is an event property?

A property is a key-value detail attached to an event: a purchase might carry amount, currency, and productId. Properties are what you filter and break down by later, so consistent names and types matter as much as the event name itself.

### Do I have to code every event by hand?

No. Autocapture records common interactions (page views, clicks, scrolls, form submits) automatically from one SDK snippet, and you add named custom events with track() for the moments that matter. Most teams use both.
