How to remove (set to NULL) "tracking_url_template"?

102 views
Skip to first unread message

Dmitriy P.

unread,
Jan 18, 2021, 11:59:34 AM1/18/21
to AdWords API and Google Ads API Forum
How to remove (set to NULL) "tracking_url_template"?

campaign_service = client.get_service("CampaignService", version="v6")
campaign_operation = client.get_type("CampaignOperation", version="v6")

campaign = campaign_operation.update
campaign.resource_name = campaign_service.campaign_path(customer_id, campaign_id)
campaign.tracking_url_template = "'' <- this not remove value

fm = protobuf_helpers.field_mask(None, campaign)
campaign_operation.update_mask.CopyFrom(fm)

Thanks in advance!

Google Ads API Forum Advisor Prod

unread,
Jan 18, 2021, 9:20:27 PM1/18/21
to madons...@gmail.com, adwor...@googlegroups.com
Hi Dmitriy,

Thanks for posting your concern.

Upon taking a closer look at the line of code below, I can see that after the equal sign, you've used double quote - single quote - single quote. This is the possible reason why empty value did not reflected on that field.
campaign.tracking_url_template = "''

With this, please try using double quote - double quote instead and let me know how it goes after. If the issue persists or you will encounter any errors, please provide the complete API request and response logs with request via Reply privately to author option.  

Since it appears that you are using Python client library, you can follow the guide below for enabling the logging the API transactions:
Python - https://developers.google.com/google-ads/api/docs/client-libs/python/logging

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2B1Ea3:ref

Osman Seçmen

unread,
Feb 21, 2022, 6:17:04 AM2/21/22
to Google Ads API and AdWords API Forum
Hello!
I am having the same problem and not able to fix it since 1 week! About to get crazy :) This should not be so complicated... I have been checking this page and related ones but no luck still :

How did you manage to solve it? I would really appreciate any help!
Thanks in advance!

Google Ads API Forum Advisor

unread,
Feb 21, 2022, 10:26:53 PM2/21/22
to adwor...@googlegroups.com
Hi Osman,

When setting a field to NULL or empty, you will need to include the said field in the update_mask, without setting any value or empty string. Let me know how this goes on your end.

Best regards,

Google Logo
Peter Laurence
Google Ads API Team
 


ref:_00D1U1174p._5004Q2B1Ea3:ref

Osman Seçmen

unread,
Feb 22, 2022, 5:45:17 AM2/22/22
to Google Ads API and AdWords API Forum
Hello Peter,
Thanks for your response. 
So, at the end I have implemented it by appending the said field on field_mask. You can see the code below. 

update_campaign.final_url_suffix = get_url_suffix(campaign_name)
empty_campaign = client.get_type('Campaign')
field_mask = protobuf_helpers.field_mask(
update_campaign, empty_campaign
)
field_mask.paths.append('tracking_url_template')
client.copy_from(
campaign_operation.update_mask,
field_mask,
) So it's not exactly the same as on the tutorial you sent here because it requires another call the api and there was type issues with the proto.Message so...
I hope mine is not a bad practice :) Issue is resolved, feel free to close the other thread I started here as well.
Cheers!

Reply all
Reply to author
Forward
0 new messages