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 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), and PostHog three, each within 30 pixels and a second of the last (PostHog autocapture docs). 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 titleclick: tagBUTTON, classadd-to-cart, text “Add to cart”rage_click: four clicks in a second on an “Apply coupon” button that does nothingform_startandform_submit: form idcheckout, 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, Amplitude autocapture docs), Heap doesn’t capture the contents of input fields (Heap web SDK docs), and PostHog leaves form values out of submissions (PostHog autocapture docs). 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 with the
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 |
| 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, Heap’s autocapture post |
| 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 |
| 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 |
| 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 |
| 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 |
| Plausible | Pageviews, outbound link clicks, file downloads and form submissions. Other clicks are events you tag. | Yes, on a new site | Plausible outbound links, file downloads, form submissions |
| Umami | Page views. Any other event is a data-umami-event attribute or a umami.track() call. | Page views only | Umami event docs |
For how these tools compare beyond autocapture, see the 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 |
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). 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). Amplitude’s iOS and Android SDKs send session events by default; lifecycle events, screen views and taps are options you add (Amplitude iOS docs, Amplitude Android docs). Heap records interactions and screen changes once you add its separate autocapture package (Heap iOS docs, Heap Android docs). Pug’s setup is in the Android guide, iOS guide and Flutter guide.
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 beside the events you name with
track(). Every option is in the Pug Web SDK reference.