v1.0.12 · Release snapshot

Documentation comes from this release commit, without inheriting newer content. Commit: 35589c6fda.

Google AdMob Ads — Integration Guide

How Magic Piano serves ads through Google AdMob (react-native-google-mobile-ads) behind the in-app @core/ads port (AdsService / AdsNativeAdapter). AdMob replaced IronSource LevelPlay in Phase 1 of the move; Phase 2 added the iOS mediation adapters for ten other networks (§11).


TL;DR — the things that bite

  1. No App ID in Info.plist = crash at launch. The react-native-google-mobile-ads config plugin bakes GADApplicationIdentifier at prebuild from EXPO_PUBLIC_ADMOB_IOS_APP_ID (config/admob-app-id.ts); a missing one fails the prebuild.
  2. Google's demo units only fill under Google's demo App ID. Test-ID mode (EXPO_PUBLIC_ADMOB_USE_TEST_IDS=1) switches both together — the App ID is baked at prebuild, so switching needs expo prebuild + a rebuild, never just a Metro reload. Demo units under the real App ID come back no-fill (Guitar learned this in QC, commit 53e2cdd).
  3. Two units per format. Interstitial, rewarded and App Open keep both High and All loaded at once and take High first at show time (§3); the banner still asks one tier at a time, High before All.
  4. Consent (UMP), then ATT, then the SDK. The engine does not start the SDK until Google's UMP allows ads (canRequestAds); ATT decides only whether the SDK can read the IDFA. No request asks for non-personalised ads (requestNonPersonalizedAdsOnly) — the TCF signal from UMP does that job (§4).
  5. The SDK has one error event for load and show failures. The adapter tells them apart by whether it was asked to show.
  6. Pods are pinned exactly. RNGMA 17.4.0 → Google-Mobile-Ads-SDK 13.10.0 and GoogleUserMessagingPlatform 3.1.0. Every mediation adapter in config/admob-mediation-adapters.ts is pinned too and must accept 13.10.0 (§11).
  7. An adapter does nothing until the dashboard uses it. A network serves only once it sits in the mediation group of the ad unit being asked — set that up for the High and the All unit.
  8. App Open has one unit, All only. EXPO_PUBLIC_ADMOB_IOS_APP_OPEN is in .env; there is no _HIGH, so every load asks the All unit. It sends no analytics, and the rules for when it shows live outside the engine (§6).

Architecture — ports & adapters

Ads live behind @core/ads (clean-architecture port, same pattern as @core/iap). Features and business logic (ads.ts) talk only to AdsService via getAdsService() — never to the SDK.

UI (SongsScreen, PlayScreen, BannerSlot) / ads.ts / app-open.ts
      │  getAdsService().showInterstitial / showRewarded / showAppOpen / preload* / bannerRequest
      ▼
AdsService port  ← src/core/ads/ads-service.ts
      │
      ├─ MediatedAdsService + AdsEngine   (production orchestration: two-tier cache, watchdog,
      │       │                             retries, parking, entitlement gate)
      │       │  AdsNativeAdapter port
      │       ▼
      │  AdMob adapter                     ← src/core/ads/adapters/admob-native-adapter.ts (pure)
      │       │  AdMobSdk port
      │       ▼
      │  admob-sdk.ts → react-native-google-mobile-ads (AdPools: one SDK preload pool per unit)
      │
      └─ SimulateAdsService               (tests — construct + inject into the flow)

