AdMob:如何根据我的应用收入查询admob

时间:2013-08-21 11:05:29

标签: service web admob

我已经为我的Android应用配置了adMob,并且没有问题。

现在我正在寻找任何方式来检查我的应用收入(如果可能的话,每个应用程序可以单独使用)。

有人知道我是否可以使用任何API,图书馆或网络服务来访问我的AdMob帐户并获取有关我的应用统计信息的信息等等?

我已经检查了官方APK,但似乎只是为了在您的应用中展示广告,而不是其他任何内容。

提前致谢

2 个答案:

答案 0 :(得分:7)

我自己回答。

我正在做一些研究,我发现在最近AdMob的更改以及迁移到AdSense之后,您必须使用AdSense API来获取此信息。

特别是,每个Android应用都与“adunit”ID相关联,因此如果您想查看可能使用的任何特定应用的信息:

https://developers.google.com/adsense/management/v1.4/reference/accounts/reports/generate

包含以下数据:

accountId = your Publisher ID (pub-XXXXXXX)
startDate and endDate = The interval of dates you want to check
dimension = AD_UNIT_ID
metric = EARNINGS

使用此查询,您将获得所需的信息,以App分隔。

您以JSON格式获得结果。

答案 1 :(得分:0)

AdMob API可用于获取AdMob特定数据。

它提供了生成networkmediation可用报告的可能性。可能很简单:

curl -X POST https://admob.googleapis.com/v1/accounts/<your_publisher_id>/mediationReport:generate \
       -H "Authorization: Bearer <access_token>" \
       -H "Content-Type: application/json" \
       --data @- << EOF
{
  "report_spec": {
    "date_range": {
      "start_date": {"year": 2020, "month": 4, "day": 1},
      "end_date": {"year": 2020, "month": 4, "day": 1}
    },
    "dimensions": ["AD_SOURCE", "AD_UNIT", "PLATFORM"],
    "metrics": ["ESTIMATED_EARNINGS"]
  }
}
EOF

获取Oauth2.0访问令牌

使用oauth2l

安装:https://github.com/google/oauth2l

oauth2l header --json <path_to_secret_json> https://www.googleapis.com/auth/admob.report

path_to_secret_json -是Google云控制台上凭据页面中的一个。

有卷曲感

oauth2_client_id 替换为“云项目凭据-OAuth 2.0客户端ID”页面中的一个。 (https://console.developers.google.com/apis/credentials?project=

https://accounts.google.com/o/oauth2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadmob.report&response_type=code&client_id=&redirect_uri = urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob

  • 以隐身浏览器模式打开此链接;
  • 按照说明进行操作,并使用AdMob发布者的帐户接受辅音屏幕;
  • 复制代码,以下请求将需要它:
curl -L \
-d "client_id=<oauth2_client_id>" \
-d "client_secret=<oauth2_secret>" \
-d "grant_type=authorization_code" \
-d "code=<sign_in_code_from_the_previous_step>" \
-d "redirect_uri=urn:ietf:wg:oauth:2.0:oob" \
https://accounts.google.com/o/oauth2/token

oaut2_client_id oauth2_secret 可以在OAuth 2.0客户端ID页面上找到。

响应:

{
  "access_token": "<access_token>",
  "expires_in": 3600,
  "refresh_token": "<refresh_token>",
  "scope": "https://www.googleapis.com/auth/admob.report",
  "token_type": "Bearer"
}