Google AdSense provides a free, flexible way to earn money from your websites, mobile sites, and site search results with relevant and engaging ads.
There are two AdSense APIs: The AdSense Management API and the AdSense Host API, which is only available to Host partners.
AdSense Management API
The AdSense Management API lets you:
- Fetch inventory: Retrieve lists of an account’s ad clients, ad units, saved styles, custom channels and URL channels.
- Run reports: Download performance data for an account: earnings, pageviews, CTR, and RPM for example.
- Get alerts: Retrieve important messages related to AdSense for an account.
Download the client libraries for the language of your choice. Some of them have specific samples for the AdSense Management API. The client libraries will handle everything for you to make the development easier but you can also make your own direct requests.
If you need help implementing the integration or want to be informed of new releases and announcements:
AdSense Host API
The Google AdSense Host API is ideal for developers whose users create their own content through blogging, web publishing, forum/wiki/community creation, or any other application where substantial web content is generated. You choose how you want the AdSense revenue on user-generated pages to be allocated between you and the users creating the content.
Access reporting data with BigQuery
As an alternative to using the APIs, you can access your AdSense reporting data in BigQuery. This means you can easily run complex SQL-like queries over your reporting data, run very large reports, and join AdSense reports with your own data. See the AdSense BigQuery Integration Guide.