How to download HTML5 ad assets

650 views
Skip to first unread message

Jerry Dou

unread,
Dec 1, 2021, 12:10:36 PM12/1/21
to AdWords API and Google Ads API Forum
Hello,

I was wondering if it is possible at the moment to use Google Ads API v8 in Python to download the assets (.html, .jpg, .js, etc.) in a .zip file for an HTML5 ad.

I could do it for image ads pretty straightforward, since I can get the ad_group_ad.ad.image_ad.image_url field, then retrieve the url and save as a .png. But for HTML5 ad, there would be no ad_group_ad.ad.image_ad.image_url field. I tried using the ad_group_ad.ad.display_upload_ad.media_bundle field targeting at one specific HTML5 ad within our Google Ads account, and I was able to retrieve the asset resource name in the format of "customers/(account_id)/assets/(asset_id)", then I do (in Python):

asset_service = client.get_service("AssetService", version="v8")
asset = asset_service.get_asset(resource_name={resource_name of that HTML5 ad})
print(asset)
print(asset.media_bundle_asset.data)

And I can indeed retrieve an Asset object by running the above code, but there is no data in asset.media_bundle_asset.data, which is supposed to be a 'bytes' class in Python. I was wondering if I'm on the right path of getting the asset files for an HTML5 ad this way, or if there might be another way.

In addition, I did notice that, in Google Ads platform, if I click on an HTML5 ad, I can get an ad preview link. If I open this preview link, then I get to see this HTML5 ad, and I can right click this entire web page and save as a folder of files, which is exactly what I'm looking for from downloading from Google Ads API programmatically. So I was also wondering if I could get this preview link somewhere from Google Ads API.

Thank you!

Google Ads API Forum Advisor

unread,
Dec 2, 2021, 3:58:42 AM12/2/21
to je...@temerityanalytics.com, adwor...@googlegroups.com

Hi,

Thanks for reaching out to us.

Note that Google Ads API v8 was deprecated last November and will sunset in April/May 2022. You may use the Google Ads API v9, and refer to this guide for migrating from v8 to v9.

For HTML5 ad, could you provide us with the complete request and response logs with the request-id generated, so our team can better check?

If you haven't yet, logging can be enabled by navigating to the Client libraries > Your client library (ex. Python) > Logging documentation, which you can access from this link. You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Ry5Tz:ref

Zhe Lin

unread,
Nov 21, 2023, 9:45:37 PM11/21/23
to Google Ads API and AdWords API Forum
Hi there,

I have the same question.

Not about version upgrading, but about the asset.
So let 's say, in GoogleAds API v15,
if I have an asset resource name like "customers/(account_id)/assets/(asset_id)", how may I obtain the asset file (image or video) ?

Best regards,

Google Ads API Forum Advisor

unread,
Nov 22, 2023, 6:07:39 AM11/22/23
to zhe...@leadplus.co.jp, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

After reviewing your concern, I understand that you wanted to obtain an asset file using the asset resource name. I would recommend you refer to this help center article on How to access, add, or remove assets from the asset library for more information related to your query.

In order to assist you with the issue, we would like to see the uncropped UI screenshot of the issue and if you are getting any error message, please provide us the error message along with complete API logs (request and response with request-id and request header).

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02Ry5Tz:ref"

Thanks,
 
Google Logo Google Ads API Team


Google Ads API Forum Advisor

unread,
Nov 22, 2023, 6:10:08 AM11/22/23
to adwor...@googlegroups.com, zhe...@leadplus.co.jp
Hi,

Please ignore my previous response.


Thank you for getting back to us.

After reviewing your concern, I understand that you wanted to obtain an asset file using the asset resource name. I would recommend you refer to this help center article on How to access, add, or remove assets from the asset library for more information related to your query.

In order to assist you with the issue, we would like to see the uncropped UI screenshot of the issue and if you are getting any error message, please provide us the error message along with complete API logs (request and response with request-id and request header).

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
Reply all
Reply to author
Forward
0 new messages