You're a super hero. What a lightning speed reaction and so much details too. I struggled with this for 4 hours yesterday. That makes so much sense! I now made the adjustments. I had to add a couple of new methods to fetch upgraded_targeting status, and an ad group ID iterator and use AdGroupCriterionService but it's working :) Thank you
For anyone that's Googling in the future (like me) - For standard (non demand gen) campaigns and demand gen campaigns with upgraded targeting set to false: - Creates campaign-level exclusion operations - Apply exclusions using CampaignCriterionService - For Demand Gen campaigns with upgraded targeting set to true: - Retrieve all ad groups in the campaign - Create ad group-level exclusion operations - Apply exclusions using AdGroupCriterionService On Thursday, December 19, 2024 at 4:48:54 AM UTC+1 Google Ads API Forum Advisor wrote: > Hi, > > Thank you for reaching out to the Google Ads API support team. > > Kindly note that when you set the upgraded_targeting > <https://developers.google.com/google-ads/api/reference/rpc/v18/Campaign.DemandGenCampaignSettings#upgraded_targeting> > field > to 'true' for the demand gen campaign then the location and language > targeting are managed at the ad group level rather than the campaign level. > If you don't set this field then it will be defaulted to true. Since > location and language targeting are applied at the ad group level, you will > need to use the adGroupCriteria > <https://developers.google.com/google-ads/api/rest/reference/rest/v18/customers.adGroupCriteria/mutate?apix=true> > method > to exclude the locations, rather than the campaignCriteria > <https://developers.google.com/google-ads/api/rest/reference/rest/v18/customers.campaignCriteria/mutate?apix=true> > method. > When you try to use the campaignCriteria > <https://developers.google.com/google-ads/api/rest/reference/rest/v18/customers.campaignCriteria/mutate?apix=true> > method > you will encounter an 'OWNED_AND_OPERATED' error. Also, > upgraded_targeting > <https://developers.google.com/google-ads/api/reference/rpc/v18/Campaign.DemandGenCampaignSettings#upgraded_targeting> > is > immutable, meaning it cannot be modified once set. The only possible way to > avoid the error is you would need to create a new campaign with > upgraded_targeting > <https://developers.google.com/google-ads/api/reference/rpc/v18/Campaign.DemandGenCampaignSettings#upgraded_targeting> > set > to 'false', allowing you to use the campaignCriteria > <https://developers.google.com/google-ads/api/rest/reference/rest/v18/customers.campaignCriteria/mutate?apix=true> > method > to target the location at the campaign level or to use the adGroupCriteria > <https://developers.google.com/google-ads/api/rest/reference/rest/v18/customers.adGroupCriteria/mutate?apix=true> > method > and exclude the locations. > > You can check your Demand Gen campaign to see if the location and language > settings are configured at the ad group level or campaign level within the > campaign settings page. For reference, I have attached two sample > screenshots. In one campaign, the location and language settings are > applied at the ad group level, and location exclusions are targeted using > the campaignCriteria > <https://developers.google.com/google-ads/api/rest/reference/rest/v18/customers.campaignCriteria/mutate?apix=true> > > method, which results in receiving 'OWNED_AND_OPERATED' error. In the other > campaign, where location and language settings are applied at the campaign > level, no errors are encountered when targeting location exclusions using > the campaignCriteria > <https://developers.google.com/google-ads/api/rest/reference/rest/v18/customers.campaignCriteria/mutate?apix=true> > > method. > If you still face any issues, then share us the Google Ads account ID and > the campaign ID so that we can check and confirm if your campaign criteria > is created at the campaign level or the ad group level. > > You can send the details via *Reply privately to the author option*, or > *direct > private reply* to this email. > > This message is in relation to case > "ref:!00D1U01174p.!5004Q02vGped:ref" (ADR-00279202) > > Thanks, > > [image: Google Logo] Google Ads API Team > Feedback > How was our support today? > > [image: rating1] > <https://docs.google.com/forms/d/e/1FAIpQLSeRhIg5VeThVmbcD0c5DTWTDjmpJuSktN8vFelEL7_KV_Orbg/viewform?usp=pp_url&entry.141427034=1&entry.295079254=5004Q00002vGped> > > [image: rating2] > <https://docs.google.com/forms/d/e/1FAIpQLSeRhIg5VeThVmbcD0c5DTWTDjmpJuSktN8vFelEL7_KV_Orbg/viewform?usp=pp_url&entry.141427034=2&entry.295079254=5004Q00002vGped> > > [image: rating3] > <https://docs.google.com/forms/d/e/1FAIpQLSeRhIg5VeThVmbcD0c5DTWTDjmpJuSktN8vFelEL7_KV_Orbg/viewform?usp=pp_url&entry.141427034=3&entry.295079254=5004Q00002vGped> > > [image: rating4] > <https://docs.google.com/forms/d/e/1FAIpQLSeRhIg5VeThVmbcD0c5DTWTDjmpJuSktN8vFelEL7_KV_Orbg/formResponse?usp=pp_url&entry.141427034=4&entry.295079254=5004Q00002vGped> > > [image: rating5] > <https://docs.google.com/forms/d/e/1FAIpQLSeRhIg5VeThVmbcD0c5DTWTDjmpJuSktN8vFelEL7_KV_Orbg/formResponse?usp=pp_url&entry.141427034=5&entry.295079254=5004Q00002vGped> > > > > > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 adwords-api+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/adwords-api/2f4e74c2-53d3-4545-a853-d4c6a7102650n%40googlegroups.com.