How to update demographic negative by Google Ads API v7

2021-05-18 Thread Rukeith Tseng
Hi, does it have any way to update demographic negative fields ?
In Google Ads UI, the age range '45to55' of a ad group is exclude. I want 
to switch to Enable.
I have try to update to negative field, the API show it's immutable. So I 
try to delete it first then create. But I found it still not working.

Any way to update demographic ?? 

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/de573e65-3a70-469e-be94-f7c0c0dc245en%40googlegroups.com.


How could I get audience data by Google Ads API?

2021-05-13 Thread Rukeith Tseng
How could I get the audience data by Google Ads API?
Here is the screenshot that I want to get the data.
How could I get the audience list? And How could I get which audiences are 
at the ad group or campaign?

[image: Screen Shot 2021-05-13 at 15.08.30.png]

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/b5a1134a-bce8-4bdc-888d-02445f713aa9n%40googlegroups.com.


Could Google Ads API create campaign group?

2021-04-22 Thread Rukeith Tseng
I found adwords API could create campaign group. Could Google Ads API 
create campaign group too?


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/a64a2bb6-ccb5-4d4b-9a3e-7c7648192fban%40googlegroups.com.


Re: How could I update campaign bidding strategy with standard bidding strategies

2021-01-21 Thread Rukeith Tseng
Hi,
   I know that. What I ask for is how could I set MaximumConversionValue 
without target_roas?
Does it have any python examples? It's not successful while I set 
bidding_strategy field directly.

On Friday, January 22, 2021 at 4:14:18 AM UTC+8 adsapiforumadvisor wrote:

> Hello,
>
> The target_roas for MaximumConversionValue is an optional field to set. If 
> it is not set, then the bid strategy will aim to achieve the highest 
> possible ROAS for the budget.
>
> Regards,
>
> Anthony
>
> [image: Google Logo] 
> Anthony 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q2B1PpN:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c324e52f-4137-4932-b61f-57ea1fd906d9n%40googlegroups.com.


Re: How could I update campaign bidding strategy with standard bidding strategies

2021-01-20 Thread Rukeith Tseng
Hi Anthony,
 I know this doc. But I want to set MAXIMIZE_CONVERSION_VALUE without 
the setting target_roas. What is like Google Ads UI.

On Tuesday, January 19, 2021 at 10:34:40 PM UTC+8 adsapiforumadvisor wrote:

> Hello,
>
> You will need to update the campaign_bidding_strategy 
> 
>  
> union field as described from the link you shared. This Python example 
> 
>  
> shows how to create a local campaign with a standard 
> MAXIMIZE_CONVERSION_VALUE bidding strategy. As you can see, it is setting 
> the target_roas 
> 
>  
> of this bid strategy. 
>
> Cheers,
> Anthony
>
> [image: Google Logo] 
> Anthony 
> Google Ads API Team 
>   
>  
>
> ref:_00D1U1174p._5004Q2B1PpN:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6675c8a7-f4cc-43e8-885a-beaa4f8d70adn%40googlegroups.com.


How could I update campaign bidding strategy with standard bidding strategies

2021-01-19 Thread Rukeith Tseng


I found this document link 

.

Standard bidding strategies don't have python example.
How could I update the campaign bidding strategy with standard bidding 
strategies?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/a8c572b9-540a-4ff7-9079-f3315107bb8bn%40googlegroups.com.


Re: How could I set bidding strategy to TARGET_SPEND

2020-11-18 Thread Rukeith Tseng
Hi,
I have tried a few ways to enable TARGET_SPEND, but it still not work.

1. 
campaign.target_spend.target_spend_micros = 1000

2. 
campaign.target_spend = Ture

3. 
campaign.target_spend = Ture
fm = protobuf_helpers.field_mask(None, campaign)
fm.paths.append("target_spend")
campaign_operation.update_mask.CopyFrom(fm)


adsapiforumadvisor 在 2020年11月19日 星期四上午3:26:59 [UTC+8] 的信中寫道:

> Hi Rukeith,
>
> Thank you for reaching out. For the Google Ads API, you could refer to 
> this code snippet 
> on
>  
> how to enable the TARGET_SPEND bidding strategy.
>
>
>
> Thanks and regards,
> Xiaoming, Google Ads API Team
>
>  
> [image: Google Logo] 
> Xiaoming 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q27uO3F:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/b9decb20-d901-42f0-aae6-33ada7245d73n%40googlegroups.com.


