Skip to content

Add presentedOfferingContext support to custom paywall impression events#1796

Open
rickvdl wants to merge 1 commit into
mainfrom
rickvdl/add-presented-offering-context-to-custom-paywall-events
Open

Add presentedOfferingContext support to custom paywall impression events#1796
rickvdl wants to merge 1 commit into
mainfrom
rickvdl/add-presented-offering-context-to-custom-paywall-events

Conversation

@rickvdl

@rickvdl rickvdl commented Jun 10, 2026

Copy link
Copy Markdown
Member

Based on PHC PR RevenueCat/purchases-hybrid-common#1665.

API

We will now send the presentedOfferingContext from the passed Offering along with the event. This PR adds the new API variant that takes an Offering instead of a plain string offeringId. The latter is now deprecated in favor of this new API variant. We will derive the presentedOfferingContext from this Offering and send it along with the request.

await Purchases.trackCustomPaywallImpression({ paywallId: "", offering })

Note

Low Risk
Analytics-only API extension with backward-compatible offeringId; main risk is slightly different native event payloads if callers relied on omitted keys instead of nulls.

Overview
Custom paywall impression tracking now accepts an optional PurchasesOffering (string offeringId is deprecated) and forwards presentedOfferingContext to native alongside paywallId and offeringId. The JS layer always builds a normalized payload with explicit null for missing fields; context is taken from the first package on the offering when present, and an passed offering wins over legacy offeringId.

Native bridges strip null entries before hybrid common on Android (toNonNullHashMap, also reused for Appstack attribution) and map NSNull to nil on iOS for this call. Tests, API testers, Jest mocks, a web no-op stub, and the purchase tester Custom Paywall screen (track with/without offering, event listener) were updated to match.

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

@rickvdl rickvdl added the pr:feat A new feature label Jun 10, 2026
Comment thread src/purchases.ts
const presentedOfferingContext =
params?.presentedOfferingContext ??
params?.offering?.availablePackages?.[0]?.presentedOfferingContext;
const offeringId =

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since the offeringId parameter is now deprecated (and will eventually be removed) I figured it made more sense consider the Offering the source of truth if passed, and we don't consider the passed offeringId as an 'override'.

@rickvdl rickvdl changed the title Add presentedOfferingContext parameter support to custom paywall impression events Add presentedOfferingContext support to custom paywall impression events Jun 10, 2026
@rickvdl rickvdl marked this pull request as ready for review June 10, 2026 11:56
@rickvdl rickvdl requested a review from a team as a code owner June 10, 2026 11:56

@tonidero tonidero 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.

A couple of small things but looking good!

Comment thread src/purchases.ts Outdated
Comment thread src/purchases.ts Outdated
Comment thread src/purchases.ts Outdated
if (params?.paywallId !== undefined) {
eventData.paywallId = params.paywallId;
}
if (offeringId !== undefined) {

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 think this could also be null, so same as above.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point, I've simplified all of this now :)

Comment thread src/purchases.ts Outdated
@rickvdl rickvdl force-pushed the rickvdl/add-presented-offering-context-to-custom-paywall-events branch from b3812f9 to f227237 Compare June 12, 2026 13:05

@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 f227237. Configure here.

Comment thread android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java Outdated
@rickvdl rickvdl force-pushed the rickvdl/add-presented-offering-context-to-custom-paywall-events branch 5 times, most recently from a2f4f10 to c1e7a3d Compare June 12, 2026 13:20
@rickvdl rickvdl force-pushed the rickvdl/add-presented-offering-context-to-custom-paywall-events branch from c1e7a3d to 52d2ac9 Compare June 12, 2026 14:08
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