Google has recently launched a new AdSense Management API. This goes from version version 1.4 all the way jumping to version 2.0 with this update. Version 1.4 will stop working on October 12, 2021. Google also made updates to the AdSense Host API.
Google has launched version 2 of the AdSense Management API. Please note that the current version of the AdSense Management API, version 1.4, will stop returning responses on October 12, 2021. Here is a list of features added or changed in version 2.0:
General
- All deprecated methods in v1.4 have been removed. This includes resource
methods that did not require an
accountId
. In v2, theaccountId
is specified in theparent
field. - Per Google API standards, resources are now identified by a
name
field. For example, an AdClient’s name would look likeaccounts/{accountId}/adclients/{adClientId}
. Additionally, in v1.4 the resource ID was used as a reporting dimension, but in v2 that value is now available through areporting_dimension_id
field on several resources. - The
kind
field has been removed from all resources.
Account
- The
name
field has been changed todisplay_name
. - The
timezone
field has been changed from a string to agoogle.type.TimeZone
. - The
creation_time
field (type int64) has been changed tocreate_time
(typegoogle.protobuf.Timestamp
). - Added a
pending_tasks
field which is a list of outstanding tasks that need to be completed as part of the sign-up process for a new account. For example, tasks could be related to your billing profile or phone verification. - The
sub_accounts
field has been removed. Similar functionality can be achieved in v2 with thelistChildAccounts
custom method. The full child account tree can be generated in v2 by callinglistChildAccounts
recursively.
AdClient
- Removed the
arc_opt_in
field since it has already been removed from the AdSense UI. - The
supports_reporting
field is replaced with thereporting_dimension_id
field, which represents the unique ID of the ad client as used in theAD_CLIENT_ID
reporting dimension. Ifreporting_dimension_id
is empty, then the AdClient doesn’t support reporting.
AdUnit
- The
status
field has been renamed tostate
. Also, theACTIVE
state no longer indicates whether there has been activity on this ad unit in the last seven days. In v2, it means the ad unit has been activated by the user and can serve ads. - The
code
field has been removed. This value can still be found at the end of thename
field (after the last forward slash). - The
contentAdsSettings.backupOption
field has been removed. - The
type
field has been restricted to the valuesTYPE_UNSPECIFIED
,DISPLAY
,FEED
,ARTICLE
,MATCHED_CONTENT
, andLINK
. - Other fields that have already been removed in the AdSense UI are also
removed:
custom_style
,saved_style_id
,mobile_content_ads_settings
,feed_ads_settings
.
Alert
- The
delete
method has been removed. - The
is_dismissible
field has been removed. - The
locale
field has been renamed tolanguage_code
.
CustomChannel
- The
code
field has been removed. This value can still be found at the end of thename
field (after the last forward slash). - The
targeting_info
field has been removed since it has already been removed from the AdSense UI.
Payment
- The
payment_date
field has been renamed todate
and changed from type string to typegoogle.type.Date
. - The
payment_amount
field and thepayment_amount_currency_code
field have been combined into a singlepayment
field (e.g., "¥1,235 JPY", "$1,234.57", "£87.65").
Report
- With v2, the AdSense Management API reporting data now aligns with the AdSense UI. This means that AdMob and YouTube properties are no longer supported. Additionally, the API will only support report data going back 3 years.
- The
Metadata.dimensions
resource and theMetadata.metrics
resource have been removed. - New methods have been added to generate a CSV version of the report, replacing the query parameters in v1.4. Note: for compression, you can still use the HTTP header "Accept-Encoding: gzip".
-
Some fields have been changed on ad-hoc report generation.
- The
account_id
field has been renamed toaccount
. - The
dimension
field has been renamed todimensions
. - The
metric
field has been renamed tometrics
. - The
filter
field has been renamed tofilters
. - The
sort
field has been renamed toorder_by
. - The
locale
field has been renamed tolanguage_code
. - The
currency
field has been renamed tocurrency_code
. - You can now specify several common ranges with
date_range
(e.g.,TODAY
,YESTERDAY
,MONTH_TO_DATE
,YEAR_TO_DATE
,LAST_7_DAYS
, andLAST_30_DAYS
), or you can specify astart_date
andend_date
by settingdate_range
toCUSTOM
. - The
start_date
andend_date
fields have been changed from type string to typegoogle.type.Date
. Note: as a result, relative date keywords (e.g., "today-6d") are no longer supported. - The boolean field
use_timezone_reporting
has been replaced withreporting_time_zone
, which can have one of two values:ACCOUNT_TIME_ZONE
orGOOGLE_TIME_ZONE
(which means PST/PDT). The default in v2 isACCOUNT_TIME_ZONE
, which differs from the default in v1.4. - The
start_index
field has been removed. - The
max_results
field has been renamed tolimit
.
- The
-
Some fields have been changed on saved report generation.
- Added date fields (
date_range
,start_date
,end_date
,reporting_time_zone
). - Added a
currency_code
field. - The
locale
field has been renamed tolanguage_code
. - The
start_index
field has been removed. - The
max_results
field has been removed.
- Added date fields (
SavedAdStyle
SavedAdStyle
has been removed since it has already been removed from the AdSense UI.
Site
-
Sites
have been added to fetch data about websites you've added to your AdSense account. - The
state
field represents whether the site is any of the following states:REQUIRES_REVIEW
,GETTING_READY
,READY
,NEEDS_ATTENTION
. - The
auto_ads_enabled
field is a boolean that represents whether auto ads have been enabled on a particular site.
Forum discussion at Twitter.