Re: How could I set bidding strategy to TARGET_SPEND

2020-11-17 Thread Rukeith Tseng

Sorry about my description.
I am using the Google Ads API not the old Adwords API.
I could not figure out the method to set the bidding strategy from the code 
snippet.
adsapiforumadvisor 在 2020年11月18日 星期三上午4:15:50 [UTC+8] 的信中寫道:

> Hi Rukeith,
>
> Thank you for reaching out. This code snippet 
> 
>  
> shows where you could set the TARGET_SPEND as the bidding strategy.
>
> Thanks and regards,
> Xiaoming, Google Ads API Team
>
>  
> [image: Google Logo] 
> Xiaoming 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q27uO3F:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6f522336-604d-4ba0-a85c-4c02066f4c57n%40googlegroups.com.


How could I set bidding strategy to TARGET_SPEND

2020-11-16 Thread Rukeith Tseng
I want to set my campaing's bidding strategy to TARGET_SPEND.
Unfortunately, I couldn't find any examples for this.
I set 
campaign.bidding_strategy_type = client.get_type("BiddingStrategyTypeEnum", 
version="v6").TARGET_SPEND

But it didn't work. 
How could I set bidding strategy to TARGET_SPEND?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c2ed5dac-ee6c-4d0a-8b69-85f2d7b16209n%40googlegroups.com.


Re: How to set bidding strategy to MANUAL_CPC without

2020-10-28 Thread Rukeith Tseng
I have posted the issue on GitHub. Any on one response??
Does it have any info?
adsapiforumadvisor 在 2020年9月15日 星期二上午3:20:03 [UTC+8] 的信中寫道:

> Hi Rukeith,
>
> If the screenshot is of the results of the API request, it looks like the 
> Enhanced CPC option is not selected, which means the API request managed to 
> set enhanced_cpc_enabled to false. If the screenshot is not of the results, 
> I will need you to provide your customerClientId and the campaign ID that 
> is not getting updated from your request. It would be best if you can 
> provide the detailed logs so that I have all the information about your 
> request needed to further analyze the issue. Please provide all this 
> information via the *Reply privately to author *option.
>
>
> Regards,
> [image: Google Logo] 
> Danica 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q24aEqD:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/3f0d6aef-9a86-4e13-abf8-6843eee8c5e0n%40googlegroups.com.


Re: How to set bidding strategy to MANUAL_CPC without

2020-09-13 Thread Rukeith Tseng
Hi, the sample code is on my first post and the code works fine. It didn't 
show up any error. But the bidding strategy of the campaign didn't change.
I want the campaign's bidding strategy set to this. Manual CPC without 
enhanced.
[image: 截圖 2020-09-14 11.03.30.png]

adsapiforumadvisor 在 2020年9月12日 星期六上午1:16:08 [UTC+8] 的信中寫道:

> Hi Rukeith,
>
> Thanks for reaching out! I see that you are trying to update a campaign to 
> disable enhanced_cpc. For an example on how to update a campaign, you can 
> take a look at this 
>  
> sample 
> code for reference. If you are still unable to update your campaign, please 
> provide the complete detailed logs of the request and response so I can 
> take a closer look. You can see here 
>  
> for 
> our guide on how to enable logging. Please provide this via the *Reply 
> privately to author *option.
>
> Regards,
> [image: Google Logo] 
> Danica 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q24aEqD:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/7c97e649-b89a-4da7-b31b-3674cc65f7cfn%40googlegroups.com.


How to set bidding strategy to MANUAL_CPC without

2020-09-10 Thread Rukeith Tseng
Here is my example

```
def main(client, customer_id, campaign_id):
campaign_service = client.get_service("CampaignService", version="v5")
# Create campaign operation.
campaign_operation = client.get_type("CampaignOperation", version="v5")
campaign = campaign_operation.update
campaign.resource_name = campaign_service.campaign_path(
customer_id, campaign_id
)
# campaign.name = '20200817-ru'
campaign.status = client.get_type("CampaignStatusEnum", version="v5").PAUSED
campaign.manual_cpc.enhanced_cpc_enabled = False
fm = protobuf_helpers.field_mask(None, campaign)
campaign_operation.update_mask.CopyFrom(fm)

# Update the campaign.
try:
campaign_response = campaign_service.mutate_campaigns(
customer_id, [campaign_operation]
)
except google.ads.google_ads.errors.GoogleAdsException as ex:
print(
'Request with ID "%s" failed with status "%s" and includes the '
"following errors:" % (ex.request_id, ex.error.code().name)
)
for error in ex.failure.errors:
print('\tError with message "%s".' % error.message)
if error.location:
for field_path_element in error.location.field_path_elements:
print("\t\tOn field: %s" % field_path_element.field_name)
sys.exit(1)

print("Updated campaign %s." % campaign_response.results[0].resource_name)
```

But it doesn't work. How could I set campaign to manual_cpc without 
enhanced_cpc_enabled?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/2c61e09b-c061-4109-91b8-a95066af697fn%40googlegroups.com.


Re: How to use google ads api python to update keyword text value?

2020-03-16 Thread Rukeith Tseng
Hi David,
The ad type which I try to update is ExpandedTextAd

On Monday, 16 March 2020 19:29:22 UTC+8, David Wihl wrote:
>
> What type of ad are you trying to mutate? The list of ad types can be 
> found at: https://developers.google.com/google-ads/api/docs/ads/ad-types  
> The third column, Mutable, tells you whether you can mutate that specific 
> ad type. For example a TextAd is not mutable but a ExpandedTextAd is.
>
> -David
>
> On Sunday, March 15, 2020 at 11:30:30 PM UTC-4, Rukeith Tseng wrote:
>>
>> I am trying to update keyword text value via google ads api python sdk.
>> Here is my sample code
>>
>> import argparse
>> import sys
>>
>> from google.api_core import protobuf_helpers
>> from google.ads.google_ads.client import GoogleAdsClient
>> from google.ads.google_ads.util import ResourceName
>>
>>
>> def main(client, customer_id, ad_group_id, criterion_id):
>>agc_service = client.get_service('AdGroupCriterionService', version=
>> 'v3')
>>
>> ad_group_criterion_operation = client.get_type(
>> 'AdGroupCriterionOperation',
>>   version='v3')
>>
>> ad_group_criterion = ad_group_criterion_operation.update
>>ad_group_criterion.resource_name = agc_service.ad_group_criteria_path(
>>customer_id, ResourceName.format_composite(ad_group_id, 
>> criterion_id))
>>
>> // update here
>> ad_group_criterion.keyword.text.value = 'test-keyword'
>>
>>fm = protobuf_helpers.field_mask(None, ad_group_criterion)
>>ad_group_criterion_operation.update_mask.CopyFrom(fm)
>>
>> try:
>>agc_response = agc_service.mutate_ad_group_criteria(
>>customer_id, [ad_group_criterion_operation])
>>except google.ads.google_ads.errors.GoogleAdsException as ex:
>>print('Request with ID "%s" failed with status "%s" and includes 
>> the '
>>  'following errors:' % (ex.request_id, ex.error.code().name))
>>for error in ex.failure.errors:
>>print('\tError with message "%s".' % error.message)
>>if error.location:
>>for field_path_element in 
>> error.location.field_path_elements:
>>print('\t\tOn field: %s' % 
>> field_path_element.field_name)
>>sys.exit(1)
>>
>> print('Updated keyword %s.' % agc_response.results[0].resource_name)
>>
>>
>> if __name__ == '__main__':
>># GoogleAdsClient will read the google-ads.yaml configuration file in 
>> the
>># home directory if none is specified.
>>google_ads_client = GoogleAdsClient.load_from_storage()
>>parser = argparse.ArgumentParser(
>>description=('Pauses an ad in the specified customer\'s ad group.'
>> ))
>># The following argument(s) should be provided to run the example.
>>parser.add_argument('-c', '--customer_id', type=str,
>>required=True, help='The Google Ads customer ID.')
>>parser.add_argument('-a', '--ad_group_id', type=str,
>>required=True, help='The ad group ID.')
>>parser.add_argument('-k', '--criterion_id', type=str,
>>required=True, help='The criterion ID, or keyword 
>> ID.')
>>args = parser.parse_args()
>>
>> main(google_ads_client, args.customer_id, args.ad_group_id,
>> args.criterion_id)
>>
>>
>>
>> But I got an error like this:
>>
>> error_code {
>>request_error: IMMUTABLE_FIELD
>>  }
>>  message: "Field \'keyword.text\' cannot be modified by \'UPDATE\' 
>> operation."
>>  location {
>>field_path_elements {
>>  field_name: "operations"
>>  index {
>>  }
>>}
>>field_path_elements {
>>  field_name: "update"
>>}
>>field_path_elements {
>>  field_name: "keyword"
>>}
>>field_path_elements {
>>  field_name: "text"
>>}
>>  }
>> }
>> , 'OEhB_4KnhzMQaXAX0pvB2Q')
>>
>>
>>
>> I found that update expanded text ads will need to use AdService to 
>> update rather than AdGroupAdService.
>> Is that keyword need to use another service to update text value rather 
>> than AdGroupCriterionService?
>>
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=

How to use google ads api python to update keyword text value?

2020-03-15 Thread Rukeith Tseng
I am trying to update keyword text value via google ads api python sdk.
Here is my sample code

import argparse
import sys

from google.api_core import protobuf_helpers
from google.ads.google_ads.client import GoogleAdsClient
from google.ads.google_ads.util import ResourceName


def main(client, customer_id, ad_group_id, criterion_id):
   agc_service = client.get_service('AdGroupCriterionService', version='v3')

ad_group_criterion_operation = client.get_type(
'AdGroupCriterionOperation',
  version='v3')

ad_group_criterion = ad_group_criterion_operation.update
   ad_group_criterion.resource_name = agc_service.ad_group_criteria_path(
   customer_id, ResourceName.format_composite(ad_group_id, 
criterion_id))

// update here
ad_group_criterion.keyword.text.value = 'test-keyword'

   fm = protobuf_helpers.field_mask(None, ad_group_criterion)
   ad_group_criterion_operation.update_mask.CopyFrom(fm)

try:
   agc_response = agc_service.mutate_ad_group_criteria(
   customer_id, [ad_group_criterion_operation])
   except google.ads.google_ads.errors.GoogleAdsException as ex:
   print('Request with ID "%s" failed with status "%s" and includes the 
'
 'following errors:' % (ex.request_id, ex.error.code().name))
   for error in ex.failure.errors:
   print('\tError with message "%s".' % error.message)
   if error.location:
   for field_path_element in error.location.field_path_elements:
   print('\t\tOn field: %s' % field_path_element.field_name)
   sys.exit(1)

print('Updated keyword %s.' % agc_response.results[0].resource_name)


if __name__ == '__main__':
   # GoogleAdsClient will read the google-ads.yaml configuration file in the
   # home directory if none is specified.
   google_ads_client = GoogleAdsClient.load_from_storage()
   parser = argparse.ArgumentParser(
   description=('Pauses an ad in the specified customer\'s ad group.'))
   # The following argument(s) should be provided to run the example.
   parser.add_argument('-c', '--customer_id', type=str,
   required=True, help='The Google Ads customer ID.')
   parser.add_argument('-a', '--ad_group_id', type=str,
   required=True, help='The ad group ID.')
   parser.add_argument('-k', '--criterion_id', type=str,
   required=True, help='The criterion ID, or keyword 
ID.')
   args = parser.parse_args()

main(google_ads_client, args.customer_id, args.ad_group_id,
args.criterion_id)



But I got an error like this:

error_code {
   request_error: IMMUTABLE_FIELD
 }
 message: "Field \'keyword.text\' cannot be modified by \'UPDATE\' 
operation."
 location {
   field_path_elements {
 field_name: "operations"
 index {
 }
   }
   field_path_elements {
 field_name: "update"
   }
   field_path_elements {
 field_name: "keyword"
   }
   field_path_elements {
 field_name: "text"
   }
 }
}
, 'OEhB_4KnhzMQaXAX0pvB2Q')



I found that update expanded text ads will need to use AdService to update 
rather than AdGroupAdService.
Is that keyword need to use another service to update text value rather 
than AdGroupCriterionService?


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/a160a664-be0a-46b4-9ab5-be262e765b89%40googlegroups.com.


Re: How to update existing keyword text using adwords php client library

2020-03-15 Thread Rukeith Tseng
Your example did not match the question. The example cannot update keyword 
text only for stauts.

On Wednesday, 26 February 2020 02:19:17 UTC+8, adsapiforumadvisor wrote:
>
> Hi Mohsin,
>
> Thank you for reaching out. It is possible to update an existing keyword. 
> You can follow this example 
> 
>  
> (also available in other languages).
>
> Regards,
> Mitchell
> Google Ads API Team
>
> ref:_00D1U1174p._5001UXT9Fw:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c33c3e1c-9ccb-4a52-8b84-c040bd8316c0%40googlegroups.com.