feat(ads/admob): add impression_id to SSV customRewardText payload#6841
Merged
Conversation
Extends the SSV customRewardText payload with an impression_id field sourced from AdMob's responseInfo.responseIdentifier at install time, so backend webhook events can be anchored to the same impression as the SDK impression events that already carry impression_id. - CapableAd protocol gains a responseInfo getter so Setup.install can read the response identifier from any rewarded ad type. Both GADRewardedAd and GADRewardedInterstitialAd already expose it. - Tracking.Adapter.impressionID(from:) is hoisted from private to internal — single source of truth for the empty-string fallback policy shared with the existing event-tracking flow. - Setup.makeCustomRewardText takes an impressionId parameter and includes the field in the JSON unconditionally. Payload stays [String: String]. Tests updated: SetupTests covers the new field in the JSON; CapableAd test doubles add responseInfo to satisfy the protocol.
ajpallares
approved these changes
May 27, 2026
Member
|
The CI is failing because
These types also need to implement the new property |
…type GoogleMobileAds.RewardedAd.responseInfo is non-optional, so declaring the protocol requirement as Optional broke conformance. Drop the `?` and add a non-optional `impressionID(from:)` overload for the full-screen call sites.
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.
Checklist
SetupTestscovers the new JSON field)impression_idMotivation
The AdMob SSV
customRewardTextpayload (currently{api_key, client_transaction_id}) carries no link back to the originating impression. SDK impression events (Ad Loaded/Displayed/Opened/Revenue) already includeimpression_id(fromresponseInfo.responseIdentifier), but the SSV webhook event ingested on the backend has no field to join against them. Addingimpression_idto the SSV payload lets backend webhook events anchor to the same impression as the SDK events for one ad load.Description
Tracking.Adapter.impressionID(from:)is promoted fromprivatetointernalso the reward-verification flow can reuse the same?? ""fallback policy as the existing event-tracking flow. Single source of truth.RewardVerification.CapableAdprotocol gainsresponseInfo: GoogleMobileAds.ResponseInfo? { get }. BothGADRewardedAdandGADRewardedInterstitialAdalready expose it.RewardVerification.Setup.installreadsimpressionId = Tracking.Adapter.impressionID(from: loadedAd.responseInfo)and threads it through tomakeCustomRewardText.RewardVerification.Setup.makeCustomRewardTexttakes animpressionId: Stringparameter and includes it in the JSON. The payload stays[String: String]with sorted keys, so existing snapshot/log shapes are preserved.No public API change. Pure additive payload field.
Test plan
swift build(adapter) +swiftlintclean.SetupTests::testMakeCustomRewardText...updated to passimpressionId:and assert the field appears in both the parsed payload and the deterministic sorted-key string output.FakeRewardedAd/FakeCapableAdtest doubles updated to satisfy the newresponseInfoprotocol requirement.Note
Low Risk
Additive internal payload field and shared helper exposure; no auth or public API changes, with unit test coverage.
Overview
Adds
impression_idto the AdMob server-side verificationcustomRewardTextJSON so SSV webhook events can be correlated with SDK ad events that already carry the same identifier.RewardVerification.Setup.installnow readsimpressionIdfrom the loaded ad’sresponseInfoviaTracking.Adapter.impressionID, which is shared with the existing tracking path (promoted fromprivatewith an overload for non-optionalResponseInfo).CapableAdrequiresresponseInfoso rewarded ads supply it at SSV install time.makeCustomRewardTextacceptsimpressionIdand serializes it alongsideapi_keyandclient_transaction_idwith sorted keys unchanged.Tests and fakes were updated for the new field and protocol requirement; no public API change.
Reviewed by Cursor Bugbot for commit 2f4f0e8. Bugbot is set up for automated code reviews on this repo. Configure here.