Reading asset attributes
You can get a list of assets and their attributes by sending a Google Ads Query
Language (GAQL) query to the GoogleAdsService. Assets
are represented by the asset
entity, which exposes a number
of asset-specific fields.
The following GAQL query lists all assets in an advertiser’s account along with their resource name and type.
SELECT
asset.id,
asset.name,
asset.resource_name,
asset.type
FROM asset
Note that there are type-specific attributes that you could add to the above
query to read properties specific to, say, ImageAsset
or
YoutubeVideoAsset
. For example, the query
below lists the YouTube video IDs for all
YoutubeVideoAsset
objects in an account by
filtering the asset.type
value (see the
documentation for a list of possible type values) for
YoutubeVideoAsset
.
SELECT
asset.id,
asset.name,
asset.resource_name,
asset.youtube_video_asset.youtube_video_id
FROM asset
WHERE asset.type = 'YOUTUBE_VIDEO'
Fetching ad-level metrics
Ad-level performance metrics for assets are aggregated in the
ad_group_ad_asset_view
. This view collects
metrics for assets per individual ad. Thus, querying this view returns a row per
ad group and ad.
performance_label | Description |
---|---|
BEST | Best performing assets. |
GOOD | Good performing assets. |
LOW | Worst performing assets. |
LEARNING | The asset has started getting impressions but the stats are not statistically significant enough to get an asset performance label. |
PENDING | This asset does not yet have any performance information. This may be because it is still under review. |
UNKNOWN | Represents value unknown in this version. |
UNSPECIFIED | Not specified. |
The GAQL query below, for example, would return impressions, clicks, costs, and
conversions for all assets in an account during the last month, sorted by their
performance_label
.
SELECT
ad_group_ad_asset_view.ad_group_ad,
ad_group_ad_asset_view.asset,
ad_group_ad_asset_view.field_type,
ad_group_ad_asset_view.performance_label,
metrics.impressions,
metrics.clicks,
metrics.cost_micros,
metrics.conversions
FROM ad_group_ad_asset_view
WHERE segments.date DURING LAST_MONTH
ORDER BY ad_group_ad_asset_view.performance_label