Default value for Criterion

134 views
Skip to first unread message

Gary Jiang

unread,
Apr 16, 2018, 2:58:28 AM4/16/18
to AdWords API Forum
Hi,

I was trying to set up some criterion field for an adgroup, such as AgeRange using API, and I found that all items for that criteria are enabled by default, so I have to use  NegativeAdGroupCriterion.

For example, if I need to make AgeRange with "35 - 44" enabled, I am sending a request like this:


 
   {
                'xsi_type': 'AdGroupCriterionOperation',
                'operator': operator,
                'operand': {
                    'xsi_type': 'NegativeAdGroupCriterion',
                    'adGroupId': ad_group_id,
                    'criterion': {
                        'xsi_type': 'AgeRange',
                        'id': *id for 18-24*,
                    }
                }
            },
   {
                'xsi_type': 'AdGroupCriterionOperation',
                'operator': operator,
                'operand': {
                    'xsi_type': 'NegativeAdGroupCriterion',
                    'adGroupId': ad_group_id,
                    'criterion': {
                        'xsi_type': 'AgeRange',
                        'id': *id for 24-35*
                    }
                }
            },...

to disable all rest AgeRange. I was wondering if I use that correctly and if there is easier way. Thank
 
 
 

Vincent Racaza (AdWords API Team)

unread,
Apr 16, 2018, 4:11:54 AM4/16/18
to AdWords API Forum
Hi Gary,

You are correct that all ages are targeted by default as you can see in this guide. On the ad group level, you can target or exclude an AgeRange criterion as you can see in this table. So you have two options for the ad group level, either you target the AgeRange criterion using BiddableAdGroupCriterion to restrict your ad group for that age range only, or you exclude the AgeRange criterion using NegativeAdGroupCriterion in order for you to target all age ranges except that specific age range.

This said, if your goal is to enable/target the 35-44 age range only, then I suggest to target it using BiddableAdGroupCriterion.

Thanks,
Vincent
AdWords API Team

Gary Jiang

unread,
Apr 16, 2018, 2:55:05 PM4/16/18
to AdWords API Forum
Thanks, so does it mean that if I send a request with only one AgeRange targeted, all of the rest AgeRange will no longer be targeted  automatically?

Vincent Racaza (AdWords API Team)

unread,
Apr 17, 2018, 1:04:53 AM4/17/18
to AdWords API Forum
Hi Gary,

Yes, you are correct. The other age ranges won't be targeted anymore and only that AgeRange being specified as your BiddableAdGroupCriterion will only be the one being targeted.

hakumu lu

