Skip to content

Track web checkout opened paywall event#6909

Closed
alexrepty wants to merge 1 commit into
mainfrom
alex/web-checkout-opened-result
Closed

Track web checkout opened paywall event#6909
alexrepty wants to merge 1 commit into
mainfrom
alex/web-checkout-opened-result

Conversation

@alexrepty

@alexrepty alexrepty commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Add support for a "web checkout opened" flow: introduce WebCheckoutOpenedPreferenceKey and a published UUID (PurchaseHandler.webCheckoutOpened) to signal distinct web-checkout taps; add PurchaseHandler.signalWebCheckoutOpened to emit the preference and track a paywall_web_checkout_opened analytics event. Wire the signal from the purchase button, expose an onWebCheckoutOpened View modifier and WebCheckoutOpenedHandler, and add a PaywallViewController delegate callback. Extend PaywallEvent and networking enums to include webCheckoutOpened and add tests covering event tracking and PurchaseHandler behavior. Reset webCheckoutOpened on new sessions.

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Description


Note

Medium Risk
New public delegate/modifier APIs and a persisted paywall analytics event; behavior is isolated to web-checkout CTAs but affects host integrations and event pipelines.

Overview
Adds a dedicated web checkout opened path so hosts can react when users leave the app for external checkout instead of treating it as a purchase cancel.

PurchaseHandler now exposes signalWebCheckoutOpened(package:), which assigns a fresh UUID on webCheckoutOpened, emits WebCheckoutOpenedPreferenceKey, and records a stored PaywallEvent.webCheckoutOpened (paywall_web_checkout_opened) with optional package/product IDs. Session reset clears that UUID without affecting hasPurchasedInSession.

V2 PurchaseButtonComponentView calls the signal after launching the browser. SwiftUI gains onWebCheckoutOpened / WebCheckoutOpenedHandler; UIKit gains optional paywallViewControllerDidOpenWebCheckout. Event plumbing and API testers are updated; unit tests cover tracking and handler behavior.

Reviewed by Cursor Bugbot for commit c80491e. Bugbot is set up for automated code reviews on this repo. Configure here.

Add support for a "web checkout opened" flow: introduce WebCheckoutOpenedPreferenceKey and a published UUID (PurchaseHandler.webCheckoutOpened) to signal distinct web-checkout taps; add PurchaseHandler.signalWebCheckoutOpened to emit the preference and track a paywall_web_checkout_opened analytics event. Wire the signal from the purchase button, expose an onWebCheckoutOpened View modifier and WebCheckoutOpenedHandler, and add a PaywallViewController delegate callback. Extend PaywallEvent and networking enums to include webCheckoutOpened and add tests covering event tracking and PurchaseHandler behavior. Reset webCheckoutOpened on new sessions.
@alexrepty
alexrepty requested review from a team as code owners June 4, 2026 11:53
@alexrepty
alexrepty marked this pull request as draft June 4, 2026 11:53
@RevenueCat-Danger-Bot

Copy link
Copy Markdown
1 Error
🚫 Label the PR using one of the change type labels. If you are not sure which label to use, choose pr:other.
Label Description
pr:feat A new feature. Use along with pr:breaking to force a major release.
pr:fix A bug fix. Use along with pr:force_minor to force a minor release.
pr:other Other changes. Catch-all for anything that doesn't fit the above categories. Releases that only contain this label will not be released. Use along with pr:force_patch, or pr:force_minor to force a patch or minor release.
pr:RevenueCatUI Use along any other tag to mark a PR that only contains RevenueCatUI changes
pr:next_release Preparing a new release
pr:dependencies Updating a dependency
pr:phc_dependencies Updating purchases-hybrid-common dependency
pr:changelog_ignore The PR will not be included in the changelog. This label doesn't determine the type of bump of the version and must be combined with pr:feat, pr:fix or pr:other.

Generated by 🚫 Danger

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c80491e. Configure here.

return self.paywallEventTracker.createPurchaseInitiatedEvent(package: package, sessionID: sessionID)
}

