# Autocapture

Autocapture records page views, clicks, scrolls and form submits from one SDK snippet. How it works, what it must never record, and which tools offer it.

Source: https://pug.sh/glossary/autocapture

Autocapture is a method of collecting product-analytics events automatically (page views, clicks, scrolls, and form submissions) from a single SDK snippet, without defining each event in code beforehand.

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

A live feed: page_view, click, rage_click, scroll and form_submit arrive with no tracking code; order_completed comes from a track() call.

## How autocapture works

An autocapture SDK (also written auto-capture, or called automatic event tracking) attaches a few listeners to the whole page instead of a tracking call to every button. Pug’s Web SDK, for example, listens on `window` for `click`, `input`, `submit` and `scroll`, and wraps `history.pushState` so a route change in a single-page app counts as a page view. When one fires, the SDK reads what the element shows about itself (its tag, `id`, `class` and own text), adds the page URL, referrer and UTM parameters, queues the event and sends it in a batch. The server adds country, city, device and browser on ingest.

## Autocapture vs manual event tracking

Manual (or “explicit”) tracking means calling a function like `track('order_completed')` for each event you care about. It’s precise and well-named, but slow to set up and easy to forget. Autocapture gives you behavioral data the moment the SDK is installed, including interactions no tracking plan would have predicted. The trade-off is that raw captured events are noisier than curated business events.