unread,
Apr 17, 2018, 6:43:24 AM4/17/18
to AdWords API Forum
i trying to fix like you :((

Vincent Racaza (AdWords API Team)

unread,
Apr 17, 2018, 11:02:53 PM4/17/18
to AdWords API Forum
Hi Hakumu,

Do you have any issues/clarifications regarding this? If so, please provide more information. If your concern is not related to this thread, please create a new forum thread so we can better track your concern.

Gary Jiang

unread,
Apr 20, 2018, 7:23:39 PM4/20/18
to AdWords API Forum
I tried sending a request setting 25-34 and 35-44 to be targeted only using BiddableAdGroupCriterion, but I found all of the other age ranges are enabled as well. So I found that they are all default targeted and this cannot be changed by https://developers.google.com/adwords/api/docs/reference/v201802/AdGroupService.TargetingSettingDetail ( I got error TARGETING_SETTING_DEMOGRAPHIC_CRITERION_TYPE_GROUPS_MUST_BE_SET_TO_TARGET_ALL). So I guess I have to use NegativeAdGroupCriterion?

Gary Jiang

unread,
Apr 20, 2018, 7:27:34 PM4/20/18
to AdWords API Forum
Also I was curious why the age range API cannot be implemented in such a way like you just pass a list of age range id to be targeted like [503999, 503001], and when editing an adgroup the new list can simply replace the old one, which I thought is more convenient  than resetting the criteria for each individual age range item and assigning the new value. 

Vincent Racaza (AdWords API Team)

unread,
Apr 23, 2018, 12:25:18 AM4/23/18
to AdWords API Forum
Hi Gary,

The TARGETING_SETTING_DEMOGRAPHIC_CRITERION_TYPE_GROUPS_MUST_BE_SET_TO_TARGET_ALL error means you explicitly set the targetAll field to false. Starting in v201802, you must set the targetAll = true (this is also true by default when creating new ad groups for each demographic criterion group) for the demographic criterion type groups as you can see in the release notes.  So before using the AdGroupCriterionService to target specific age ranges, if your targetAll is set to false, you can set the targetAll=true first in your ad group. After that, you can now target a specific age range in your ad group via AdGroupCriterionService with the ADD operator only. Below shows how I tested this on my test account:
  1.  Please see before_applying screenshot. This shows that by default, all the age ranges are targeted. 
  2.  Now, via API, I used the BiddableAdGroupCriterion to target the criterion IDs 503002 and 503003 for age ranges 25 to 34 and 35 to 44. See the after_applying screenshot that shows only the two age ranges are now being targeted.
This said, you can conveniently use the BiddableAdGroupCriterion or the NegativeAdGroupCriterion depending on your goal.
before_applying.png
after_applying.png

Gary Jiang

unread,
Apr 25, 2018, 2:02:35 AM4/25/18
to AdWords API and Google Ads API Forum
Sorry I was unable to reproduce that. Could you send me a screenshot in new adwords management interface as I always find all items listed for each criteria setting. 

Vincent Racaza (AdWords API Team)

unread,
Apr 25, 2018, 4:50:58 AM4/25/18
to AdWords API and Google Ads API Forum
Hi Gary,

Sure, I am sending you here all the details. So I tried again targeting the age ranges using BiddableAdGroupCriterion. Below is my sample SOAP request logs:

<soapenv:Body>
    <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201802">
        <operations>
            <operator>ADD</operator>
            <operand xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201802" xsi:type="ns2:BiddableAdGroupCriterion">
                <ns2:adGroupId>XXXXXXXXXXXX</ns2:adGroupId>
                <ns2:criterion xsi:type="ns2:AgeRange">
                    <ns2:id>503005</ns2:id>
                </ns2:criterion>
            </operand>
        </operations>
        <operations>
            <operator>ADD</operator>
            <operand xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201802" xsi:type="ns3:BiddableAdGroupCriterion">
                <ns3:adGroupId>XXXXXXXXXXXX</ns3:adGroupId>
                <ns3:criterion xsi:type="ns3:AgeRange">
                    <ns3:id>503002</ns3:id>
                </ns3:criterion>
            </operand>
        </operations>
    </mutate>
</soapenv:Body>

After that, I have checked both the old and new AdWords UI if the changes from the API are reflected. And yes, they are both reflected in old and new AdWords UI.

Let me know if you have further clarifications.
Age_OldUI.png
Age_newUI.png

Gary Jiang

unread,
Apr 25, 2018, 1:01:08 PM4/25/18
to AdWords API and Google Ads API Forum
I have never seen the status "Remove" for any age range criteria options in adwords web interface and I wasn't able to switch that manually. Is that the same as "excluded"? 
Also I tried making an API call with operator = REMOVE and type=BiddableAdGroupCriterion on a brand new and it returned an "INVALID_ID" error.

Gary Jiang

unread,
Apr 25, 2018, 1:42:07 PM4/25/18
to AdWords API and Google Ads API Forum
That's what I got from the new UI. Does "Excluded from adgroup" equal to "Removed"? 
screenshot-adwords.google.com-2018.04.25-10-41-13.png

Vincent Racaza (AdWords API Team)

unread,
Apr 25, 2018, 11:57:03 PM4/25/18
to AdWords API and Google Ads API Forum
Hi Gary,

Upon further checking, I can confirm that my "Removed" status from the UI's test account is just equivalent to "Excluded from ad group" status. Actually, when I checked the age ranges again that I used previously, they are still in "Removed" status. When I manually changed one age range with "Removed" status to  "Exclude from ad group" using the new UI, all the other three age ranges with "Removed" status was automatically changed to "Excluded from ad group" (see my attached screenshot). I am just not 100% sure on why the new UI for my test account showed the "Removed" status originally. However, I can confirm that they are just the same as there are only two options in the new UI for the age ranges, to "Enable" it or to "Exclude from ad group".

So, in regards to your screenshot, that is correct. You successfully excluded the two age ranges in the API and it reflected in the UI. However, you just need to use the ADD operator, and not the REMOVE or SET operator as it will generate an error just like your testing.

Hope this helps.
age_excluded.png
Reply all
Reply to author
Forward
0 new messages