I am creating a Google Ads campaign via API version v201710, and the campaign is creating fine. But, if I try to SET the Content Exclusion to "Sensitive social issues" by Google Ad SDK, it's not working.
I tried to debug the issue and found that the this field ("Sensitive social issues") has constant value as "UNKNOWN" in ContentLabelType. It's nowhere written like that in the documentation. Docs: https://developers.google.com/adwords/api/docs/reference/v201708/CampaignCriterionService.ContentLabelType To find out about this, first I setup a campaign's Content Exclusion as "Sensitive social issues" via Google Adwords dashboard (e.g.: https://www.screencast.com/t/hi7rLnTa ) Then, I tried to retrieve the targeting values of this Campaign by Google Ads SDK (API), and I got "UNKNOWN" as ContentLabelType value for "Sensitive social issues". The bigger problem is that UNKNOWN value is read-only, it can't be set. It's written in Google's documentation, and WSDL file too. Anyways, I tried the same by Google Ad SDK for "Sensitive social issues" in Content Exclusions via API to set it like this: https://www.screencast.com/t/hi7rLnTa. This is my code for for this, which should not work, and it did not work, because Google does not allow UNKNOWN. $campaignCriteria = []; $addContentLabel = array( ContentLabelType::TRAGEDY, ContentLabelType::UNKNOWN, ContentLabelType::PROFANITY, ContentLabelType::ADULTISH, ContentLabelType::JUVENILE ); foreach ($addContentLabel as $item){ $ContentLabelObj = new ContentLabel(); $ContentLabelObj->setContentLabelType($item); $campaignCriteria[] = new NegativeCampaignCriterion($campaignId,"null", $ContentLabelObj); } $operations = []; foreach ($campaignCriteria as $campaignCriterion) { $operation = new CampaignCriterionOperation(); $operation->setOperator(Operator::ADD); $operation->setOperand($campaignCriterion); $operations[] = $operation; } try { $result = $campaignCriterionService->mutate($operations); foreach ($result->getValue() as $campaignCriterion) { printf( "Campaign targeting criterion with ID %d and type '%s' with value '%s' was added.\n", $campaignCriterion->getCriterion()->getId(), $campaignCriterion->getCriterion()->getType(), $campaignCriterion->getCriterion()->getContentLabelType()); } } catch(ApiException $apiException) { print_r($apiException); throw new Exception('Error: ' . $apiException->getErrors()[0]->getReason ()); } My question is what constant value should I use for setting "Content Exclusions" to "Sensitive social issues" in my campaigns via API. Can anyone please help? -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords 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 "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/c0125da6-a562-4101-847c-33eafd0a4417%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.