How do i add USER_INTEREST in campaign level

47 views
Skip to first unread message

Arnab Ganguly

unread,
Oct 25, 2019, 4:57:15 PM10/25/19
to AdWords API and Google Ads API Forum
Hello All
Is there any xsi_type for  USER_INTEREST ? Any python sample for adding USER_INTEREST in campaign level ?
Thanks,
Arnab

Google Ads API Forum Advisor Prod

unread,
Oct 25, 2019, 6:37:56 PM10/25/19
to agang...@gmail.com, adwor...@googlegroups.com

Hi Arnab,

Thank you for reaching out. As seen here, user interest criteria are only supported for negative criterion at the campaign level. You would do this through the CampaignCriterionServiceHere is an example for adding supported criterion types to a campaign (or here if you're using Google Ads API).

Regards,
Anthony
Google Ads API Team



ref:_00D1U1174p._5001UKOW98:ref

Arnab Ganguly

unread,
Oct 25, 2019, 6:46:20 PM10/25/19
to Google Ads API Forum Advisor Prod, adwor...@googlegroups.com
Hey Anthony,
Thanks for your reply.Do we plan to support this for positive campaign as well ?
Regards,
Arnab

Arnab Ganguly

unread,
Oct 25, 2019, 7:27:56 PM10/25/19
to AdWords API and Google Ads API Forum

I am trying with below request.But it is giving internal error.


# Add the negative campaign criterion.

  negative_campaign_criterion_operand = {

      'xsi_type': 'NegativeCampaignCriterion',

      'campaignId': CAMPAIGN_ID,

      'criterion': {

          'xsi_type': 'CriterionUserInterest',

          'id': '80142'

      }

  }

  operations.append({

      'operator': 'ADD',

      'operand': negative_campaign_criterion_operand

  })


  # Make the mutate request.

  result = campaign_criterion_service.mutate(operations)

Google Ads API Forum Advisor Prod

unread,
Oct 25, 2019, 7:52:49 PM10/25/19
to agang...@gmail.com, adwor...@googlegroups.com

Hi Arnab,

You can follow our developer blog for information regarding future releases.

For your other concern, can you please provide the complete SOAP logs for your request so that we can investigate further? See here for more details on how to enable logging.



Regards,
Anthony
Google Ads API Team



ref:_00D1U1174p._5001UKOW98:ref

Arnab Ganguly

unread,
Oct 29, 2019, 4:16:59 PM10/29/19
to AdWords API and Google Ads API Forum
Following url: https://groups.google.com/forum/#!searchin/adwords-api/audience$20in-market%7Csort:date/adwords-api/k6NcD2GrTVQ/EJ59JeKdBwAJ
UserInterest is added as part of the criteria in adgroup level
shows it can be added as a negative level only can you please clarify.
Thanks,
Arnab

Google Ads API Forum Advisor Prod

unread,
Oct 29, 2019, 6:28:01 PM10/29/19
to agang...@gmail.com, adwor...@googlegroups.com
Hi Arnab,

That is correct. User Interests can only be added at the ad group level. From the campaign level, it is only available as a negative criteria.

Here is a snippet you can use to add negative criteria:

 negative_campaign_criterion_operand = {

   'xsi_type': 'NegativeCampaignCriterion',

   'campaignId': campaign_id,

   'criterion': {

     'xsi_type': 'CriterionUserInterest',

     'userInterestId': '80142',

Arnab Ganguly

unread,
Oct 30, 2019, 10:59:56 AM10/30/19
to Google Ads API Forum Advisor Prod, adwor...@googlegroups.com
I was able to add UserInterest under campaign.Below I have given the log for reference and python code snippet.Correct my if I am wrong.


campaign_criterion_service = adwords_client.GetService(

      'CampaignCriterionService', version='v201809')


criteria = [{'id': '1000', 'xsi_type': 'Language'}, {'id': '9004400', 'xsi_type': 'Location'}]


criteria.append({

          'xsi_type': 'CriterionUserInterest',

          'userInterestId': '80142'

      })


operations = []

  for criterion in criteria:

    operations.append({

        'operator': 'ADD',

        'operand': {

            'campaignId': CAMPAIGN_ID,

            'criterion': criterion

        }

    })


result = campaign_criterion_service.mutate(operations)


  # Display the resulting campaign criteria.

  for campaign_criterion in result['value']:

    print('Campaign criterion with campaign id "%s", criterion id "%s", '

          'and type "%s" was added.'

          % (campaign_criterion['campaignId'],

              campaign_criterion['criterion']['id'],

              campaign_criterion['criterion']['type']))


In log I saw this :

Campaign criterion with campaign id "7761432172", criterion id "50797975515", and type "USER_INTEREST" was added.

(I have deleted the campaign though later)


Reply all
Reply to author
Forward
0 new messages