I'm trying to get access to Display Ad images via the Google Ads API. At the moment, my code doesn't seem to be working for certain ads. As near as I can tell from my debugging efforts so far, the issue is that it's not working for HTML5 ads.

Here is the query I'm using :

SELECT      ad_group.name,      campaign.name,      ad_group_ad.ad.responsive_display_ad.logo_images,      ad_group_ad.ad.responsive_display_ad.marketing_images,      ad_group_ad.ad.image_ad.preview_image_url,      ad_group_ad.ad.image_ad.image_url FROM     ad_group_ad WHERE     campaign.advertising_channel_type = \'DISPLAY\' LIMIT     100 

For accounts using HTML5 ads, there is nothing returned for any of the last (4) fields. For other accounts, I'm using the "ad_group_ad.ad.image_ad.image_url" field to get the ad image.

What am I missing?

Tag:google-ads-api, google-ad-manager

Only one comment.

  1. dorian

    ad_group_ad.ad has a pseudo-attribute ad_data which is a Union field that will have one specific, effective name depending on what type of ad is represented. See the documentation of the Ad resource.

    Specifically, this means that all fields below ad_group_ad.ad.image_ad such as image_url will only be populated for an ad of type IMAGE_AD. Similarly, ad.responsive_display_ad.* will only contain data for ads with type RESPONSIVE_DISPLAY_AD.

    For an HTML5 ad, you can access the available fields using the selector ad_group_ad.ad.display_upload_ad. You won't be able to obtain an image of the ad, however.

Add a new comment.