Can AdGroupAdReturnValue Contains an AdGroupAd with its Policy Summary?

52 views
Skip to first unread message

alex.k...@dialogtech.com

unread,
Mar 16, 2018, 3:33:17 PM3/16/18
to AdWords API Forum
After successfully creating a new AdGroupAd the return value does not seem to contain all of the information related to that AdGroupAd.

I know that when using the php sdk and calling get on the AdGroupAdService you need to specify 'policySummary' in the selector in order to get it returned, however there is no option to specify the return value of a newly created ad. 

here is some example code to illustrate what I mean.

$adGroupAdService = $this->awServices->get($session, AdGroupAdService::class);
$operation = new AdGroupAdOperation();
$operation->setOperand($ad);
$operation->setOperator('ADD');

$result = $adGroupAdService->mutate($operations);
$adGroupAd = $result->getValue()[0];

// partial value of one of the AdGroupAds in result:
// adGroupId:protected] => <ID>
//     [ad:protected] => Google\AdsApi\AdWords\v201710\cm\CallOnlyAd Object
//            {ad}
//     [status:protected] => ENABLED
//     [policySummary:protected] => NULL

$adGroupId = $$adGroupAd->getAdGroupId();
$adId = $adGroupAd->getAd()->getId();

$selector = new Selector();
$selector->setFields(['AdGroupId', 'PolicySummary']);
$selector->setPredicates([
   new Predicate('AdGroupId', PredicateOperator::EQUALS, [$adGroupId]),
   new Predicate('Id', PredicateOperator::EQUALS, [$adId])
]);
$page = $adGroupAdService->get($selector);
$adGroupAdFull = $page->getEntries()[0];

// partial value of one of the AdGroupAds in result:
// adGroupId:protected] => <ID>
//     [ad:protected] => Google\AdsApi\AdWords\v201710\cm\CallOnlyAd Object
//            {ad}
//     [status:protected] => ENABLED
//     [policySummary:protected] => Google\AdsApi\AdWords\v201710\cm\AdGroupAdPolicySummary Object

Do I need to make that second call to get policy information or is there a way it can be returned from the mutate result?

Peter Oliquino

unread,
Mar 19, 2018, 1:07:40 AM3/19/18
to AdWords API Forum
Hi,

Since the AdGroupReturnValue contains the information of your AdGroupAd object through its Value field, you should be able to extract the PolicySummary from it without creating a separate Selector and get() request. I hope this helps and feel free to write back if you require further information.

Best regards,
Peter
AdWords API Team

alex.k...@dialogtech.com

unread,
Mar 19, 2018, 10:16:28 AM3/19/18
to AdWords API Forum
Hey sorry if I'm not understanding something but I am getting the AdGroupAd from the value field but it doesn't have the attached policy summary object. it comes back as null

Peter Oliquino

unread,
Mar 20, 2018, 1:35:22 AM3/20/18
to AdWords API Forum
Hi Alex,

My apologies as well if I missed this out on my previous response, however, the PolicySummary field would be null if there were no policy related errors encountered when uploading your ads.

If your intention is to handle ad upload errors due to policy, you may refer to this guide.

alex.k...@dialogtech.com

unread,
Mar 20, 2018, 10:13:28 AM3/20/18
to AdWords API Forum
Thanks for the info, Peter. What I'm trying to do is store the policy summary's 'Policy Approval Status' after creating a new ad. Since the policy summary is not returned in the mutate request I'm unable to do this in one step. Is this expected behavior then, and will I just need to make another call in order to get the 'Policy Approval Status'?

Thanks again,
Alex

alex.k...@dialogtech.com

unread,
Mar 23, 2018, 10:13:52 AM3/23/18
to AdWords API Forum
Can I get an answer to my last question, does this mean if there are no errors in the ad that the policy summary will be NULL instead of including the 'policy approval status'?

Anash P. Oommen (AdWords API Team)

unread,
Mar 23, 2018, 7:44:24 PM3/23/18
to AdWords API Forum
Hi Alex,

The answer is "Maybe". Policy approval is asynchronous (including manual review steps), so you might not get back a PolicySummary field in response when you upload the ad. The only time you know for sure that the ad has no errors is when your ad's combinedApprovalStatus has become approved, and policyTopicEntries return empty. So you might have to fetch the ads multiple times over a period of time to know for sure.

Cheers
Anash P. Oommen,
AdWords API Advisor.
Reply all
Reply to author
Forward
0 new messages