Top 5 This Week

Related Posts

Google AdSense Management API Version 2.0

Google Adsense Api

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, the
accountId is specified in the parent field.
Per Google API standards, resources are now identified by a
name field. For example, an AdClient’s name would look like
accounts/{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 a reporting_dimension_id field
on several resources.
The kind field has been removed from all resources.

Account

The name field has been changed to
display_name.
The timezone field has been changed from a string to a
google.type.TimeZone.
The creation_time field (type int64) has been changed to
create_time (type google.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 the listChildAccounts
custom method. The full child account tree can be generated in v2 by calling
listChildAccounts 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 the
reporting_dimension_id field, which represents the unique ID
of the ad client as used in the AD_CLIENT_ID reporting
dimension. If reporting_dimension_id is empty, then the
AdClient doesn’t support reporting.

AdUnit

The status field has been renamed to state.
Also, the ACTIVE 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 the name field (after the last forward
slash).
The contentAdsSettings.backupOption field has been
removed.
The type field has been restricted to the values
TYPE_UNSPECIFIED, DISPLAY, FEED,
ARTICLE, MATCHED_CONTENT, and
LINK.
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 to
language_code.

CustomChannel

The code field has been removed. This value can still be
found at the end of the name 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 to date
and changed from type string to type google.type.Date.
The payment_amount field and the
payment_amount_currency_code field have been combined into a
single payment 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 the
Metadata.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 to
account.
The dimension field has been renamed to
dimensions.
The metric field has been renamed to
metrics.
The filter field has been renamed to
filters.
The sort field has been renamed to
order_by.
The locale field has been renamed to
language_code.
The currency field has been renamed to
currency_code.
You can now specify several common ranges with date_range
(e.g., TODAY, YESTERDAY,
MONTH_TO_DATE, YEAR_TO_DATE,
LAST_7_DAYS, and LAST_30_DAYS), or you can
specify a start_date and end_date by setting
date_range to CUSTOM.
The start_date and end_date fields have been
changed from type string to type google.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 with reporting_time_zone, which can have one of
two values: ACCOUNT_TIME_ZONE or
GOOGLE_TIME_ZONE (which means PST/PDT). The default in v2
is ACCOUNT_TIME_ZONE, which differs from the default in
v1.4.
The start_index field has been removed.
The max_results field has been renamed to
limit.

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 to
language_code.
The start_index field has been removed.
The max_results field has been removed.

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.

Popular Articles