AdMob
What ad networks paid for the ads in your app: estimated earnings, impressions, requests and clicks per day, country, format (rewarded, interstitial, banner…) and app.
"admob": { "enabled": true, "publisherId": "pub-1234567890123456" }
| Setting | Meaning |
|---|---|
publisherId |
Your publisher id (AdMob → Settings → Account information). Empty uses the first account the login sees. |
Add each AdMob app id (ca-app-pub-…~…, AdMob → Apps → App settings) to the app’s keys, so earnings land on the right app.
Your Google login
AdMob’s API accepts only a person’s login, never a service account. You create the login client yourself, once:
- In the Google Cloud console, pick your project and enable the AdMob API.
- OAuth consent screen: type External, fill in the app name and your email, add the scope
https://www.googleapis.com/auth/admob.readonly(andadwords/analytics.readonlyif Google Ads or GA4 also use your login). - Publish the app (Audience → Publish app, status “In production”). In “Testing”, Google expires the login after 7 days. An unverified app for your own use is fine: Google shows a warning screen you can pass with Advanced → Go to ….
- Credentials → Create credentials → OAuth client ID → Desktop app. Download the JSON and save it as
google-oauth-client.jsonin your secrets folder. - Run:
earnback connect google
Your browser opens Google’s consent page. After you allow it, Google redirects to a local address Earnback listens on for that moment (http://127.0.0.1:<random port>, with PKCE) and the refresh token is saved as google-oauth-token.json. One login covers every Google source that uses oauth.
What it reads
The network report (ESTIMATED_EARNINGS, IMPRESSIONS, AD_REQUESTS, CLICKS by date, country, format and app). The last 35 days are re-read on every sync.
Caveats
- Earnings are estimates until AdMob finalises them after the month ends.
- AdMob knows nothing about where players came from, so its revenue can’t be split by channel or campaign. The report shows “–” for those filters. Per-channel payback uses GA4’s cohort revenue instead (see ga4.md).
- AdMob reports in your account’s currency.
Errors
| Message | Fix |
|---|---|
Zugriff blockiert / access_denied / “app not verified” |
Publish the consent screen (step 3), or add yourself as a test user. |
invalid_grant |
The login expired (consent screen still in Testing) or was revoked: publish it, then earnback connect google again. |
This Google login sees no AdMob account |
Log in with the Google account that owns AdMob. |