Skip to content

Conversation

@facumenzella
Copy link
Contributor

Motivation

We need to start tracking revenue generated from Customer Center. This PR aims to evolve how we track paywalls, adding a source to it.

Description

  • Introduced a typed `PaywallSource and environment modifier to add a source to a paywall
  • Updated Customer Center’s No Subscriptions card to emit .customerCenter, ensured receipt payloads mirror the paywall source, and added a regression test for tracking.

@emerge-tools
Copy link

emerge-tools bot commented Oct 21, 2025

📸 Snapshot Test

76 modified, 803 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
RevenueCat
com.revenuecat.PaywallsTester.mac-catalyst-scaled-to-match-ipad
0 0 68 0 169 0 ⏳ Needs approval
RevenueCat
com.revenuecat.PaywallsTester.mac-native
0 0 7 0 161 0 ⏳ Needs approval
RevenueCat
com.revenuecat.PaywallsTester.mac-catalyst-optimized-for-mac
0 0 1 0 236 0 ⏳ Needs approval
RevenueCat
com.revenuecat.PaywallsTester
0 0 0 0 237 0 N/A

🛸 Powered by Emerge Tools

Comment on lines +63 to +65
@_spi(Internal) public func paywallSource(_ source: PaywallSource?) -> some View {
self.environment(\.paywallSource, source)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This felt cleaner than adding a parameter to the view

Comment on lines 389 to 396
@MainActor
func updatePaywallSource(_ source: PaywallSource?) {
self.paywallSource = source

if let source {
self.eventData?.source = source.rawValue
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this to avoid modifying PaywallEvent. Now I am thinking that maybe we should call this offeringSource, rather than paywallSource

Comment on lines +1392 to 1396
func track(paywallEvent: PaywallEvent, source: String? = nil) async {
let eventWithSource = paywallEvent.withSource(source)
self.purchasesOrchestrator.track(paywallEvent: eventWithSource)
await self.paywallEventsManager?.track(featureEvent: eventWithSource)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes me think if we should just add source to any PaywallEvent instead of mutating the event here

@facumenzella facumenzella marked this pull request as ready for review October 22, 2025 10:04
@facumenzella facumenzella requested review from a team as code owners October 22, 2025 10:04
}
],
"settings" : {
"_askToBuyEnabled" : false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to rever this file

Copy link
Contributor

@JZDesign JZDesign Oct 22, 2025

Choose a reason for hiding this comment

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

I would revert the last line change of the json files. When they are opened with Xcode, it leaves a blank line at the end. This can cause issues with tests (if these are ever compared upon load)

Copy link
Contributor

Choose a reason for hiding this comment

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

I always use VSCode for this

Copy link
Contributor

@JZDesign JZDesign left a comment

Choose a reason for hiding this comment

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

Makes sense, good work!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants