Add placement and targeting rule to paywall events#6476
Conversation
df2f4e1 to
b076fe1
Compare
📸 Snapshot Test327 unchanged
🛸 Powered by Emerge Tools |
|
@RCGitBot please test |
78c72b4 to
f35f2bd
Compare
4 builds increased size
RevenueCat 1.0 (1)
|
| Item | Install Size Change |
|---|---|
| DYLD.String Table | ⬆️ 17.3 kB |
| RevenueCat.InternalAPI.InternalAPI | ⬆️ 3.3 kB |
| RevenueCatUI.PaywallViewController.PaywallViewController | ⬆️ 2.9 kB |
| Code Signature | ⬆️ 2.7 kB |
| RCPurchases.Objc Metadata | ⬆️ 2.7 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.local-source
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 23.2 kB (0.19%)
Total download size change: ⬆️ 5.1 kB (0.13%)
Largest size changes
| Item | Install Size Change |
|---|---|
| RevenueCat.PurchasedTransactionDataEncodedWrapper.value witness | ⬆️ 3.8 kB |
| RevenueCat.LocalTransactionMetadata.value witness | ⬆️ 3.5 kB |
| RevenueCat.PaywallEvent.value witness | ⬆️ 2.7 kB |
| RevenueCat.PurchasedTransactionData.value witness | ⬆️ 2.5 kB |
| RevenueCat.PurchasesOrchestrator.CachedPurchaseContext.value witn... | ⬆️ 2.5 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.cocoapods
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 35.7 kB (0.13%)
Total download size change: ⬆️ 7.0 kB (0.11%)
Largest size changes
| Item | Install Size Change |
|---|---|
| DYLD.String Table | ⬆️ 10.3 kB |
| RevenueCat.PurchasedTransactionDataEncodedWrapper.value witness | ⬆️ 3.8 kB |
| RevenueCat.LocalTransactionMetadata.value witness | ⬆️ 3.5 kB |
| RevenueCat.PaywallEvent.value witness | ⬆️ 2.7 kB |
| RevenueCat.PurchasedTransactionData.value witness | ⬆️ 2.5 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.spm
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 23.2 kB (0.22%)
Total download size change: ⬆️ 6.9 kB (0.17%)
Largest size changes
| Item | Install Size Change |
|---|---|
| RevenueCat.PurchasedTransactionDataEncodedWrapper.value witness | ⬆️ 3.8 kB |
| RevenueCat.LocalTransactionMetadata.value witness | ⬆️ 3.5 kB |
| RevenueCat.PaywallEvent.value witness | ⬆️ 2.7 kB |
| RevenueCat.PurchasedTransactionData.value witness | ⬆️ 2.5 kB |
| RevenueCat.PurchasesOrchestrator.CachedPurchaseContext.value witn... | ⬆️ 2.5 kB |
🛸 Powered by Emerge Tools
Comment trigger: Size diff threshold of 100.00kB exceeded
|
@RCGitBot please test |
f35f2bd to
7b9caf4
Compare
|
@RCGitBot please test |
| var copy = self | ||
| copy.packageId = packageId | ||
| copy.productId = productId | ||
| copy.errorCode = errorCode | ||
| copy.errorMessage = errorMessage | ||
| return copy |
e41d6de to
4e979b8
Compare
4e979b8 to
edf9e61
Compare
|
@RCGitBot please test |
1 similar comment
|
@RCGitBot please test |
edf9e61 to
5e39a87
Compare
|
@RCGitBot please test |
Include presentedOfferingContext (placementIdentifier, targetingRevision, targetingRuleId) in paywall event serialization so the backend can calculate conversion rates per placement. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move PresentedOfferingContextData from nested struct inside FeatureEventsRequest.PaywallEvent to an extension to avoid exceeding the 1-level nesting limit.
Move nil-checking logic into a failable initializer on PresentedOfferingContextData, simplifying the call site.
…rectly Replace three separate placement/targeting parameters with a single PresentedOfferingContext? parameter in the internal init, removing duplicated property extraction across all four public initializers. Also simplify withPurchaseInfo to use var copy.
- Add round-trip test with placement/targeting through serialize → deserialize → backend event pipeline - Add placement-only test (no targeting) - Add targeting-only test (no placement)
…eting Verify that events serialized before placement/targeting fields were added still deserialize correctly and produce nil presentedOfferingContext.
5e39a87 to
0ad31b9
Compare
|
@RCGitBot please test |
## Summary - Include `placement_identifier`, `targeting_revision`, and `targeting_rule_id` in paywall events under a `presented_offering_context` nested object - Field is omitted when no placement or targeting data exists - Consistent with iOS and Android implementations ## Related PRs - iOS: RevenueCat/purchases-ios#6476 - Android: RevenueCat/purchases-android#3253 ## Test plan - [x] Unit tests for all context permutations (full, placement-only, targeting-only, none, empty string) - [x] JSON round-trip serialization tests - [x] Integration test verifying context flows from offering to event payload - [x] Manual testing with targeting rules and placements in demo app




Include presentedOfferingContext (placementIdentifier, targetingRevision, targetingRuleId) in paywall event serialization so that events & charts can utilize those dimensions.
Checklist
purchases-androidand hybridsMotivation
Description
Note
Medium Risk
Changes the JSON schema sent to the paywalls events endpoint by adding a new optional nested object, which could affect backend parsing/analytics if not handled, though the fields are additive and nil-safe.
Overview
Paywall feature events now include an optional
presented_offering_contextpayload (placement + targeting rule metadata) when serialized and posted to the paywalls events backend.This threads
PresentedOfferingContextdata fromOffering/PackageintoPaywallEvent.Data, encodes it via a newPresentedOfferingContextDatawrapper that omits the object when all fields arenil, and updateswithPurchaseInfoto preserve these new fields. Unit + snapshot tests were added to cover placement-only, targeting-only, and combined cases, including end-to-end backend request snapshots across platforms.Reviewed by Cursor Bugbot for commit 0ad31b9. Bugbot is set up for automated code reviews on this repo. Configure here.