AdSense Management API v1.2 & v1.3 are going away
If you have any questions about this migration, please contact us via the forum.
AFMC and AFS have been deprecated and are now ignored by the API. Valid values are AFC, AFG and AFV.mobileContentAdsSettings information for an AdUnit will no longer be populated since AFMC is no longer supported; the fields will still be returned but they will be empty.Today we’re announcing the availability of three new reporting dimensions created specifically for AdMob publishers: APP_ID, APP_NAME, and APP_PLATFORM.
Here’s how they work:
These new dimensions are available now in the AdSense Management API. If you’re unfamiliar with it, the AdSense Management API is a web-based API that you can query to get information about your AdSense account. There are client libraries for a number of platforms, though any standard HTTP client can send requests to it and parse the responses. With a little code and these new dimensions, you can create custom reports about a single app, a family of them, or even your entire platform lineup!
For more information on building and customizing AdMob reports, check out the reporting section of the AdMob developer site. You can also use the API Explorer to test out queries that include these fields.
account.name property will have the company name or, in its absence, the contact name. If you still want to show the account ID, just use the id field.adclients.list, adunits.getAdCode, etc. and specify an account ID for every call. For that, use accounts.adclients.list, accounts.adunits.getAdCode, etc. You’ll find the whole list of calls in the API reference pages.accounts.listtoday, yesterday, firstDayOfMonth-1m, etc.), the response now includes the date range you requested.
{
"kind": "adsense#reportingMetadataEntry",
"id": "EXAMPLE_DIMENSION",
"compatibleDimensions": [
"1",
"2",
"4",
...
],
"compatibleMetrics": [
"AD_REQUESTS",
"AD_REQUESTS_COVERAGE",
"AD_REQUESTS_CTR",
...
],
"supportedProducts": [
"AFMC",
"AFC",
"AFV"
]
},
The compatibleDimensions field shows a list where each item is an integer representing a group of compatible dimensions. As there is no one-to-one relation between compatible dimensions, they are represented as groups (as shown below).| Group #1 | Group #2 | Group #3 | Group #4 |
| AD_CLIENT_ID AD_FORMAT_CODE AD_FORMAT_NAME BID_TYPE_CODE BID_TYPE_NAME DATE DOMAIN_NAME MONTH PLATFORM_TYPE_CODE PLATFORM_TYPE_NAME PRODUCT_CODE PRODUCT_NAME TARGETING_TYPE_CODE TARGETING_TYPE_NAME WEEK |
AD_CLIENT_ID AD_FORMAT_CODE AD_FORMAT_NAME BID_TYPE_CODE BID_TYPE_NAME BUYER_NETWORK_ID BUYER_NETWORK_NAME DATE MONTH PLATFORM_TYPE_CODE PLATFORM_TYPE_NAME PRODUCT_CODE PRODUCT_NAME TARGETING_TYPE_CODE TARGETING_TYPE_NAME WEEK |
AD_CLIENT_ID AD_FORMAT_CODE AD_FORMAT_NAME AD_UNIT_CODE AD_UNIT_ID AD_UNIT_NAME AD_UNIT_SIZE_CODE AD_UNIT_SIZE_NAME BID_TYPE_CODE BID_TYPE_NAME COUNTRY_CODE COUNTRY_NAME DATE MONTH PLATFORM_TYPE_CODE PLATFORM_TYPE_NAME PRODUCT_CODE PRODUCT_NAME TARGETING_TYPE_CODE TARGETING_TYPE_NAME WEEK |
AD_CLIENT_ID AD_FORMAT_CODE AD_FORMAT_NAME BID_TYPE_CODE BID_TYPE_NAME COUNTRY_CODE COUNTRY_NAME CUSTOM_CHANNEL_CODE CUSTOM_CHANNEL_ID CUSTOM_CHANNEL_NAME DATE MONTH PLATFORM_TYPE_CODE PLATFORM_TYPE_NAME PRODUCT_CODE PRODUCT_NAME TARGETING_TYPE_CODE TARGETING_TYPE_NAME WEEK |
Version 1.3 of the AdSense Management API is now available and comes with new features to help you retrieve more publisher and reporting information.
Metadata for reporting dimensions and metrics
This is a highly requested feature that provides information on the list of available dimensions and metrics for the publishers, as well as their compatibility. This is useful to help developers avoid generating reports with invalid dimensions and metrics.
Alerts
You can now list the publisher’s current alerts, in their default language or in the one you specify.
Ad code
You can now programmatically fetch the code of an ad unit using getAdCode.
Remember to visit the AdSense API forums or our Google+ page if you need any help implementing these new features!
- Jose Alcérreca, AdSense API Team
YYYY-MM-DD format, all date fields accept the following special keywords:todaystartOfMonthstartOfYear| Start date | End date | |
|---|---|---|
| This month’s performance so far | startOfMonth |
today |
| This year’s performance so far | startOfYear |
today |
| Start date | End date | |
|---|---|---|
| Last 7 days’ performance | today-6d |
today |
| Last month’s performance | startOfMonth-1m |
startOfMonth-1d |
| Previous six months | startOfMonth-6m |
startOfMonth-1d |
| Start date | End date | |
|---|---|---|
| Last month’s performance | startOfMonth-1m |
startOfMonth-1d |
| Same month last year | startOfMonth-1m-1y |
startOfMonth-1d-1y |
https://www.googleapis.com/adsense/v1.1/with
https://www.googleapis.com/adsense/v1.2/That will allow you to continue using the API as you were and should require no further modifications to your code.
trunk/src/contrib/Google_AdSenseService.php but you should update all the files you use.http = httplib2.Http()
service = build("adsense", "v1.2", http=http)If you've recently visited any of the Google Ads Developer documentation, you may have noticed a "Feedback on this document" link at the top right corner of a page. That's right—you can now use that link to report errors, comment on existing content, or request further clarification for any of the Google Ads Developer docs:
In addition to this new channel, you can continue to reach out to us through the developer forums or Google Developers Live events.
Quang Nguyen, Ads Developer Relations Team
Today we are excited to introduce a new channel for communication - Ads Developers Google+ Page. It's a place to stay informed, engaged and connected on Ads products and developer tools.
Add our Google+ page to your circles for the latest product and feature announcements, best practices, case studies, as well as opportunities to interact with and learn from Google's Ads Developer Relations team and other members of the developer community.
We look forward to having one place to bring timely updates, concise announcements, and to share information in multimedia formats across all Ads products, as well as to listen and respond to your comments.
A few months ago Ben Birt and Nick Johnson gave us some useful insights about the development of the AdSense Management API. This week, Gregory Block shares his experience of development against the API. Greg started the Google Publisher Toolbar project and is now the Team Leader of the development behind it.
Hello Greg, thanks for agreeing to be interviewed! Can you briefly describe your project and why you started the development?
The project started as a thought experiment - what would AdSense look like if we didn’t have a web interface for people to log in to, and we could only give you information within the context of your own site? It was originally called “AdSense Minus AdSense”, in homage to Garfield Minus Garfield.
Now, it’s a central part of our publisher strategy moving forward. Our customers use our products in concert with one another, but we send them to each product to figure out what’s going on.
Think of it as an “in-context” review tool for everything you do with your site. Ultimately, it will incorporate all of our platforms - AdSense, the DoubleClick Ad Exchange, DoubleClick for Publishers, Analytics, Webmaster Tools... we want you to know about all the information available within the context of the page you’re looking at.
People look at the websites they build and manage hundreds or thousands (and for some, more) of times each working day; they use our frontends only sporadically. We push information down into the place they need it most, at the right moment, in the right context.
You have more than 18 thousand users and an average rating of 4 stars: are you happy with your project?
It’s been hugely successful internally at convincing people to look beyond product silos and really focus on the needs of our end users. Ultimately, I’m aiming to provide a better, more accessible, more immediate, and more integrated experience than they can get from our web products. We’re going to support the whole publisher ecosystem, and I’m excited about all of the things we can do in that space.
It’s also a great showcase for our APIs - most of what the chrome extension does is accessible by any user from our public APIs.
What about the development process? Do you have any suggestions for other developers?
The process begins and ends with the end user. Efforts like the Google Publisher Toolbar drove our API strategy because we had a clear need we were trying to meet. Know your user, and have a clear vision for the product and how it helps that user do what they need to do.
Behind every good app is a good idea; but a good idea isn’t good enough - execution matters. The other important thing, in my opinion, is the toolchain. We take a strict approach towards building verifiably correct JavaScript, enforce strong type safety, and we bake in unit testing at development time. The toolbar isn’t one binary - it’s lots of binaries, all interacting with each other through messaging and callbacks, and we wouldn’t be able to get here without the help and support of our tools infrastructure.
If you had to mention one thing about developing against the AdSense API that positively impressed you during the development, what would that be?
Speed, speed, speed. A thin skin on the API is an order of magnitude faster than anything you can get out of our frontends. I think the API is well within reach of most of our publishers, and we can learn a lot from what people build from it. Some of those ideas we’ll be able to feed back in.
First and foremost, use the client libraries. There’s a vast amount of stuff taken care of automatically, and you’ll write and maintain less code.
Second, get your OAuth2 flow in place early. You’re going to spend a lot of time using it, and so it’s best to get that done right away. You’ll be tempted to just hack in a key you generated by hand into the source, but user experience matters. (I’m speaking from my own failures here.)
Third, think about security. We take a very, very cautious approach about inserting content into the page, and deciding what information is allowed to live in the DOM. We could improve the user experience by loosening that restriction, but we’re looking to bulletproof the product against social engineering and information leakage. As new features propagate down through the chrome versions, we’ll be using more and more of those secure mechanisms to deliver content in-site - the Chrome Infobars API, for example, will allow us to replace our in-page notification bar with one that is less intrusive to the user and doesn’t interact with page content. Sandboxed iframes will allow us to further restrict the security container of the in-page content, and allow us to move content that previously lived in stand-alone windows into in-page overlays and provide a richer experience to publishers. We use chrome as our sole platform because it’s secure - and when it comes to surfacing sensitive information like publisher revenue, security matters.
Last, prototype early, prototype often. There’s a whole skunkworks Android application we launched solely to experiment with and theorize on. Moreover, and in many ways more importantly, I depend on a UX person to cycle through a lot of ideas with me before roughing them out in code; we then cycle back through and iterate once we’re looking at implementations until we’re happy. On more than one occasion, I’ve cut a corner and not fully implemented something that was different in the mocks, and I’ve regretted it every. single. time. Don’t underestimate the power of good design.
And if you had the magic powers to request one additional feature and have it released immediately, what would that feature be?
In the immortal words of River Song, “Spoilers”.
What else do you do at Google?
I’m also responsible for the DoubleClick Ad Exchange Seller frontend here in London, as well as running a team called Publisher Insights that recommends revenue-impacting changes to the sites of AdSense and Ad Exchange publishers through simulated A/B experimentation.
Let’s talk hobbies and personal interests. What interests do you have outside work?
I play an awful lot of video games. I play through most games exactly once, to keep the size of the Pile of Shame (the games I bought but haven’t played yet) low. I’m currently on Act 3 of Diablo 3, and having mixed emotions about the experience.
I also have a Basset Hound named Daisy, who takes up an inordinate but pleasurable amount of my time.
Soooo.....what about Mass Effect3?
Utterly devastated. Taking reasonably ‘hard sci-fi’ and giving it a magical ending is a cardinal sin; I literally wish I could un-play all three. No amount of tender, love and care is going to help me forget.
There. I’ve said it. I feel better already.
Thanks Greg! Keep up the good work!
- Silvano Luciani, AdSense API Team
- Gregory Block, Ad Exchange Team
Recent visitors to any of the Ads API documentation pages will have noticed their shiny new appearance and a message to let you know the docs have moved to a new platform:
This move is much more than a skin-deep makeover. As we’ve blogged before, the new Google Developers platform is so named to reflect our focus on you, and not just on the tools we provide.
Follow the links below to take a look at the full range of Ads API docs on Google Developers:
We’ll continue to try to improve the Ads API docs on Google Developers while, over time, Google Code returns to its original purpose as an open source project hosting service. Visits to the old Google Code docs will be redirected to the corresponding Google Developers docs throughout 2012, so be sure to update your bookmarks soon.
If you have any questions about these changes please reach out to us through any of the Ads API forums or office hours.
Lesley Burr, Ads Developer Relations Team