Hello,

Any chance you can help me understand whats going on in the example code 
from that link? (Its slightly rewritten here)

```
def main(client, customer_id, campaign_id):
    # For creating the campaign object
    campaign_service = client.get_service("CampaignService")
    resource_name = campaign_service.campaign_path(
        customer_id, campaign_id
    )
    
    # Create campaign operation.
    campaign_operation = client.get_type("CampaignOperation")
    campaign = campaign_operation.update
    
    # Updates campaign object with resource ID
    campaign.resource_name = resource_name

    #campaign.status = client.enums.CampaignStatusEnum.PAUSED
    #campaign.network_settings.target_search_network = False
    
    # Retrieve a FieldMask for the fields configured in the campaign.
    client.copy_from(
        campaign_operation.update_mask,
        protobuf_helpers.field_mask(None, campaign._pb),
    )

    campaign_response = campaign_service.mutate_campaigns(
        customer_id=customer_id, operations=[campaign_operation]
    )

    print(f"Updated campaign {campaign_response.results[0].resource_name}.")
```

Specifically, what is client.copy_from doing? What is a "FieldMask", and do 
I need to reproduce this for what I am trying to achieve?

Thanks,
Chad

On Thursday, January 26, 2023 at 8:17:57 AM UTC-8 Chad Wood wrote:

> Hey Abigail, 
>
> Thanks a lot! This is going to be a huge help for tracking.
>
>
> On Wednesday, January 25, 2023 at 10:04:20 PM UTC-8 adsapi wrote:
>
>> Hi Chad,
>>
>> Thank you for reaching out to Google Ads API Support.
>>
>>
>> *>> Is it possible to add, remove, and change custom ValueTrack 
>> parameters at the campaign level via API? *
>> To answer your question, yes, it is possible. As per our documentation 
>> about Custom Parameters 
>> <https://developers.google.com/google-ads/api/docs/ads/upgraded-urls/fields#custom_parameters>,
>>  
>> the Campaign 
>> <https://developers.google.com/google-ads/api/docs/ads/upgraded-urls/supported-entities>
>>  
>> is a supported entity for Custom Parameters, and this is defined by the 
>> url_custom_parameters 
>> <https://developers.google.com/google-ads/api/reference/rpc/v12/Campaign#url_custom_parameters[]>
>>  
>> attribute.
>>
>> Although there is no code example from the documentation about adding / 
>> updating / removing Custom Parameters, you may refer to this update 
>> campaign example 
>> <https://developers.google.com/google-ads/api/samples/update-campaign#python>
>>  
>> from the documentation. They are a little bit similar, you just have to 
>> define your Campaign object, and set the url_custom_parameters 
>> <https://developers.google.com/google-ads/api/reference/rpc/v12/Campaign#url_custom_parameters[]>
>> .
>>
>> Also, you may see the following links for additional references. 
>>    
>>    - ValueTrack Parameters for Upgraded URLs 
>>    
>> <https://developers.google.com/google-ads/api/docs/ads/upgraded-urls/value-track>
>>  
>>    - Mapping ValueTrack Parameters with Report Fields 
>>    
>> <https://developers.google.com/google-ads/api/docs/reporting/valuetrack-mapping>
>>  
>>
>> Let me know if you have any other questions related to the Google Ads API.
>>
>> Regards,
>> [image: Google Logo] 
>> Abigail 
>> Google Ads API Team 
>>   
>>
>> ref:_00D1U1174p._5004Q2iNsig: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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/7da1aa1a-fbc7-4780-8ed9-1966218f51cen%40googlegroups.com.
  • Is... Chad Wood
    • ... Chad Wood
      • ... Chad Wood
        • ... Chad Wood
          • ... Chad Wood
            • ... Chad Wood
              • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
                • ... Chad Wood
                • ... Chad Wood
                • ... Chad Wood
                • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to