SDK Configuration
Auto capture is off by default. Auto capture behavior is configured through theoptions object passed to userpilot.setup.
When either
enableScreenAutoCapture or enableInteractionAutoCapture is enabled, the DOM auto capture engine starts automatically after setup. The configuration is read once from setup; use Runtime Controls to pause or resume afterwards.
Screen Capture
WhenenableScreenAutoCapture is true, the plugin patches history.pushState / history.replaceState and listens for popstate and hashchange. The screen name is resolved with the following priority:
- Hash route (for example
#/settings→/settings). File-based Cordova apps keep a constant, noisypathname, so a meaningful hash route is preferred. This covers hash-based SPA routers. location.pathname + location.search(for history-routed apps), reported as-is — a bare/is a valid screen name and is kept.
document.title or any other substitute. If the URL resolves to an empty string, no screen event is emitted. Consecutive identical names are de-duplicated.
Debounced text_change events are flushed before a screen transition is published — on both automatic route changes and manual userpilot.screen(...) calls — so a field edited just before navigating is still attributed to the screen it was typed on.
Interaction Capture
WhenenableInteractionAutoCapture is true, the plugin captures DOM interactions through delegated capture-phase listeners on document for click, change, input, and submit, plus a MutationObserver for dialog presentation. Events that originate inside a web component’s shadow DOM are resolved to the real host element.
Each interaction is classified into a raw_interaction_type based on the element’s tag, type, and ARIA role:
Each interaction maps to a high-level analytics category (
tap, text_change, selection_change, value_change, view_presented) — that is the event name that reaches your analytics backend.
Rapid duplicate interactions on the same element are suppressed with a short de-dupe window (~500 ms).
Component Value Gating
By default, user-input values are stripped from event payloads —is_checked, selected dates and times, slider values, and dropdown selections do not leave the device. To include them, pass enableInteractionValueCapture: true in setup options. Position and configuration fields such as selected_index and slider min/max are always captured because they don’t reveal user input; selected_value is only included when value capture is enabled.
Privacy Controls
Global flags govern what is captured:- Text capture —
enableInteractionTextCapture - Accessibility label capture —
enableInteractionAccessibilityLabelCapture - Value payload capture —
enableInteractionValueCapture
target_text from the payload. Redaction replaces an existing text/title with ****; when no text exists, the property is omitted. Redaction is scoped to target_text. It does not mask accessibility_label — accessibility labels are developer-authored, so they are controlled only by enableInteractionAccessibilityLabelCapture.
Auto capture never sends typed input values verbatim — only the field’s label plus has_text / text_length.
userpilotRedactText
Redaction replaces the captured target_text with ****. The interaction event still fires — the element is still identified by type, position, and structure — only the human-readable text is masked. Accessibility labels are not masked by redaction; they are controlled only by enableInteractionAccessibilityLabelCapture.
The programmatic API accepts either an Element or a CSS selector and applies to the element and its subtree. A selector is resolved when the call is made, so call it once the target elements are in the DOM:
userpilotIgnoreInteractions
Ignoring skips interaction events whose hit-tested element lies inside the subtree (taps, value changes, text-field updates, etc.). Route-driven screen events are not suppressed — they come from route detection, not from element hit testing. The host app’s own handlers still run — only auto capture ignores those interactions.
The programmatic API accepts either an Element or a CSS selector and applies to the element and its subtree:
Runtime Controls
Auto capture starts automatically fromsetup (based on options). To stop or resume collection at runtime without re-passing the config — for example a “private mode” — use:
screen() calls: when enableScreenAutoCapture is configured, manual and automatic screen tracking remain mutually exclusive, including while auto capture is stopped.
Limitations
- WebView only. Auto capture observes the DOM rendered in the Cordova WebView. Anything rendered outside the WebView (fully native screens or plugins with their own UI) is not captured by this engine.
- Custom widgets need semantic markup. Elements that handle interactions without using standard tags or ARIA roles (for example a clickable
<div>with noroleand no handler attribute) are not classified. Use the supported building blocks in the interaction table — or add the appropriaterole— to be captured. - Typed input values are never captured. For text fields,
target_textis the field’s label and onlyhas_text/text_lengthdescribe the content; the value itself is never sent. - Text fields need a label to report one.
target_textis resolved fromaria-labelledby, an associated/wrapping<label>, or alabelattribute. A placeholder is deliberately not used as a label — it is reported separately asplaceholder. - One screen source at a time. Manual
screen(...)is suppressed wheneverenableScreenAutoCaptureis configured, including while auto capture is stopped.