我已经为我的安卓应用程序配置了adMob,没有问题。
现在,我正在寻找任何方法来检查我的应用程序的收益(如果可能的话,每个应用程序分开)在任何特定的时刻。
有人知道我是否可以使用任何API、库或Web访问我的AdMob帐户,获取有关我的应用程序统计数据的信息等等?
我已经检查了官方的APK,但它似乎只是为了显示您的应用程序中的广告,而不是其他任何东西。
提前感谢
发布于 2013-09-10 10:01:14
我自己回答。
我当时正在做一些研究,我发现在最近对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形式的结果。
发布于 2020-04-03 01:05:47
有一个AdMob API可以获取特定于AdMob的数据。
它提供了生成可用的网络和调解报告的可能性。它可以很简单,如:
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 --是谷歌云控制台上凭据页面中的一个。
卷曲
将oauth2_client_id替换为“Cloud凭据- OAuth 2.0客户机in”页面中的一个。(https://console.developers.google.com/apis/credentials?project=)
id=&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob
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"
}
https://stackoverflow.com/questions/18355748
复制相似问题