<BannerSlot> (screens) ⇢ BannerHost (root, src/components) → AdMobBanner (src/core/ads/adapters/admob-banner.tsx) → BannerAd
  • composition-root.ts reads the unit ids, builds the adapter with ATT + the paid-impression sink, and wires tracking / lifecycle / gate.
  • App Open is driven by AppOpenHost (root layout) through app-open.ts, not by ads.ts: the host says when (after the splash on a cold launch from launch #2; on a background → active switch), the runtime reads the facts and asks the pure rule app-open-policy.ts whether it may show. The engine only loads and shows it. Rules: ad-trigger-logic.md §6.
  • EXPO_PUBLIC_APP_VARIANT=sim swaps in NoAdsAdsService (no SDK at all).
  • Dispose on no-ads: entitlement sync / mid-session premium calls disposeCache().

1. Dependency & versions

// package.json
"dependencies": { "react-native-google-mobile-ads": "17.4.0" }

17.4.0 pins Google-Mobile-Ads-SDK 13.10.0 and UMP 3.1.0 exactly (17.2.0 came with iOS 27 support, 4ab82a74, on GMA 13.6.0; Phase 2 was built on 16.5.0 and GMA 13.5.0). The podspec lets a Podfile override the GMA version with $RNGoogleMobileAdsSDKVersion; nothing needs it. v17 exposes ResponseInfo, so the winning network is named in ad_source (§8), and it allows the newest Pangle adapter (§11).

2. App ID & test-ID mode

BuildGADApplicationIdentifierUnits requested
NormalEXPO_PUBLIC_ADMOB_IOS_APP_ID (real, ca-app-pub-2489417515168450~2755561396)the env High/All units
EXPO_PUBLIC_ADMOB_USE_TEST_IDS=1Google's demo App ID ca-app-pub-3940256099942544~1458002511Google's demo units, no High

The prebuild refuses a missing real App ID, and refuses Google's demo App ID outside test-ID mode. Android is not shipped yet: its App ID is Google's demo one as a placeholder (the manifest must have one) and no Android unit is configured, so Android never requests an ad.

Test devices. Simulators are test devices automatically, so real units serve test ads there. A real device running a dev build with real units gets REAL ads — register it in AdMob → Settings → Test devices, or build with test-ID mode.

3. Ad units & tiers (High → All)

Env (tracked .env — public client ids):

FormatHighAll
InterstitialEXPO_PUBLIC_ADMOB_IOS_INTERSTITIAL_HIGHEXPO_PUBLIC_ADMOB_IOS_INTERSTITIAL
RewardedEXPO_PUBLIC_ADMOB_IOS_REWARDED_HIGHEXPO_PUBLIC_ADMOB_IOS_REWARDED
App OpenEXPO_PUBLIC_ADMOB_IOS_APP_OPEN_HIGH (optional)EXPO_PUBLIC_ADMOB_IOS_APP_OPEN
BannerEXPO_PUBLIC_ADMOB_IOS_BANNER_HIGHEXPO_PUBLIC_ADMOB_IOS_BANNER
Full Screen Native, after FS—EXPO_PUBLIC_ADMOB_IOS_FSN_INTER
Full Screen Native, after RV—EXPO_PUBLIC_ADMOB_IOS_FSN_RW

ad-units.ts resolves them: a High that is empty or equal to its All is dropped, and tierOrder() gives the order a load asks them in.

App Open is off while its units are unset (Android: EXPO_PUBLIC_ADMOB_ANDROID_APP_OPEN[_HIGH]). Test-ID mode uses Google's demo App Open unit — iOS ca-app-pub-3940256099942544/5575463023, Android ca-app-pub-3940256099942544/9257395921. It is the engine's third fullscreen format (preloadAppOpen / isAppOpenReady / showAppOpen), on the same tiers, pools, parking and watchdog, but sends no analytics (§8), is not preloaded by start(), and an ad older than 4 h is retired by the SDK pool itself (isStaleByPolicy), so a show never takes it.

Fullscreen (engine). The engine never loads an ad: each format keeps two tier slots warm at once — High and All — and each slot owns one SDK preload pool for its unit (ads-engine.ts, TierSlot). preload() creates the High pool, then the All pool after a random 200–500 ms jitter (magicPad's CoPreloadFormat), and then leaves them alone: warming a warm slot is a no-op, so spamming preload() is still one pool per unit. show() (SelectTier) takes from High's pool while it is ready, else All's, else it fails at once — no wait for a load in flight — and warms both again. A pool that claimed ready but polls empty or fails, or that hands over an ad past its shelf life, falls through to the other tier. A taken ad is shown once and destroyed; the SDK refills the pool by itself.

There is no retry ladder, load timeout or eviction in the engine any more — what they guarded against, the SDK preloader does (it paces its own retries, retires old ads and refills after a take), and nothing the app does can spam the ad network. The one thing the app owns is a pool that failed (the SDK refused it, or its preload reported an error): the next preload() or empty show builds it again, at most once per poolRecreateMinIntervalMs (60 s, pool-policy.ts). The banner and the Full Screen Native ad keep the 5 s → 60 s ladder (tier-cache-policy.ts).

Preload pools. admob-sdk.ts creates one pool per unit and format (AdPools.create(AdPoolPresets.fullscreen(…))) and admob-native-adapter.ts wraps it as a NativeAdInventory: readiness is a cached answer fed by the pool's available / exhausted events and its getAvailability() count at creation (an upper bound — a stale ad is only found out by the take); take() is one poll(). The show-phase listeners are attached to the one ad taken, not to the pool's stock. A held ad past the SDK's staleness window (isStaleByPolicy: 1 h, App Open 4 h) is dropped at take time. Pool depth is planned by pool-policy.ts inside Google's default app-wide cap of 6 buffered ads (the real cap is server-delivered; the SDK trims a deeper request and createFullscreenPool reports the depth it granted): depth 1 each, extra depth only for the All unit of interstitial then rewarded when units are left over — never High, which seldom fills. A format the platform has no preloader for reports pool-unavailable rather than crashing; disposeCache() disposes every inventory, destroying its pool, so a premium / no-ads user stops buffering. Every ad taken for a show is destroyed when the show ends. Funnel note: *_request now marks a pool being created or refilling after a take, and *_request_success a pool reporting an ad, so their volume no longer lines up with magicPad's. The log shows the wait: READY — … Nms after it was asked, pool ad TAKEN — … poll took Nms.

Banner. banner-tiers.ts: High's view first; if it does not fill, it is replaced by All's view; if All does not fill either, the view goes away and, after a backoff, the banner retries from High on its own — an unbounded 5 s → 60 s ladder (tier-cache-policy.ts), no cycle limit. A filled view is refreshed by the SDK on its own schedule; a failed refresh keeps the ad on screen. Every tier asked reports bannerads_request / _request_success / _request_failed (§8), retries included. Unlike the fullscreen formats, the banner does not keep both tiers warm, but since 2026-10-05 it keeps its one view loaded between screens: react-native-google-mobile-ads can only mount or unmount a <BannerAd>, so the view lives in the root BannerHost (§7) and waits outside the window while no banner screen is open. Outside the window, not transparent: on the simulator (2026-10-05) a transparent banner recorded an impression (PAID) on load and on every 60 s refresh, while one outside the window recorded none and did not refresh until it was shown. A second, hidden tier view is still never kept.

Order. requestAttThenPreloadAds() (att-flow.ts) runs consent (UMP) → ATT → preloadAds() (ad-privacy-prompts.ts), at the same two moments ATT always had: the end of the onboarding song for a player still in the FTUE funnel, and the boot ATT step (splash) for everyone past it. The engine then awaits getAdsConsentFlow().whenAdsAllowed() before adapter.requestTracking() and init() (setConsentGate, wired in composition-root.ts), so no path — preload, App Open, banner — starts the SDK without consent; a false keeps it off for the whole run.

Consent flow (src/core/ads/consent/) — one run per app launch:

PlayerWhat happensWait
New install (FTUE)prefetch() (UMP requestInfoUpdate) at idle after boot; the form, if the region requires it, opens right before ATT at the end of the onboarding songnone on the splash
Outside regulated regionsno form (NOT_REQUIRED), straight to ATTnone
Returning, answered beforethe stored answer (getConsentInfo, local) starts ads at once; the update refreshes in the background, a changed requirement applies next launchnone
Returning, never answered (EU, updated from a pre-UMP build, expired consent)the form opens in the boot ATT step, onceup to CONSENT_INFO_TIMEOUT_MS (2 s) for the update
Slow / offline updatethe player goes on with no form; ads start only if the late answer needs no form; never a form mid-session≤ 2 s

Rules are pure in consent-policy.pure.ts; the SDK sits behind AdsConsentPort (admob-consent-adapter.ts); sim / e2e builds use FakeConsentPort (no consent needed, no form). Settings shows "Privacy choices" (showPrivacyOptionsForm) only when UMP says the entry is required (selectShowPrivacyChoicesRow, ads-consent-store.ts). Every user is asked, premium included; a player who refuses consent is still asked ATT. Refusing is still an answer: UMP keeps canRequestAds true and Google serves Limited Ads (not personalised, lower fill). Ads stay off only while the form is left unanswered.

AdMob console. The form only shows once a GDPR (and, if wanted, US states) message is published under Privacy & messaging, with every mediation network in its ad partners. Leave UMP's "IDFA explainer" off — the app times ATT itself, and it would make three prompts in a row.

QA. TestFlight / store builds have no switch: test them from a regulated region over a VPN (UMP locates the player by IP), turned on before the app opens. Dev builds can fake the region instead with EXPO_PUBLIC_UMP_DEBUG_GEOGRAPHY (eea | us | not_eea | other) and EXPO_PUBLIC_UMP_TEST_DEVICE_IDS (comma separated hashed ids, printed by the UMP SDK in the Xcode log; simulators need none) in .env.local; release builds ignore both. Deleting the app resets the stored answer (and ATT).

ATT decides one thing: whether the SDK can read the IDFA. Every request — interstitial, rewarded, App Open, banner — is the same whatever the answer; none sets requestNonPersonalizedAdsOnly. Until 2026-10-19 every answer but granted asked for non-personalised ads. An iPad QC that day (ATT denied, 18 requests a cell) measured what that flag cost on its own: App Open filled 2/18 with it and 15/18 without; on Interstitial All, networks other than Google won 12/18 with it and 17/18 without, and Meta never won while it was set. Non-personalised ads are a consent question (GDPR in the EEA, the UK and Switzerland), not a tracking one. That is answered by the consent form above — Google's UMP, whose IAB TCF signal the SDK and the mediation networks read by themselves.

Nothing else raises the prompt. AppsFlyer starts at every launch and never asks (appsflyer-attribution-service.ts): its 7.x SDK has no wait-for-ATT option, and asking there put the prompt on a new player's onboarding screen.

5. The adapter — SDK events → port

SDK event (react-native-google-mobile-ads)Port callback
pool available event, or a count > 0 at creationNativeInventoryListener.onAvailable
pool exhausted eventonExhausted
pool error event, or a refused poolonLoadFailed
poll no-fill / errortake() → failed
ERROR on a taken ad before show()none — the ad is no longer showable (isStale())
ERROR after show()NativeShowListener.onAdDisplayFailed
OPENEDonAdDisplayed
RewardedAdEventType.EARNED_REWARDonAdRewarded
CLOSEDonAdClosed (or, if it never comes, the first touch on the app after the display — §6)
CLICKEDonAdClicked while showing (openads_click for App Open; the other formats send none)
PAIDanalytics (every full-screen format) + onAdImpression while showing (display confirmation)

Errors arrive namespaced (googleMobileAds/no-fill). show() takes no placement — the engine logs it. destroy() on a taken ad calls the installed SDK's destroy() for every fullscreen format, releasing the native ad and its native event subscription as well as JS listeners. Merely calling removeAllListeners() leaves the native inventory alive after the show or cache disposal. Destroying is idempotent, and an ad a poll hands out after its inventory was disposed is destroyed on arrival.

6. Engine protections

The show-time load grace (RC ads_show_load_grace_ms) is retired along with the RC key itself — the engine never waits at show time any more; §3 has what replaced it. The separate prefetch-on-display buffer is gone too: a shown or failed-to-show tier reloads itself instead. What remains: 8 s display watchdog · close settle deferred until foreground · the missed-close fallback (below) · parking during gameplay (pool creation and rebuild are parked too) · the rate-limited rebuild of a failed pool (§3) · the already-showing guard against a second trigger · the entitlement gate and the QA "Show Ads for Subscriber" toggle.

Missed-close fallback. An ad can come up and be closed with neither OPENED nor CLOSED ever arriving, only PAID (seen on device: zero revenue, display confirmed by the impression ~1 s late). The show then never settled: whatever waited on it (the Learn stage card, a Result navigation) stayed stuck, and the format answered already-showing to every later trigger until the app was killed. The SDK module's own missed-close recovery is armed by OPENED, so it never ran. Once an ad is confirmed on screen, the engine listens for a touch on the app's own views (the root view's responder capture, app-touch.ts, never claiming the touch): an ad on screen takes every touch itself, so a touch reaching the app proves the ad is gone, and the show is closed exactly as CLOSED would close it — same onClosed tracking, a rewarded keeps its reward or is reported reward_not_earned. A touch within closeFallbackArmMs (1 s) of the display is ignored; the listener stops when the show ends any way. The engine log line is CLOSE MISSING.

Screen check (no touch needed). The touch alone left the player on a frozen screen until they tapped — the Result after a song end, the Song List's Play, and the Full Screen Native that only follows an interstitial once its show settles. So while the touch listener is armed, the engine also watches the screen through the lifecycle port's watchAdLeavesScreen (ad-presence-watch.ts): it notes the controller presented on top when the ad is confirmed on screen (the iOS presentation probe in modules/fullscreen-native-ad), looks every 500 ms, and once that controller has been missing from the presented chain twice in a row the show is closed as CLOSED would close it (log: CLOSE MISSING — the ad left the screen with no close). A click's store sheet over the ad keeps it presented; a binary without the probe keeps only the touch. The business caps and flows stay in ads.ts (15 s / 30 s intervals, Flow A / B, pause interstitial, rewarded backfill video) — see ad-trigger-logic.md. App Open's caps (120 s since the last App Open, 60 s since the last interstitial or rewarded) are not in ads.ts either: they live in app-open-policy.ts, fed by the display timestamps ad-lifecycle.ts keeps in memory (see ad-trigger-logic.md §6).

7. Banner — BannerHost and BannerSlot

BannerHost, at the root under the paywall hosts, owns the app's only AdMobBanner (BannerAd, BANNER 320×50).

  • When it loads: once the ads SDK is ready. The app's own flows start it (boot ATT, the end of the onboarding song, the Song List preload, any rewarded / interstitial); while the banner is wanted and the SDK is not ready, useAdsServiceReady also asks for an init-only start through startAdsForBanner once a second — but only for a player past the FTUE funnel (shouldBannerStartAds), because a start asks for tracking and that prompt waits for the end of the first song. So a banner screen opened before any other flow started the SDK (a skipped onboarding, a preload cancelled with the Song List's focus) no longer waits for the first rewarded show.
  • Where it shows: in the most recently opened BannerSlot, which each banner screen renders where its banner sits. The slot reserves 320×50 and reports its window position. Every slot is open only while its screen is focused (bannerSlotOpen): a screen another one is pushed over stays mounted, and a slot left open there drew the banner over the new screen (the Shop opened from the result's No Ads popup, 2026-11-18). The Shop is never a banner screen, in any arm.
  • Hidden: with no slot open, the banner stays loaded outside the window, untouchable. The SDK neither counts an impression for it nor refreshes it until it is shown (§3).
  • Rules: in banner-host.pure.ts and banner-host-store.ts.
    • Premium / no-ads players hold no banner.
    • A fullscreen ad hides it, except in the result slots (duringFullscreenLatch).
    • An in-screen popup with a scrim (PopupOverlay — Learn's popups) hides it while open: the popup lives inside the screen tree, under the banner the host draws over every screen.
    • A Game Mode song drops it from the countdown until the engine's melodyEnded (the last note has ended, at least 2.5 s before the result), unless a slot is open: the pause menu asks for its own.
  • Placements: keyboard, sessionResult, fullSongUnlocked, sectionComplete, pause.

7b. Full Screen Native (FSN)

A native ad shown full screen right after an interstitial or a rewarded video that showed, for the installs whose mon_pkg arm asks for it (rules: ad-trigger-logic.md §7). It is not an engine format:

  • Native side: modules/fullscreen-native-ad, iOS only — a Swift port of magicPad's FsnAdBridge.m on the Google Mobile Ads SDK that react-native-google-mobile-ads already ships. It keeps one native ad per slot and presents it over the app: black screen, "Ad" badge + headline + icon, media, CTA, and a close button with a 3 s countdown under AdChoices. It follows the app's orientation, closes itself after an ad tap, and drops an ad older than 1 h.
  • Rules: FsnController loads a slot only while it is open (fsn-policy.ts: arm, D1 / Habit, not premium / No Ads), retries a failed load on the 5 s → 60 s ladder (the SDK never retries a native load), shows only an ad already loaded — never waits — and loads the next one after a close.
  • Ad break: FsnAdBreakAdsService wraps the ads service, so showInterstitial / showRewarded resolve only once the FSN after them is closed. No caller changes; a rewarded caller applies the reward after the FSN, and the 15 s / 30 s pacing counts from the end of the break. While it is up the app's full-screen-ad state is on, as for an interstitial.
  • Units: one per slot, All only, iOS only. Test-ID mode uses Google's demo native unit (ca-app-pub-3940256099942544/3986624511) for both — the native video demo unit answered "No ad to show" on the device. The two units must be Native format in AdMob, and native mediation needs its own mediation groups — not every network serves native through AdMob.
  • Native build: the module is native code, so a binary built before it has no FSN (the port reports unavailable and every slot stays shut).

8. Analytics

EventSourceNotes
fullads_*, videoads_*engine tracking portan event that stands for one unit names it: ad_unit_tier (high/all) + ad_unit_id — a request and its outcome, a ready, displayed or failed show. *_trigger and videoads_backfill carry none, and so does *_show_notready: it now fires only when neither tier is loaded, so there is never a unit behind it. That empty case is NOT also a failed show — *_show_failed is reserved for an ad that was in hand and did not reach the player, and always names its unit. One *_request → *_request_success / _failed pair per tier a load asks (a High miss + All fill is two pairs; videoads_* has no _request_success) — every attempt reports, retries included; the old tracked/silent split and the separate prefetch buffer are gone, so a reload after a close, a failed show or an eviction reports exactly like a first load
bannerads_show / _empty / _clickBannerHost_show fires when a filled banner is on screen in a slot — it fills there, a slot opens over it, or it refreshes there; once per slot and fill, so the same banner back after a popup or a fullscreen ad is not a new show — with that slot's location, and names the filled unit (ad_unit_tier, ad_unit_id); _empty once per failed High → All cycle (a High miss alone is not empty) or failed refresh
bannerads_request / _request_success / _request_failedBannerHostone pair per tier's view asked, mirroring fullads_request*: ad_unit_tier, ad_unit_id, fail_reason on the failure; fires on every retry too, on the same 5 s → 60 s ladder as the fullscreen formats (§3). location is the open slot's, left out for a load ahead with no slot open
ad_impression, ad_impression_amaPAID eventad_platform=admob, ad_source = the network that filled (see below), ad_unit_name Inter_High / Video_All / Open_All / Banner_High…, ad_unit_tier high/all, currency=USD + value
af_ad_revenue (AppsFlyer)PAID eventmediationNetwork: "google_admob" (react-native-appsflyer's constant — not the hub's googleadmob), monetizationNetwork = ad_source
af_inters_displayed / af_rewarded_displayedPAID event+ ad_unit_tier, currency
  • Full Screen Native sends its funnel (nativeads_request / _request_success / _request_failed / _show_ready / _show_notready / _show_failed), nativeads_show / nativeads_click (with trigger = after_fs / after_rv), each with connection, and its ad_impression / ad_impression_ama (ad_format: "fullscreen_native", ad_unit_name: "FSN_Inter" / "FSN_RW") plus AppsFlyer af_ad_revenue. See analytics-events.md.
  • App Open sends openads_* and its ad_impression / ad_impression_ama (ad_format: "app_open", ad_unit_name: "Open_All") plus AppsFlyer af_ad_revenue. See analytics-events.md for the events and their location.
  • fail_reason (ad-fail-reason.ts), at most 100 characters. What the SDK reported: <code>: <message> with the googleMobileAds/ namespace dropped (no-fill: Request Error: No ad to show.). What the app decides, magicPad's own wording where noted: both_tiers_empty (an interstitial show found neither tier loaded) / show_no_ready (the same, rewarded or App Open) / launch_wait_5s (the cold-launch App Open had nothing loaded after its 5 s wait) — always with no unit, and on *_show_notready only; load_timeout_90s (a load attempt the SDK never answered within 90 s); show_exception: <message> (the show call threw); fullscreen_content_failed (the SDK failed to present and said nothing); display_timeout (the 8 s show watchdog); reward_not_earned (a rewarded the player closed before earning it — *_show_failed only, after *_show). *_show_notready never names a unit or carries any reason but the three above; *_show_failed always names one, and never says no_fill or reports an empty show — the two events answer different questions: was there an ad, and did the ad we had reach the player. Retired: sdk_not_loaded — a tier the SDK quietly dropped is now just not picked, and the reason stays on TierSnapshot.lastError and the ads log, never on a tracked event — and loading, kept only so an old event still has a name for the value it carried before this build (there is no show-time wait left to run out of). RNGMA 16 has no per-network mediation error — that needs ResponseInfo (v17).
  • Ready means a tier holds a loaded ad and the SDK's own loaded flag agrees (NativeAdHandle.isLoaded()).
  • A tracking hook that throws (a dev build rejects invalid event params) is written to the ads log and dropped: it never stalls the load or show it reports on.
  • ad_source: the network that filled (loadedAdapterResponse.adSourceName, RNGMA 17: "AdMob Network", "AppLovin", "Liftoff Monetize"…).
    • A banner reads it from its PAID event's responseInfo.
    • A pooled interstitial, rewarded or App Open reads it from the ad's own responseInfo when it is taken out of its pool, because its PAID event carries none (seen on build 25).
    • An impression without either says admob. The adapter class (adapterClassName) goes to the ads log with the impression (source=… adapter=…), not to analytics. It names the network behind an ad that reports neither its display nor its close (§6, footgun #9).
  • Currency: AdMob reports revenue in the AdMob account's currency. The ad_impression schema only takes USD, so a non-USD value is sent to Firebase WITHOUT value / currency (never mislabelled, never a dev-time throw) and logged; AppsFlyer gets the real currency and converts it. Keep the AdMob account on USD.
  • Precision (RevenuePrecisions) is logged, not sent — no schema field.
  • If the AdMob app is ever linked to the Firebase project, the SDK also logs Firebase's own automatic ad_impression — check revenue is not counted twice.

9. QA — AdMob Ad Inspector

Dev builds show an ADS TEST pill on the Song List header (AdInspectorButton) → getAdsService().openAdInspector() → MobileAds().openAdInspector(): every ad unit's request log, the mediation waterfall per request, and SDK/adapter status. Release builds never render it. The SDK opens it only on a test device; on a real phone the first tap is refused with error 22, whose message names the phone's test id — admob-sdk.ts registers that id for the session (dev builds only) and opens the inspector on the retry, so from then on the phone is served test ads. Once the mediation groups exist, open an ad unit to see its ad sources and whether each adapter was found, and use Single ad source test to force one network and check that it fills — on a real device, a test device in AdMob.

The engine keeps a 200-line log (getAdsLog() / subscribeAdsLog()). Set EXPO_PUBLIC_ADS_DEBUG=1 in .env.local (restart Metro with -c) to mirror it to the Metro console: [ads:interstitial] LOAD FAILED — tier=high …, retry #1 in 5000ms — tier=high …, LOADED — tier=all …, [ads:paid] rewarded high value=… USD, and so on — the quickest way to watch the tiers work.

10. Info.plist — SKAdNetwork & ATS

  • SKAdNetwork: config/skadnetwork-items.ts — 193 ids, reconciled on 2026-09-21 with the list each mediation network publishes (Google's AdMob partners, AppLovin, Unity Ads, Mintegral, Pangle, Meta, InMobi, Liftoff Monetize, DT Exchange). The former LevelPlay export (173) lacked 20 of InMobi's and DT Exchange's, DT Exchange's own 9g2aggbj52 among them. Moloco publishes none and asks for no manual entry.
  • AdAttributionKit: AdNetworkIdentifiers — Liftoff Monetize's 6 .adattributionkit ids, which it requires alongside SKAdNetworkItems (InMobi's 3 are among them).
  • ATS NSAllowsArbitraryLoads: true, and nothing else. InMobi and DT Exchange ask for plain HTTP, and AppLovin's guide to mediated networks asks for this key alone. Do not add Google's NSAllowsArbitraryLoadsForMedia / …InWebContent: once either is present iOS ignores NSAllowsArbitraryLoads, and this key already allows what they would.
  • Meta on iOS 16 (open): Meta asks apps to call FBAdSettings.setAdvertiserTrackingEnabled before the ads SDK starts, and says iOS 17+ no longer needs it. The app targets 16.4, so Meta demand on iOS 16 devices runs without that signal until a native hook sets it from the ATT answer.

11. Phase 2 — mediation adapters

iOS only (Android ads are not shipped). The adapters are Google-built pods listed in config/admob-mediation-adapters.ts; app.config.ts hands them to expo-build-properties ios.extraPods, and Expo's autolinking adds them to the app target at pod install. No JS talks to them — the Google Mobile Ads SDK loads each adapter by class name when a mediation group asks for its network.

NetworkPod (pinned)BringsLinked as
AppLovinGoogleMobileAdsMediationAppLovin 13.6.4.0AppLovinSDK 13.6.4dynamic framework
BIGO AdsGoogleMobileAdsMediationBigo 6.1.0.0BigoADS 6.1.0not yet checked
BidMachineGoogleMobileAdsMediationBidMachine 3.8.2.0BidMachine 3.8.2not yet checked
DT ExchangeGoogleMobileAdsMediationFyber 8.4.10.0Fyber_Marketplace_SDK 8.4.10static
InMobiGoogleMobileAdsMediationInMobi 11.4.1.0InMobiSDK 11.4.1dynamic framework
IronSourceGoogleMobileAdsMediationIronSource 9.6.0.0.0IronSourceSDK 9.6.0.0static
Liftoff MonetizeGoogleMobileAdsMediationVungle 7.7.7.0VungleAds 7.7.7static
Meta Audience NetworkGoogleMobileAdsMediationFacebook 6.22.0.0FBAudienceNetwork 6.22.0dynamic framework
MintegralGoogleMobileAdsMediationMintegral 8.1.7.0MintegralAdSDK/All 8.1.7static
MolocoGoogleMobileAdsMediationMoloco 4.10.0.0MolocoSDKiOS 4.10.0dynamic framework
PangleGoogleMobileAdsMediationPangle 8.1.1.1.0Ads-Global 8.1.1.1 (incl. its TikTokBusinessSDK subspec)static
Unity AdsGoogleMobileAdsMediationUnity 4.20.1.0UnityAds 4.20.1static

Pins. Every adapter podspec declares the GMA range it accepts; all twelve above say ~> 13.3 (≥ 13.3, < 14), so they sit on RNGMA's 13.10.0. Before bumping one, read the new release's Google-Mobile-Ads-SDK dependency on the CocoaPods trunk — a release that needs a newer GMA fails pod install. Pangle stays on the adapter picked under GMA 13.5.0, when every newer stable one needed ~> 13.6; 13.10.0 now meets that, so it can move up in a change of its own.

BIGO Ads and BidMachine (added 2026-10-19, ahead of their dashboard setup) are bidding partners for every format. Their SKAdNetwork ids are in config/skadnetwork-items.ts; BidMachine's AdAttributionKit ids were already there. Before they can bid, the PO needs, for each network: the Magic Piano iOS app registered (BIGO reviews it before any ad slot can be made), a bidding placement per format (BIGO Slot ID; BidMachine Source ID + Placement ID), the network added as a Bidding ad source to every mediation group — Interstitial, Rewarded and Banner, High and All, and a group for App Open, which has none yet — and its lines in app-ads.txt.

Dead-strip — checked, nothing to change. The SDK looks adapters up by class name, so a Release link that strips them would fail only at runtime. A Release build (2026-09-21) still held all ten GADMediationAdapter* classes then; BIGO Ads' and BidMachine's are unchecked. Re-check after a toolchain or pin change with strings -a MagicPiano.app/MagicPiano | grep '^GADMediationAdapter' (the LevelPlay build needed DEAD_CODE_STRIPPING = NO; these pods do not).

Size. The four dynamic frameworks add about 26 MB to the simulator build; the six static SDKs land in the main binary. Read the real download size per device in App Store Connect.

What only the dashboard can do. An adapter serves nothing until its network sits in the mediation group of the ad unit being asked. Each format needs a group covering both its High and its All unit, with the network's own app / placement ids mapped in AdMob. Until then the SDK's cached config lists only GADMAdapterGoogleAdMobAds for the units, and no adapter initialises.

Keys & where they come from

All AdMob ids are public client ids in the tracked .env — prebuild (App ID) and the bundle (units) read them from the checkout, on CI too (App Open has its All unit only — no _HIGH). They are NOT CI secrets: the ios_internal job in .gitlab-ci.yml fails the build if the job env defines one (a defined variable, even empty, shadows .env) or if .env lacks one, and clears Metro's cache so the bundle re-inlines them.

When a Metro reload is enough vs. a full prebuild

ChangeNeeds
Engine / adapter / banner JS, ad triggersMetro reload
Unit ids in .envMetro restart with a cleared cache (expo start -c) — values are inlined
App ID, test-ID mode, SKAdNetwork, ATT text, RNGMA version, mediation adapter podsexpo prebuild --clean --platform ios + rebuild

References