Skip to content

Autocapture: frustration signals for React Native - #447

Draft
rahul-mixpanel wants to merge 11 commits into
feat/autocapturefrom
rahulraveendran-sdk-29-mobile-sr-frustration-signals-react-native
Draft

Autocapture: frustration signals for React Native#447
rahul-mixpanel wants to merge 11 commits into
feat/autocapturefrom
rahulraveendran-sdk-29-mobile-sr-frustration-signals-react-native

Conversation

@rahul-mixpanel

Copy link
Copy Markdown
Contributor

Summary

  • Bridge autocapture options (click, rageClick, deadClick, walkUpToClickableParent) from JS to native iOS/Android SDKs
  • Expose trackClick, trackRageClick, trackDeadClick APIs on Autocapture class as pure JS (no native bridge round-trips)
  • Refactor trackScreenView and trackScreenLeave to pure JS as well
  • Make walkUpToClickableParent configurable (default true) at the AutocaptureOptions level
  • Add @example JSDoc blocks to all public autocapture APIs
  • Add TypeScript definitions for ClickEventData, AutocaptureOptions, and Autocapture class

Test plan

  • Verify autocapture initialization with all option combinations (click/rageClick/deadClick enabled/disabled, boolean and object forms)
  • Verify trackClick, trackRageClick, trackDeadClick send correct event names and properties
  • Verify walkUpToClickableParent is passed through to native SDKs
  • Verify trackScreenView and trackScreenLeave work as pure JS
  • Verify TypeScript types match runtime behavior

🤖 Generated with Claude Code

rahul-mixpanel and others added 7 commits July 30, 2026 14:52
Update the React Native bridge to accept autocaptureOptions during
initialization and pass them to both iOS and Android native SDKs.
Enables walkUpToClickableParent(true) so native autocapture correctly
resolves $el_id from accessibilityLabel on React Native view wrappers
instead of leaf text views.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ions level

Update the bridge to set walkUpToClickableParent on AutocaptureOptions
instead of ClickOptions, matching the native SDK refactor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Read default values from RageClickOptions() and DeadClickOptions()
instances instead of hardcoding 4, 1000, 44, 500. This ensures the
bridge automatically picks up any default changes in the native SDK.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…APIs

Add public methods for developers to manually track click, rage click,
and dead click events with full element metadata (ClickEventData).
This enables custom frustration signal detection in cases where the
SDK's automatic detection cannot cover.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ocapture methods

Move trackScreenView, trackScreenLeave, trackClick, trackRageClick,
and trackDeadClick to pure JS implementations that call track()
directly with the correct event names and property mappings. This
eliminates 5 native bridge methods on each platform (Android + iOS)
and their ObjC declarations, since none of these methods require
native view access.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Expose walkUpToClickableParent as a top-level AutocaptureOptions field
(default true) instead of hardcoding it in the native bridge. Developers
can now disable it if their React Native app has proper accessibility
identifiers on leaf views.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add missing documentation examples for trackScreenView, trackScreenLeave,
trackClick, trackRageClick, trackDeadClick, and autocapture init options
including walkUpToClickableParent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jul 31, 2026

Copy link
Copy Markdown

SDK-29

@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

The PR is not yet safe to merge because clean Android builds still cannot resolve the locally published beta dependency.

The previously reported dependency issue remains: the Android module requires mixpanel-android:9.0.0-beta, while the accompanying build configuration expects that artifact to have been manually published to Maven Local.

Files Needing Attention: android/build.gradle

Important Files Changed

Filename Overview
index.js Normalizes autocapture configuration and adds pure-JavaScript frustration-signal and screen tracking.
index.d.ts Defines the new autocapture options, click-event payload, and public tracking methods.
android/src/main/java/com/mixpanel/reactnative/MixpanelReactNativeModule.java Converts bridged configuration into Android native autocapture options.
ios/MixpanelReactNative.swift Converts bridged configuration into iOS native autocapture options.
android/build.gradle Selects the Android SDK beta through Maven Local.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  JS[React Native configuration] --> N[Normalize autocapture options]
  N --> A[Android native options]
  N --> I[iOS native options]
  API[Autocapture tracking APIs] --> T[Standard Mixpanel event tracking]
Loading

Reviews (5): Last reviewed commit: "Merge branch 'feat/autocapture' into rah..." | Re-trigger Greptile

Comment thread android/build.gradle
implementation 'com.facebook.react:react-native:+'
implementation 'com.mixpanel.android:mixpanel-android:8.9.0'
// Local mixpanel-android with autocapture support (publish locally with: ./gradlew :analytics:publishToMavenLocal -x signReleasePublication)
implementation 'com.mixpanel.android:mixpanel-android:9.0.0-beta'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Android dependency is locally scoped

When a consumer or clean CI environment builds this package without first publishing mixpanel-android:9.0.0-beta to Maven Local, Gradle cannot resolve the new implementation dependency, causing the Android application build to fail.

rahul-mixpanel and others added 4 commits August 3, 2026 12:03
…test screen

Remove walkUpToClickableParent from AutocaptureOptions — it is now always-on
in the native SDKs. Add WalkUpTestScreen to MixpanelStarter sample app.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…idden by clickable parent

Walk-up always takes the nearest clickable ancestor's identity, even when
the leaf has its own accessibilityLabel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…havior

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@tylerjroach tylerjroach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good so far

s.dependency "React-Core"
s.dependency "Mixpanel-swift", '6.5.0'
# Local mixpanel-swift with autocapture support
s.dependency "Mixpanel-swift", '~> 6.5'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is local but we could miss this considering the actual release is 6.5.0 and the local testing is 6.5. Lets be careful with making sure we change to correct value.

}
}

@ReactMethod

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these 2 methods removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants