如何在Android应用中获取印象数字等AdMob信息?

时间:2017-01-31 11:39:51

标签: android admob reporting ads google-admob

我需要在Android应用内跟踪来自AdMob的报告。我需要的信息包括展示次数,点击次数,ctr,ecpm和估算收入。是否有某种支持这种情况的api?

3 个答案:

答案 0 :(得分:0)

我认为没有api可用于获取AdMob数据。

您可以在Mobile WebView

中使用此功能

由于

答案 1 :(得分:0)

我不确定我是否正确理解“在应用内部跟踪报道”中的含义,但您猜测可以使用AdSense API进行操作。

简单来说,每个应用都与adunit ID相关联,因此如果您想检查确定应用的统计信息,请检查: https://developers.google.com/adsense/management/v1.3/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
With this query you'll have the required info, separated by App.

答案 2 :(得分:0)

AdMob API:https://developers.google.com/admob/api

请求

curl -X POST https://admob.googleapis.com/v1/accounts/<your_publisher_id>/networkReport:generate \
       -H "'Authorization: Bearer <oauth2_access_token>" \
       -H "Content-Type: application/json" \
       --data @- << EOF
{
  "report_spec": {
    "date_range": {
      "start_date": {"year": 2020, "month": 4, "day": 2},
      "end_date": {"year": 2020, "month": 4, "day": 2}
    },
    "dimensions": ["APP", "AD_UNIT"],
    "metrics": ["AD_REQUESTS", "IMPRESSIONS", "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
可以在OAuth 2.0客户端ID页面上找到

oaut2_client_id oauth2_secret

响应:

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

有关开发者文档的更多详细信息:https://developers.google.com/admob/api/v1/getting-started