Skip to content

Add experimental trackCustomPaywallImpression API#1660

Open
rickvdl wants to merge 5 commits intomainfrom
rickvdl/track-custom-paywall-impression-experimental-api
Open

Add experimental trackCustomPaywallImpression API#1660
rickvdl wants to merge 5 commits intomainfrom
rickvdl/track-custom-paywall-impression-experimental-api

Conversation

@rickvdl
Copy link
Member

@rickvdl rickvdl commented Mar 10, 2026

Description

Exposes trackCustomPaywallImpression as a public API in React Native, enabling developers to track impressions of custom (non-RevenueCat) paywalls for analytics.

The API is marked as experimental on the native side (@_spi(Experimental) on iOS, @ExperimentalPreviewRevenueCatPurchasesAPI on Android) and documented with @experimental JSDoc in TypeScript.

Changes

  • iOS bridge: RCT_EXPORT_METHOD(trackCustomPaywallImpression:) in RNPurchases.m
  • Android bridge: @ReactMethod trackCustomPaywallImpression in RNPurchasesModule.java
  • TypeScript: Purchases.trackCustomPaywallImpression() in purchases.ts
  • Purchase tester: Added a demo Custom Paywall screen that tracks an impression on mount

Related PRs

@rickvdl rickvdl added the pr:other A code change that improves performance label Mar 10, 2026
@rickvdl rickvdl marked this pull request as ready for review March 10, 2026 13:17
@rickvdl rickvdl requested a review from a team as a code owner March 10, 2026 13:17
github-merge-queue bot pushed a commit to RevenueCat/purchases-android that referenced this pull request Mar 12, 2026
## Description

Exposes `trackCustomPaywallImpression` as an experimental public API,
allowing hybrid SDKs and consumers to track impressions of custom
(non-RevenueCat) paywalls.

### Changes
- New `CustomPaywallEventParams` class gated behind
`@ExperimentalPreviewRevenueCatPurchasesAPI`
- Public `trackCustomPaywallImpression` method on `Purchases`
- API tester and Metalava API surface updates

### Related PRs
- purchases-ios: RevenueCat/purchases-ios#6427
- purchases-hybrid-common:
RevenueCat/purchases-hybrid-common#1537
- react-native-purchases:
RevenueCat/react-native-purchases#1660

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Introduces new public (experimental) API surface on `Purchases`, which
can affect binary compatibility and downstream integrations if the
signature or opt-in semantics change.
> 
> **Overview**
> Exposes `Purchases.trackCustomPaywallImpression` as an *experimental
public API* (with overloads) to let apps track impressions for
custom/non-RevenueCat paywalls, accepting optional `paywallId` via the
new `CustomPaywallImpressionParams` type.
> 
> Replaces the prior internal params type, updates API tester coverage
(Java/Kotlin) to exercise the new calls, and refreshes Metalava API
surface files and unit tests accordingly.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3896706. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
rickvdl added a commit to RevenueCat/purchases-hybrid-common that referenced this pull request Mar 12, 2026
## Description

Adds bridge methods for `trackCustomPaywallImpression` on both iOS and
Android, enabling hybrid SDKs to call the new experimental native API.

### Changes
- iOS: `trackCustomPaywallImpression(_ data:)` in
`CommonFunctionality.swift`
- Android: `trackCustomPaywallImpression(data)` in `common.kt`

Both methods accept a dictionary with an optional `paywallId` key and
delegate to the native SDK.

### Related PRs
- purchases-ios: RevenueCat/purchases-ios#6427
- purchases-android:
RevenueCat/purchases-android#3199
- react-native-purchases:
RevenueCat/react-native-purchases#1660
@rickvdl rickvdl force-pushed the rickvdl/track-custom-paywall-impression-experimental-api branch 2 times, most recently from 05efd6f to 6bafc79 Compare March 12, 2026 16:07
@rickvdl rickvdl added pr:feat A new feature and removed pr:other A code change that improves performance labels Mar 12, 2026
@rickvdl rickvdl changed the title Expose trackCustomPaywallImpression API Add experimental trackCustomPaywallImpression API Mar 12, 2026
@rickvdl rickvdl force-pushed the rickvdl/track-custom-paywall-impression-experimental-api branch from 6bafc79 to 0d88f8e Compare March 13, 2026 08:13
Comment on lines +631 to +633
if (@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)) {
[RCCommonFunctionality trackCustomPaywallImpression:data];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember we added isCustomPaywallTrackingAPIAvailable checker in PHC here

But it's true that the trackCustomPaywallImpression still requires iOS 15, etc.

I wonder how we could use the checker. At a minimum, we should probably log something if the method is not available

Copy link
Member Author

Choose a reason for hiding this comment

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

Good pint, added the logging here as well :)

I don't think using isCustomPaywallTrackingAPIAvailable adds much value here since we have to do this @available check anyways. But please LMK if you disagree :)

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

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants