Adding labels to keywords

35 views
Skip to first unread message

Danieel Leite

unread,
Jan 29, 2019, 9:10:16 AM1/29/19
to AdWords API and Google Ads API Forum
Hello,

I'm struggling with a problem here related to labels. I wanted to know if it is possible to add keywords with labels already attached to them, instead of having to add the keywords, get their IDs and them assign the label to them.

I tried to use the operand below on AdGroupCriterionService (basically I added a 'labelId' parameter to the operand I use to add keywords), but I'm getting a syntax error (using Python on my scripts).

        keyword = {
            'xsi_type': 'BiddableAdGroupCriterion',
            'adGroupId': adgroup_dict_search_term['exact'],
            'criterion': {
                'xsi_type': 'Keyword',
                'matchType': 'EXACT',
                'text': search_term
            },
            'labelId': label_id
        }

Does anyone know if it is possible to do what I want? If so, how? If not, there's a better way to do this than by adding the keywords, looking for their IDs among the older keywords in the campaign and then adding the labels?

Thanks for the attention, hope you can help me.

Danieel Leite

googleadsapi...@google.com

unread,
Jan 29, 2019, 3:26:29 PM1/29/19
to AdWords API and Google Ads API Forum
Hello,

Please find my response below:

1. You will first need to use the LabelService.mutate to create the label with the specific text.
2. Add keyword using AdGroupCriterionService.mutate call. You can refer this sample code to add the keyword.
3. You will get the label id and keyword id from about API calls. You can use AdGroupCriterionService.mutatelabel call to set label to keyword.

Please check the guide on labels for more information. Please find the sample request and response. If you are facing any error, please share the error message or screenshot so that I can troubleshoot the issue.

Thanks,
Milind, AdWords API Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Reply all
Reply to author
Forward
0 new messages