Following my last blog post on Youtube Analytics API, this post will be about Google AdSense (Management) API.
Prerequisites: You will need python 2.7 and a few libraries:
Authentication and Details: Below are a few steps you need to do beforehands:
- Create new Google project at google’s developers console
- Enable AdSense APIs at the
APIs & auth > APIs
tab:
- Generate your OAuth’s
client_secret.json
credentials at theAPIs & auth > Credentials
tab:
(Click Download JSON
after done)
- Get your
publisher_id
at your AdSense Home Page (publisher_id
will be displayed in the top right corner in a form of:pub-12345678901234
):
Firing your first ever API call (and also, generate your oauth2
credential file i.e adsense.dat
):
- In other to do this, we will use my version of AdSense API Sample file:
-
It’s also adviseable that you have a look at AdSense Management API Page for the list of
Metrics
,Dimensions
for your own reports. -
Sample result: