Skip to content

Add EventTrackingBehavior for GDPR-compliant event control#422

Merged
ianrumac merged 1 commit into
developfrom
feature/event-tracking-behavior
Jul 1, 2026
Merged

Add EventTrackingBehavior for GDPR-compliant event control#422
ianrumac merged 1 commit into
developfrom
feature/event-tracking-behavior

Conversation

@yusuftor

@yusuftor yusuftor commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Changes in this pull request

Ports the iOS EventTrackingBehavior feature (Superwall-iOS #479) to Android.

Adds a three-way EventTrackingBehavior enum for controlling which events reach the Superwall servers, with both a configure-time option and a runtime setter:

  • EventTrackingBehavior enum: ALL (default), SUPERWALL_ONLY, NONE. Wire values ("all", "superwallOnly", "none") match iOS so the same web paywall handles them.
  • SuperwallOptions.eventTrackingBehavior — set the initial behavior when configuring.
  • Superwall.instance.eventTrackingBehavior — change it at runtime (e.g. after a GDPR consent flow). The setter updates the events queue, forwards the behavior to the paywall web view, and skips the config-attributes event when opting out to NONE.
  • Deprecates SuperwallOptions.isExternalDataCollectionEnabled — setting it to false maps to SUPERWALL_ONLY (preserving NONE); true maps to ALL. The getter reflects eventTrackingBehavior == ALL.
  • EventsQueue caches the behavior, clears its buffer when opting out, gates enqueues (SUPERWALL_ONLY suppresses trigger fires, attribute updates, and user-initiated tracking), and discards events on flush when set to NONE.
  • Web paywall is informed of the current behavior on webview load via an event_tracking_behavior message.
  • Config payload emits both the new event_tracking_behavior string and the legacy is_external_data_collection_enabled boolean (true only for ALL), so backends still reading the old field don't treat opted-out clients as the default.

Note: Android has no MMP install-attribution, so the "skip install match when opted out" part of the iOS change is not applicable here.

Checklist

  • All unit tests pass.
  • All UI tests pass.
  • Demo project builds and runs.
  • I added/updated tests or detailed why my change isn't tested.
  • I added an entry to the CHANGELOG.md for any breaking changes, enhancements, or bug fixes.
  • I have run ktlint in the main directory and fixed any issues.
  • I have updated the SDK documentation as well as the online docs.
  • I have reviewed the contributing guide

🤖 Generated with Claude Code

Introduces an `EventTrackingBehavior` enum (`ALL`, `SUPERWALL_ONLY`,
`NONE`) and a `SuperwallOptions.eventTrackingBehavior` property, plus a
runtime `Superwall.instance.eventTrackingBehavior` setter. Deprecates
`isExternalDataCollectionEnabled`, mapping `false` to `SUPERWALL_ONLY`
(preserving `NONE`) and `true` to `ALL`.

- EventsQueue caches the behavior, clears its buffer when opting out, and
  discards events on flush when set to `NONE`.
- The runtime setter updates the queue, forwards the behavior to the
  paywall web view, and skips the config-attributes event when opting
  out to `NONE`.
- The web paywall is informed of the behavior on webview load via an
  `event_tracking_behavior` message.
- The config payload emits both `event_tracking_behavior` and the legacy
  `is_external_data_collection_enabled` boolean.

Mirrors the iOS SDK change (Superwall-iOS #479). Android has no MMP
install-attribution, so that part of the iOS change is out of scope.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ianrumac ianrumac merged commit 4481579 into develop Jul 1, 2026
9 checks passed
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