google-apiadmobadsenseadsense-api

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?


Solution

  • 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