How to use AdSense Management APIs in your website

Are you interested in using AdSense APIs to retrieve and display AdSense reporting information? If you have an AdSense account, you can join the AdSense Management API program and retrieve information programmatically.

Are you excited about the Google AdSense Management API announcement from Google? This announcement came as a surprise to many since this has been a request from many AdSense publishers for a long time and Google always kept their lips closed on this. Read this article to learn more about difference between AdSense Management API and AdSense Host API.

In this step by step tutorial, I will discuss how to use Google AdSense APIs to retrieve Adsense account information.

Step 1: Enable AdSense API Service in your Google Account

If you already have an approved AdSense account, you can that Google account to join the AdSense API program. Visit the Google API Console to apply for AdSense API program.

You may use any Google account to implement AdSense API application and it does not need to be an AdSense account. However, you will need an AdSense account to test the application you developed.

It will show you a welcome screen which you have to click on the button to proceed to the API console screen. After you reach the Console, you will be shown the list of available API services. You can click on the AdSense Management API button to enable it.

You will be taken to a screen and will be asked to agree to "AdSense Management API Terms and Conditions".

After you accept the Terms and Conditions, you will see that the AdSense APIs service is enabled for you.

Adsense Apis

Step 2: Generate an App Key

In the API Console, go to the API Access console. You will see that an App Key is automatically generated for you. This is unique key is required for you to make the API calls and Google will depend on this key to identify who is making the call.

Adsense Apis 2

You may optionally use OAuth 2.0 token for your project, but for this tutorials, we will use the simple App Key. You can create an App Key for your AdSense API project by clicking on the "Generate Key" link.

The above steps conclude the basic configuration required on your Google account to enable your application to start using the AdSense APIs.

In the next steps, I will discuss how to start using the APIs from your code and how to use the retrieved data.

Step 3: Start coding and call the APIs

Once you have the APIs enabled using the previous steps, you can start coding your application and call the AdSense Management APIs.

Before you call any APIs, you must authenticate the call. There are detailed documentation available on the Google website describing how to authenticate a user, get a client Auth token and how to use this token to make further API calls.

There are several client libraries available to make the authentication process easier. Client libraries are available in languages like .NET, Java, Python etc.

Read Difference between AdSense Management API and AdSense Host API

Related Articles

How to display more than 3 AdSense ad units in one page

Are you an AdSense user trying to find out how to use more than 3 ad units per page? Google AdSense program allows only 3 AdSense content Ads per page. In this article, I will give few work arounds to display more than 3 content ad units per page.

Protect your AdSense account from abuse by allowing only trusted sites

In this post, I will discuss how to protect your AdSense account by allowing only trusted sites to use your ad code. Enabling the proper settings in AdSense account will help you block others from using your AdSense ad code and help you from getting your AdSense disabled for abuse.

More articles: Google AdSense Ad Networks


Guest Author: Raj20 Oct 2017

This tutorial doesn't work any more. OAuth2 is a requirement now.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: