If you get campaign_conversion_goal based on custom_conversion_goal

2024-07-09 Thread xiaochuan li
hi team

I have now successfully linked custom_conversion_goal to a specific 
campaign by modifying conversion_goal_campaign_config.
Sample Code
```python
conversion_goal_campaign_config_service = client.get_service(
"ConversionGoalCampaignConfigService")
conversion_goal_campaign_config_operation = client.get_type(
"ConversionGoalCampaignConfigOperation")

conversion_goal_campaign_config.resource_name = 
"customers/xxx/conversionGoalCampaignConfigs/xxx"
conversion_goal_campaign_config.custom_conversion_goal = 
"customers/x/customConversionGoals/x"
client.copy_from(
conversion_goal_campaign_config_operation.update_mask,
protobuf_helpers.field_mask(None, conversion_goal_campaign_config._pb)
)
conversion_goal_campaign_config_service.mutate_conversion_goal_campaign_configs(
customer_id=customer_id, operations
=[conversion_goal_campaign_config_operation]
)
```
However, the custom_conversoin_goal added by modifying 
conversion_goal_campaign_config will display an unnecessary default custom 
conversion goal in the UI interface.
[image: Snipaste_2024-07-09_17-45-20.png]
I don't need goals other than custom, so I need to delete them. And I have 
successfully deleted them by comparing the campaign_conversion_goal of two 
campaigns with the same custom_conversion_goal and modifying the biddable. 
The sample code is as follows
```python
campaign_conversion_goal_service = client.get_service(
"CampaignConversionGoalService")
campaign_conversion_goal_operation = client.get_type(
"CampaignConversionGoalOperation")
campaign_conversion_goal = campaign_conversion_goal_operation.update
campaign_conversion_goal.resource_name = f"customers/{customer_id}
/campaignConversionGoals/x~{category}~{origin}"
campaign_conversion_goal.biddable = biddable
client.copy_from(
campaign_conversion_goal_operation.update_mask,
protobuf_helpers.field_mask(None, campaign_conversion_goal._pb)
)
campaign_conversion_goal_response = 
campaign_conversion_goal_service.mutate_campaign_conversion_goals(
customer_id=customer_id, operations=[campaign_conversion_goal_operation]
)
```
However, this will bring a problem, that is, I must know in advance which 
campaign uses the custom_conversion_goal I need, so that when I use this 
custom_conversion_goal, I can query the biddable in the 
campaign_conversion_goal and delete the default custom_conversion_goal. So, 
if I want to directly obtain the campaign_conversion_goal information 
through the condition of custom_conversion_goal.name = xxx, how should I do 
it?

Finally, a relatively complete sample code link 
https://stackblitz.com/edit/secret-python-gmjuzp?file=readme.md

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords 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/e7083d76-0400-43ad-a467-522b10f357bbn%40googlegroups.com.


How to select an existing custom goal when creating campaign

2024-07-05 Thread xiaochuan li
Can someone help me, I've been trapped for a week

stackoverflow 
link:  
https://stackoverflow.com/questions/78709475/how-to-select-an-existing-custom-goal-when-creating-campaign


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords 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/bb30adb1-50df-4d4b-ac35-ebf2942a380fn%40googlegroups.com.