Skip to content

Track purchase button component interactions for component and legacy paywalls#3336

Merged
MonikaMateska merged 1 commit into
monika/Ul-events/paywall-control-interactionfrom
monika/Ul-events/purchase-button-interaction
Apr 13, 2026
Merged

Track purchase button component interactions for component and legacy paywalls#3336
MonikaMateska merged 1 commit into
monika/Ul-events/paywall-control-interactionfrom
monika/Ul-events/purchase-button-interaction

Conversation

@MonikaMateska

@MonikaMateska MonikaMateska commented Apr 13, 2026

Copy link
Copy Markdown
Member

Checklist

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

Motivation

Paywall component interaction analytics did not consistently record taps on purchase CTAs for Paywalls V2 (component JSON) or v1 template paywalls. Product and backend need a purchase_button interaction type with stable component_value, package/product identifiers, and URL semantics aligned with how checkout is opened (in-app vs web / browser mode).
Resolves: PWENG-32

Description

  • V2 / component paywalls: On purchase-related ButtonComponentStyle actions, emit PaywallComponentType.PURCHASE_BUTTON via paywallPurchaseButtonAction, using packageForPurchaseButtonInteraction for package/product IDs and purchaseButtonInteractionComponentUrl (built on resolveWebCheckoutUrlForInteraction) for component_url (external browser = fully resolved checkout URL; in-app / deep link = package/offering WPL + custom URL fallback as implemented).
  • Style factory: Wire PurchaseButtonComponent.name into ButtonComponentStyle.componentName where applicable.
  • Legacy templates: Track the same interaction shape from PurchaseButton and the validation-warning DefaultPaywallView purchase path, using PaywallLegacyComponentInteraction constants for stable component_name / component_value.
  • Serialization / backend: Extend PaywallComponentType with purchase_button and keep backend flattening in sync; fix PaywallEventSerializationTests to cast BackendStoredEvent.Paywalls before reading event.
  • Detekt: Collapse paywallCarouselPageChange parameters into CarouselPageChangeInteraction (with @Suppress("LongParameterList") on the data class constructor if needed).

Note

Medium Risk
Changes paywall analytics emission and URL resolution for purchase-related buttons across both component (V2) and legacy paywalls, which could affect event payloads and downstream reporting. No purchase/entitlement logic is modified, but incorrect URL/package resolution could misattribute interactions.

Overview
Adds a new paywall component interaction type, PaywallComponentType.PURCHASE_BUTTON, and wires backend flattening/serialization to emit the purchase_button wire value.

Updates RevenueCatUI to track purchase CTA taps for both component paywalls (purchase-related ButtonComponentStyle actions) and legacy templates (including the validation-warning/default paywall), emitting a standardized purchase_button interaction with stable component_value, optional component_name, currentPackageIdentifier/currentProductIdentifier, and consistent component_url semantics.

Refactors web-checkout URL construction into a shared resolver (resolveWebCheckoutUrlForInteraction) and adjusts carousel page-change tracking to use a CarouselPageChangeInteraction container to reduce parameter noise; tests are updated/added to validate the new purchase-button interaction shape and stored-event casting.

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

… paywalls (PWENG-32)

Co-authored-by: Alexander Repty <alex.repty@revenuecat.com>
@MonikaMateska MonikaMateska requested review from a team as code owners April 13, 2026 19:25
@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

@MonikaMateska MonikaMateska merged commit dfc88cf into monika/Ul-events/paywall-control-interaction Apr 13, 2026
23 of 35 checks passed
@MonikaMateska MonikaMateska deleted the monika/Ul-events/purchase-button-interaction branch April 13, 2026 20:47
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