over_optimistic
over_optimistic

Reputation: 1419

using Adsense API, How can I find which application an admob ad unit id belongs to?

Adsense api returns ad unit names associated with the ad unit id. But the names aren't unique like "on main page". These adunits are part of an application created using admob. Some applications have more than 1 ad unit. I can't seem to find an api call that will tell me the application name an ad unit id belongs to. How can I get the application name of a adunit id using their API?

Upvotes: 2

Views: 3432

Answers (4)

Ibrahim
Ibrahim

Reputation: 6088

Update: Admob Now have a Dimension for App Name

Use this dimension: APP_NAME in the Advanced Reporting

Source: https://developers.google.com/admob/ios/reporting

Here is an example of getting the app name:

https://www.googleapis.com/adsense/v1.4/accounts/{{You account Id}}/reports?startDate=today&endDate=today&metric=EARNINGS&key={{YOUR API KEY}}&dimension=AD_UNIT_ID&dimension=AD_UNIT_NAME&dimension=APP_NAME

Now copy your App name, and add it inside filter, e.g. filter=APP_NAME%3D={{Your App Name}} to exclude other apps. Here is a complete example:

https://www.googleapis.com/adsense/v1.4/accounts/{{You account Id}}/reports?startDate=today&endDate=today&metric=EARNINGS&key={{YOUR API KEY}}&filter=APP_NAME%3D={{Your App Name}}&dimension=AD_UNIT_ID&dimension=AD_UNIT_NAME&dimension=APP_NAME

Upvotes: 1

Vladislav Ross
Vladislav Ross

Reputation: 581

There's currently no dimension for apps

Writing from the year 2017. Now you can use APP_ID / APP_NAME / APP_PLATFORM as filters or dimensions in reports. Combining APP_ID with AD_UNIT_ID you can separate ad units in report by appropriate apps.

Example:

'dimension' => ['DATE','AD_UNIT_ID'],
'filter' => 'APP_ID==2:com.my.app'

Prefix 1 is for iOS, 2 - for Android. You can also use numeric APP_ID - from App management page

More examples are in the docs

Upvotes: 1

Jose Alcérreca
Jose Alcérreca

Reputation: 2048

There's currently no dimension for apps. You can group the AdMob requests if you add AD_CLIENT_ID to the list of dimensions of your report, or filter them.

The ad units created with AdSense (for content) have ad client IDs similar to "ca-pub-1234567890" and the ones created with AdMob are different, like "ca-app-pub-1234567890".

Upvotes: 0

galeksic
galeksic

Reputation: 2176

As far I know, your-own ad unit "name convention" (like app001_abc, app002_def, app003_ghi) and "Contains substring" filters like AD_UNIT_NAME=@app001_, AD_UNIT_NAME=@app002_, AD_UNIT_NAME=@app003_ is probably the only option. (In v1.4.)

GET https://www.googleapis.com/adsense/v1.4/accounts/pub-0123456789012345/reports?startDate=today&endDate=today&dimension=AD_UNIT_ID&dimension=AD_UNIT_NAME&filter=AD_UNIT_NAME%3D%40app001_&metric=EARNINGS&key={YOUR_API_KEY}

https://developers.google.com/adsense/management/reporting/filtering https://developers.google.com/adsense/management/v1.4/reference/accounts/adunits#resource

Upvotes: 3

Related Questions