How to Set Up Mixpanel Autocapture

“Can’t we just turn on autocapture and skip the tracking plan?”

I get asked this a lot, especially by startups who want data now. My honest answer: autocapture is a brilliant starting point and a poor finishing point. It gets you clicks, page views, form submits and frustration signals within minutes. It won’t tell you that the click was a successful purchase, how much it was worth, or which plan the user picked.

Used together with a small set of deliberate events, though, it’s one of the most useful features Mixpanel has added in years.

This guide covers how to turn on Mixpanel Autocapture, what it collects, how to configure it safely, and how to combine it with custom events.

What Autocapture is

Autocapture is a JavaScript SDK feature that automatically tracks common interactions without you writing a track() call for each one. Mixpanel’s docs say it’s available from JavaScript SDK version 2.60.0 onward.

Autocaptured events appear in Mixpanel with an [Auto] label, such as “[Auto] Page View” and “[Auto] Element Click”, so they’re easy to tell apart from your own events.

Step 1: Check your SDK version

If you install via npm, check mixpanel-browser in your package.json. If you use the snippet, it loads the latest library from Mixpanel’s CDN. If you use GTM, make sure your Mixpanel template is up to date (post 22).

Step 2: Turn it on

The simplest setup is one option at initialization:

mixpanel.init('YOUR_PROJECT_TOKEN', {
  autocapture: true
});

In GTM, the Mixpanel template has an autocapture toggle in the init tag; for custom settings, pass a configuration object through a Custom JavaScript Variable, as Mixpanel’s GTM docs describe.

What gets captured by default

Mixpanel documents the default configuration as roughly equivalent to this:

mixpanel.init('YOUR_PROJECT_TOKEN', {
  autocapture: {
    pageview: 'full-url',
    click: true,
    dead_click: true,
    input: true,
    rage_click: true,
    scroll: true,
    submit: true,
    capture_text_content: false
  }
});

In plain terms:

SettingWhat it tracksDefault
pageviewPage views when parts of the URL change, including UTMsfull-url
clickElement clicks (no text content unless enabled)on
dead_clickClicks on interactive elements that get no responseon
rage_clickRepeated rapid clicks in the same spoton
inputThat an input was provided, not what was typedon
scrollScroll depth at checkpoints (25/50/75/100% by default)on
submitForm submissions, not their contenton
capture_text_contentThe visible text of clicked elementsoff

Autocapture events also carry useful default properties, such as the DOM event type and the host where the event happened, plus details about the element clicked.

Frustration signals: dead clicks and rage clicks

These two are the hidden gems.

  • A dead click is a click on an interactive element that gets no response. Mixpanel’s docs say the default threshold is no response within half a second.
  • A rage click is several rapid clicks in the same spot. Mixpanel’s default is four clicks within a second, within about 30 pixels of each other.

They’re tracked as “[Auto] Dead Click” and “[Auto] Rage Click”. Combined with Session Replay (post 12), they point you straight at broken buttons and confusing UI.

Step 3: Configure it for your site

The defaults are sensible, but I always tune a few things.

Exclude sensitive pages

Use block_url_regexes to turn autocapture off on pages like login or payment:

mixpanel.init('YOUR_PROJECT_TOKEN', {
  autocapture: {
    block_url_regexes: [/\/login\/?$/, /\/payment\/?$/]
  }
});

There’s also allow_url_regexes if you’d rather opt specific pages in.

Exclude sensitive elements

You have three options:

  • Add the built-in mp-no-track class to elements you don’t want tracked.
  • Use mp-sensitive to keep an element out of all tracking, including the element details attached to other events.
  • Use block_selectors in the config to block classes or elements by CSS selector, or allow_selectors to opt specific ones in.

For finer control, allow_element_callback and block_element_callback let you write a function that decides element by element.

Make clicks meaningful with extra attributes

This is my favorite trick. Ask developers to add descriptive data attributes to important buttons:

<button data-cta-name="start_trial" data-cta-position="hero">Start free trial</button>

Then tell autocapture to collect them:

autocapture: {
  capture_extra_attrs: ['data-cta-name', 'data-cta-position']
}

Now every “[Auto] Element Click” on that button carries data-cta-name = start_trial, which is far easier to analyze than CSS classes that change with every redesign.

Tune scroll tracking

Change scroll_depth_percent_checkpoints if 25/50/75/100 doesn’t suit your pages. Avoid scroll_capture_all unless you really need it; it generates a lot of events.

Text content

capture_text_content is off by default for good reason: button and link text can contain personal information on some sites (“Hi, Sarah”). Turn it on only after checking your pages, and combine it with mp-sensitive on anything personal.

Single-page apps

The pageview option controls when page views fire as URLs change. If you also set track_pageview or fire page views manually, make sure you don’t double-count.

Step 4: Turn clicks into insights

Autocaptured clicks become really useful when you give them names.

  1. Build an Insights report on [Auto] Element Click.
  2. Filter by your extra attribute (data-cta-name = start_trial) or by element properties.
  3. Save it as a custom event called something like start_trial_clicked (post 16).

You now have a named, reusable event without a code deploy.

📸 Screenshot to add: An Insights report on [Auto] Element Click broken down by data-cta-name.

Autocapture vs deliberate tracking

Here’s how I split the work for clients:

Use autocapture forUse custom events for
Page views and scroll depthSignup, login, purchase, subscription
Clicks on CTAs and navigationAnything with business values (revenue, plan, quantity)
Form submits as a rough signalSuccess states that happen after an API response
Dead clicks and rage clicksServer-side events and backend actions
Discovery: “what are people clicking?”Identity: identify(), reset(), profile properties

The big limitation: a form submit is not the same as a successful signup. Autocapture sees the click; it doesn’t know whether the server accepted the data. Your most important events should always be explicit.

Step 5: Watch volume and cost

Autocapture can generate a lot of events, and event volume affects Mixpanel pricing. After a week, check event counts in Lexicon. If scroll or input events dominate, tune or disable them. To turn autocapture off entirely, set autocapture: false.

Mistakes to avoid

  • Using autocapture instead of a tracking plan for key conversions.
  • Turning on text capture without checking for personal data.
  • Not blocking login and payment pages.
  • Analyzing clicks by CSS class, which breaks on redesign. Use data attributes.
  • Ignoring event volume.

Final thoughts

Autocapture gives you a wide, shallow view of behavior with almost no effort. Pair it with a small set of deep, deliberate events and you get the best of both: discovery and reliable metrics.

Sources