4 Questions about Google Ads APi

74 views
Skip to first unread message

kentaro fukagawa

unread,
Aug 23, 2021, 12:13:13 PM8/23/21
to AdWords API and Google Ads API Forum
(1) About ad extensions
How to set ad extensions via API.
I don't know which API items I should set when I submit an ad, so please tell me.
The items we want to set are site link extensions, callout extensions, and price extensions.

(2) About setting language
how to set the language when submitting a campaign?
How can I specify the language settings when I submit a campaign?
I would like to set the language to Japanese.

(3) About edit the ad text via api
How can I edit my ad text?
If I try to edit the ad text through the API, I get the following error message.
I would like to know how to solve this problem.

```python
ads_client = GoogleAdsClient.load_from_env(version='v8')
operation = ads_client.get_type('AdGroupAdOperation')
ad_group_ad = operation.update
ad_group_ad.resource_name = resource_name
ad_group_ad.ad.responsive_search_ad.headlines.extend([_create_ad_text_asset(text) for text in headlines])
ad_group_ad.ad.responsive_search_ad.descriptions.extend([_create_ad_text_asset(text) for text in descriptions])
ads_client.copy_from(operation.update_mask, protobuf_helpers.field_mask(None, operation.update._pb))
````
Here is the error returned by the API.
message: "Field \'ad.responsive_search_ad.headlines\' cannot be modified by \'UPDATE \' operation."
message: "Field \'ad.responsive_search_ad.descriptions\' cannot be modified by \'UPDATE \' operation."

4) About getting reports
Is it possible to get the number of views and clicks even for deleted campaigns and ad groups?

Google Ads API Forum Advisor

unread,
Aug 25, 2021, 11:12:15 PM8/25/21
to kfuk...@all-fit.co.jp, adwor...@googlegroups.com
Hi Kentaro,

Thank you for reaching out and for your questions. You may refer below for my responses :


1. About ad extensions

Since you are referring to extensions, you may go through this guide on which appropriate services you can use.

2. About setting language

Could you confirm if what you are referring to is targeting languages (LanguageInfo) at the campaign level? If yes then, for targeting languages, you can use the CampaignCriterionService. To target Japanese (and other languages) you can check out this guide on which codes to use. For Japanese, you can use the code = 1005.

However, if what you are looking for is to set the campaign itself to Japanese, then there's no attribute or setting for this. Could you confirm whether this is available in the Google Ads UI?

3. About edit the ad text via api

You can refer to this guide to learn which ad types can be mutated. You should also use the AdService for the mutates and you may then refer to this guide for an example.

4. About getting reports

You may check out our reporting guide on how to generate reports. You should also still be able to retrieve statistics of deleted campaigns or ad groups. As long as they have generated statistics, their records should still be accessible.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Mi34n:ref
Reply all
Reply to author
Forward
0 new messages