On data quality, each one fails in its own way. Autocaptured events are keyed to the page: an element’s text, its id, class or selector, and the URL. Rename a button or restructure a page and a metric built on the old ones quietly splits in two. Manual events stay stable for as long as the code does, but they only cover what someone remembered to instrument, and their names drift (`signup`, `sign_up`, `SignUp`) unless a [naming convention](https://pug.sh/tools/event-naming-linter) is enforced. Most teams run both: autocapture for the long tail, plus a handful of named events for key conversions.

## Frustration signals

Richer autocapture also records **rage clicks** (rapid repeated clicks on one spot) and **dead clicks** (clicks that change nothing), early signs that a UI is confusing or broken. The thresholds differ: Pug counts four clicks within a second inside 40 pixels, Mixpanel four within a second inside 30 pixels ([Mixpanel autocapture docs](https://docs.mixpanel.com/docs/tracking-methods/autocapture)), and PostHog three, each within 30 pixels and a second of the last ([PostHog autocapture docs](https://posthog.com/docs/product-analytics/autocapture)). Pug calls a click dead when, half a second later, the URL, the page’s DOM and the text selection are all unchanged.

## Example: what autocapture records

Install Pug’s Web SDK on a store and one visit to a product page sends this, with no tracking code written:

- `page_view`: `/products/blue-runner`, with the referrer and page title
- `click`: tag `BUTTON`, class `add-to-cart`, text “Add to cart”
- `rage_click`: four clicks in a second on an “Apply coupon” button that does nothing
- `form_start` and `form_submit`: form id `checkout`, the submit’s action URL, and nothing typed into the form

You never planned the `rage_click`, but it’s the signal that the coupon field is broken.

## What autocapture should never record

An autocapture SDK sees every field on the page, so the rule that matters most is that it never sends what a person typed: no input values, no passwords, nothing from a text area or a rich-text editor. Mixpanel and Amplitude exclude user-entered text by default ([Mixpanel autocapture docs](https://docs.mixpanel.com/docs/tracking-methods/autocapture), [Amplitude autocapture docs](https://amplitude.com/docs/data/autocapture)), Heap doesn’t capture the contents of input fields ([Heap web SDK docs](https://developers.heap.io/docs/web)), and PostHog leaves form values out of submissions ([PostHog autocapture docs](https://posthog.com/docs/product-analytics/autocapture)). What’s left is text the page displays, like a button that shows an email address.

Pug’s Web SDK sends a form as two events: `form_start` the first time a field in it changes and `form_submit` when it’s sent. Both carry the form’s `id` and `name`, and the submit its `action` URL; no field names and no values. A click sends the element’s own text, up to 50 characters, never the text of elements nested inside it and nothing from a `<textarea>` or `contenteditable` region. Query parameters such as `token`, `email` and `password` in a URL are replaced with `redacted` before anything is sent. Add `data-pug-no-capture` to blank an element’s text and everything inside it. Before you ship, check your event properties for [personally identifiable information](https://pug.sh/glossary/pii) with the [PII event auditor](https://pug.sh/tools/pii-event-auditor).

## Which analytics tools have autocapture

Autocapture started as Heap’s signature and is now common in product analytics. On the web, tools differ in what they record and in whether it runs before you change a setting. We build Pug, so it is listed first.

| Tool               | Records on the web                                                                                                                                                                               | On by default                                                            | Source                                                                                                                                                                                                                           |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Pug                | `page_view`, `click`, `scroll`, `form_submit`, `rage_click`, `dead_click`                                                                                                                        | Yes, after `init()`                                                      | [Pug Web SDK reference](https://docs.pug.sh/sdks/web/)                                                                                                                                                                           |
| Heap               | Page views, clicks, form submits and field changes. An event you define later counts back to the day you installed Heap.                                                                         | Yes, from install                                                        | [Heap web SDK docs](https://developers.heap.io/docs/web), [Heap’s autocapture post](https://www.heap.io/blog/how-autocapture-actually-works)                                                                                     |
| PostHog            | Page views and page leaves, clicks on links, buttons and form fields, form submissions and changes, rage clicks. Dead clicks are a project setting.                                              | Yes                                                                      | [PostHog autocapture docs](https://posthog.com/docs/product-analytics/autocapture)                                                                                                                                               |
| Amplitude          | Page views, sessions, form starts and submits, file downloads, campaign attribution. Element clicks, rage and dead clicks, failed network requests and web vitals come with `autocapture: true`. | The first set only; settings saved in Amplitude can override the snippet | [Amplitude Browser SDK 2 docs](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2/instrument-and-configure)                                                                                                         |
| Mixpanel           | Page views, scrolls, form interactions, clicks and changes on elements, attribution, rage and dead clicks                                                                                        | No, off until you add `autocapture: true`                                | [Mixpanel autocapture docs](https://docs.mixpanel.com/docs/tracking-methods/autocapture)                                                                                                                                         |
| Google Analytics 4 | `page_view`. Enhanced measurement adds scrolls to 90% depth, outbound link clicks, site search, video engagement, file downloads, `form_start` and `form_submit`, but not other clicks.          | Page views always; the rest is one switch per web data stream            | [GA4 enhanced measurement help](https://support.google.com/analytics/answer/9216061)                                                                                                                                             |
| Plausible          | Pageviews, outbound link clicks, file downloads and form submissions. Other clicks are events you tag.                                                                                           | Yes, on a new site                                                       | [Plausible outbound links](https://plausible.io/docs/outbound-link-click-tracking), [file downloads](https://plausible.io/docs/file-downloads-tracking), [form submissions](https://plausible.io/docs/form-submissions-tracking) |
| Umami              | Page views. Any other event is a `data-umami-event` attribute or a `umami.track()` call.                                                                                                         | Page views only                                                          | [Umami event docs](https://docs.umami.is/docs/track-events)                                                                                                                                                                      |

*From each vendor’s own docs, checked November 21, 2026. The last column links the source.*

For how these tools compare beyond autocapture, see the [best product analytics tools](https://pug.sh/learn/best-product-analytics-tools) roundup.

## Autocapture in mobile apps

Click-level autocapture is web-only in Pug: the Android, iOS and Flutter SDKs record no taps. What they send on their own after init is the app’s lifecycle and its screens:

| Event         | Android                                       | iOS                                              | Flutter                                           |
| ------------- | --------------------------------------------- | ------------------------------------------------ | ------------------------------------------------- |
| `app_open`    | the app comes to the foreground               | the app comes to the foreground                  | the app comes to the foreground                   |
| `app_close`   | the app leaves the foreground                 | the app goes to the background                   | the app goes to the background                    |
| `screen_view` | each activity shown, named by its class       | each view controller, and SwiftUI views you name | each route change, once PugRouteObserver is added |
| `app_install` | the first launch, with the store it came from | the first launch, with App Store or TestFlight   | the first launch on a device                      |
| `app_update`  | the first launch of a new version             | the first launch of a new version                | the first launch of a new version                 |

*On iOS, a SwiftUI view is named with `.pugScreen`.*

Other tools draw the line elsewhere. PostHog’s Android and iOS SDKs record screen views and lifecycle events by default; taps are opt-in on iOS and React Native and unsupported on Android and in Flutter apps ([PostHog autocapture docs](https://posthog.com/docs/product-analytics/autocapture)). Mixpanel’s Android, iOS, React Native and Flutter SDKs capture screen views, clicks, dead clicks and rage clicks, but screen views need a hook into your navigation and clicks stay off until you turn them on ([Mixpanel autocapture docs](https://docs.mixpanel.com/docs/tracking-methods/autocapture)). Amplitude’s iOS and Android SDKs send session events by default; lifecycle events, screen views and taps are options you add ([Amplitude iOS docs](https://amplitude.com/docs/sdks/analytics/ios/ios-swift-sdk/instrument-and-configure), [Amplitude Android docs](https://amplitude.com/docs/sdks/analytics/android/android-kotlin-sdk/instrument-and-configure)). Heap records interactions and screen changes once you add its separate autocapture package ([Heap iOS docs](https://developers.heap.io/docs/ios), [Heap Android docs](https://developers.heap.io/docs/android)). Pug’s setup is in the [Android guide](https://pug.sh/integrations/android), [iOS guide](https://pug.sh/integrations/ios) and [Flutter guide](https://pug.sh/integrations/flutter).

## How Pug does autocapture

Every Web SDK tracker runs after one `init()`; to keep fewer, the `autoCapture` option takes an allowlist. Capture starts cookieless: events flow, but nothing is stored on the device until a visitor consents, so `identify()` does nothing before then. Autocaptured events land in [trends, funnels, retention and user flows](https://pug.sh/analytics) beside the events you name with `track()`. Every option is in the [Pug Web SDK reference](https://docs.pug.sh/sdks/web/).

- [Event tracking](https://pug.sh/glossary/event-tracking)
- [PII](https://pug.sh/glossary/pii)
- [Funnel analysis](https://pug.sh/glossary/funnel-analysis)

## Autocapture: common questions

### Is autocapture better than manual event tracking?

Neither is strictly better. Autocapture covers interactions you didn’t plan for and gives you data from the day you install it; manual tracking gives precise, well-named business events. Most teams run both: autocapture for breadth, a few custom events for the moments that matter.

### Does autocapture slow down my site?

The cost is a few listeners and a request every few seconds. Pug’s Web SDK listens once on the window rather than on each element, sends at most one scroll event every two seconds, and batches events into requests of up to 10, at least every 5 seconds.

### What does autocapture record?

On the web: page views, clicks (the element’s tag, id, class and visible text), scroll depth, and form starts and submits, and in many tools rage clicks and dead clicks. In mobile apps it usually means app opens, installs, updates and screen views, with taps an opt-in where a tool supports them. It should never record what a person typed into a field.

### Which tools turn autocapture on by default?

Heap captures from install, and so does PostHog’s web SDK. Plausible tracks outbound links, file downloads and form submissions on a new site. Amplitude’s Browser SDK turns on page views, sessions, forms and file downloads, but element clicks need autocapture: true. Mixpanel’s autocapture stays off until you add autocapture: true. GA4 always records page views, and enhanced measurement adds the rest with one switch. Pug’s Web SDK captures page views, clicks, scrolls, forms, rage clicks and dead clicks after init().
