feat: ad tracking API#927
Open
peterporfy wants to merge 6 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds ad impression and revenue tracking support to the Unity SDK.
Design notes
namespace RevenueCat— no extrausingneeded beyondusing RevenueCat;purchases.AdTrackerreturns aRevenueCat.AdTrackerinstance (initialized inPurchases.Start())AdTracker(AdTracker.Format,AdTracker.MediatorName,AdTracker.Precision) to avoid naming collisions with ad SDK types likeGoogleMobileAds.Api.AdFormat. This is different compared to the rest of the SDKs as C#usingdirectives do wildcard namespace injection and that results in an immediateAdFormatclash between RC and Google. Since we are nesting underAdTrackerI dropped theAdprefix from the Format, Mediator etc types.networkName,placement) are omitted from JSON when null: SimpleJSON'sEscape()crashes on null strings, so null checks are required at serialization timemediatorErrorCode(int?) follows the same pattern: key omitted when nullOther notes
remarks(https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/recommended-tags#remarks) to signal the API is still experimental. I didn't find anything stronger. I considered https://learn.microsoft.com/en-us/dotnet/api/system.obsoleteattribute?view=netframework-4.8.1&viewFallbackFrom=net-10.0 - but it is semantically incorrect, and https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-12.0/experimental-attribute - but it is not supported in older cs.Tests