Skip to content

feat: ad tracking API#927

Open
peterporfy wants to merge 6 commits into
mainfrom
ads-239
Open

feat: ad tracking API#927
peterporfy wants to merge 6 commits into
mainfrom
ads-239

Conversation

@peterporfy
Copy link
Copy Markdown

@peterporfy peterporfy commented May 12, 2026

Summary

Adds ad impression and revenue tracking support to the Unity SDK.

Design notes

  • All types in namespace RevenueCat — no extra using needed beyond using RevenueCat;
  • purchases.AdTracker returns a RevenueCat.AdTracker instance (initialized in Purchases.Start())
  • Value types nested in AdTracker (AdTracker.Format, AdTracker.MediatorName, AdTracker.Precision) to avoid naming collisions with ad SDK types like GoogleMobileAds.Api.AdFormat. This is different compared to the rest of the SDKs as C# using directives do wildcard namespace injection and that results in an immediate AdFormat clash between RC and Google. Since we are nesting under AdTracker I dropped the Ad prefix from the Format, Mediator etc types.
  • Data is passed as JSON strings across the C#/native boundary, consistent with existing SDK patterns
  • Optional string fields (networkName, placement) are omitted from JSON when null: SimpleJSON's Escape() crashes on null strings, so null checks are required at serialization time
  • mediatorErrorCode (int?) follows the same pattern: key omitted when null

Other notes

Tests

  • added API surface tests
  • extended the sample app locally and manually tested builds both with android and ios target

@peterporfy peterporfy added the pr:other Changes to our CI configuration files and scripts label May 12, 2026
@peterporfy peterporfy marked this pull request as ready for review May 12, 2026 17:02
@peterporfy peterporfy requested a review from a team as a code owner May 12, 2026 17:02
@peterporfy peterporfy requested a review from polmiro May 12, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:other Changes to our CI configuration files and scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant