Class: Autocapture

Autocapture()

Core class for using Mixpanel Autocapture features.

The Autocapture object is used to track screen views and screen leaves.

Constructor

new Autocapture()

Source:

Classes

Autocapture

Methods

trackClick(clickEvent, propertiesopt)

Track a click event with element metadata. Use this when your app implements its own click detection and you want to track click events with full element metadata in the Mixpanel autocapture format.
Parameters:
Name Type Attributes Description
clickEvent object The click event data.
Properties
Name Type Attributes Description
x number Touch X coordinate.
y number Touch Y coordinate.
elementId string Stable identifier for the tapped element.
tagName string <optional>
Class name or component type.
accessibleLabel string <optional>
Accessibility label.
role string <optional>
Semantic role (e.g., "button", "link").
elements string <optional>
View hierarchy path, ">" separated.
properties object <optional>
Optional additional properties.
Source:
Example
mixpanel.autocapture.trackClick({
  x: 150,
  y: 300,
  elementId: 'submit_button',
  tagName: 'Button',
  accessibleLabel: 'Submit Order',
  role: 'button',
  elements: 'Screen > Form > Button',
});

trackDeadClick(clickEvent, propertiesopt)

Track a dead click event with element metadata. Use this when your app implements its own dead click detection. A dead click indicates a user tapped an interactive element but no UI change occurred.
Parameters:
Name Type Attributes Description
clickEvent object The click event data (same shape as trackClick).
properties object <optional>
Optional additional properties.
Source:
Example
mixpanel.autocapture.trackDeadClick({
  x: 200,
  y: 400,
  elementId: 'disabled_link',
  tagName: 'Text',
  accessibleLabel: 'Learn More',
  role: 'link',
});

trackRageClick(clickEvent, propertiesopt)

Track a rage click event with element metadata. Use this when your app implements its own rage click detection. A rage click typically indicates a user rapidly tapping an unresponsive element.
Parameters:
Name Type Attributes Description
clickEvent object The click event data (same shape as trackClick).
properties object <optional>
Optional additional properties.
Source:
Example
mixpanel.autocapture.trackRageClick({
  x: 150,
  y: 300,
  elementId: 'checkout_button',
  tagName: 'Button',
  role: 'button',
});

trackScreenLeave(screenName, properties)

Track a screen leave event.
Parameters:
Name Type Description
screenName string The name of the screen being left. Must be non-empty; if an empty or whitespace-only string is passed, the event is silently dropped.
properties object Optional additional properties to include with the event
Source:
Example
mixpanel.autocapture.trackScreenLeave('HomeScreen');
mixpanel.autocapture.trackScreenLeave('ProductDetail', { time_spent_ms: 5000 });

trackScreenView(screenName, properties)

Track a screen view event.
Parameters:
Name Type Description
screenName string The name of the screen being viewed. Must be non-empty; if an empty or whitespace-only string is passed, the event is silently dropped.
properties object Optional additional properties to include with the event
Source:
Example
mixpanel.autocapture.trackScreenView('HomeScreen');
mixpanel.autocapture.trackScreenView('ProductDetail', { product_id: '123' });