/// Signals that the user tapped a web checkout CTA and the paywall was dismissed to open the browser.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale web checkout on reappear

Medium Severity

webCheckoutOpened is cleared in resetForNewSession, which SwiftUI paywall presentation often never calls on a new show. A new trackPaywallImpression does not clear it either, so a leftover UUID can make onWebCheckoutOpened run when the paywall reappears without a new web checkout tap.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c80491e. Configure here.

@emerge-tools

emerge-tools Bot commented Jun 4, 2026

Copy link
Copy Markdown

4 builds increased size

Name Version Download Change Install Change Approval
RevenueCat
com.revenuecat.PaywallsTester
1.0 (1) 18.5 MB ⬆️ 22.2 kB (0.12%) 67.0 MB ⬆️ 126.3 kB (0.19%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.local-source
1.0 (1) 4.3 MB ⬆️ 4.6 kB (0.11%) 12.8 MB ⬆️ 18.1 kB (0.14%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.cocoapods
1.0 (1) 6.4 MB ⬆️ 7.7 kB (0.12%) 28.3 MB ⬆️ 47.3 kB (0.17%) ⏳ Needs approval
BinarySizeTest
com.revenuecat.binary-size-test.spm
1.0 (1) 4.4 MB ⬆️ 5.8 kB (0.13%) 11.1 MB ⬆️ 18.1 kB (0.16%) N/A

RevenueCat 1.0 (1)
com.revenuecat.PaywallsTester

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬆️ 126.3 kB (0.19%)
Total download size change: ⬆️ 22.2 kB (0.12%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 29.6 kB
Code Signature ⬆️ 3.1 kB
RCPurchases.Objc Metadata ⬆️ 2.5 kB
RevenueCat.Backend.Backend ⬆️ 2.4 kB
RevenueCatUI.PaywallViewController.PaywallViewController ⬆️ 2.0 kB
View Treemap

Image of diff

BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.local-source

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 18.1 kB (0.14%)
Total download size change: ⬆️ 4.6 kB (0.11%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 2.9 kB
RevenueCat.PurchasedTransactionDataEncodedWrapper.value witness ⬆️ 2.5 kB
RevenueCat.LocalTransactionMetadata.value witness ⬆️ 2.1 kB
RevenueCat.PaywallEvent.value witness ⬆️ 1.7 kB
📝 RevenueCatUI.PaywallEventTracker.trackWebCheckoutOpened(package,s... ⬆️ 1.7 kB
View Treemap

Image of diff

BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.cocoapods

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 47.3 kB (0.17%)
Total download size change: ⬆️ 7.7 kB (0.12%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 16.9 kB
DYLD.String Table ⬆️ 6.1 kB
RevenueCat.PurchasedTransactionDataEncodedWrapper.value witness ⬆️ 2.5 kB
RevenueCat.LocalTransactionMetadata.value witness ⬆️ 2.1 kB
RevenueCat.PaywallEvent.value witness ⬆️ 1.7 kB
View Treemap

Image of diff

BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.spm

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 18.1 kB (0.16%)
Total download size change: ⬆️ 5.8 kB (0.13%)

Largest size changes

Item Install Size Change
RevenueCat.PurchasedTransactionDataEncodedWrapper.value witness ⬆️ 2.5 kB
RevenueCat.LocalTransactionMetadata.value witness ⬆️ 2.1 kB
RevenueCat.PaywallEvent.value witness ⬆️ 1.7 kB
📝 RevenueCatUI.PaywallEventTracker.trackWebCheckoutOpened(package,s... ⬆️ 1.7 kB
RevenueCat.PaywallEvent.init(from) ⬆️ 776 B
View Treemap

Image of diff


🛸 Powered by Emerge Tools

Comment trigger: Size diff threshold of 100.00kB exceeded

@AlvaroBrey

Copy link
Copy Markdown
Contributor

Superseded by #7260

@AlvaroBrey AlvaroBrey closed this Jul 20, 2026
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.

3 participants