I'm PHP developer.
Below is a code that get Expanded Text Ads information.
=============================================================================================
$adGroupAdService = $adWordsServices->get($session, AdGroupAdService::class);
// Create a selector to select all ads for the specified ad group.
$selector = new Selector();
$selector->setFields(['Id', 'Status', 'HeadlinePart1', 'HeadlinePart2', 'Description']);
$selector->setOrdering([new OrderBy('Id', SortOrder::ASCENDING)]);
$selector->setPredicates([
new Predicate('AdGroupId', PredicateOperator::IN, [$AdGroupId]),
new Predicate('AdType', PredicateOperator::IN, [AdType::EXPANDED_TEXT_AD]),
new Predicate('Status', PredicateOperator::IN, [AdGroupAdStatus::ENABLED, AdGroupAdStatus::PAUSED, AdGroupAdStatus::DISABLED])
]);
$selector->setPaging(new Paging(0, self::PAGE_LIMIT));
$totalNumEntries = 0;
do {
// Retrieve ad group ads one page at a time, continuing to request pages
// until all ad group ads have been retrieved.
$page = $adGroupAdService->get($selector);
// Print out some information for each ad group ad.
if ($page->getEntries() !== null) {
$totalNumEntries = $page->getTotalNumEntries();
foreach ($page->getEntries() as $adGroupAd) {
$AdId = $adGroupAd->getAd()->getId();
echo "AdId : ".$AdId."\n";
$status = $adGroupAd->getStatus();
echo "status : ".$status."\n"; //ENABLED, PAUSED, DISABLED
//The approvalStatus, trademarks, disapprovalReasons, and trademarkDisapproved fields of AdGroupAd have been removed. Use AdGroupAd.policySummary instead.
$PolicySummary = $adGroupAd->getPolicySummary();
var_dump($PolicySummary); //return NULL
/*
$approvalStatus = $adGroupAd->getApprovalStatus();
echo "approvalStatus : ".$approvalStatus."\n"; //APPROVED, DISAPPROVED, FAMILY_SAFE, NON_FAMILY_SAFE, PORN, UNCHECKED, UNKNOWN
$disapprovalReasons = $adGroupAd->getDisapprovalReasons();
$disapprovalReasons = $disapprovalReasons[0];
echo "disapprovalReasons : ".$disapprovalReasons."\n"; //Array
*/
$headline1 = $adGroupAd->getAd()->getHeadlinePart1();
echo "headline1 : ".$headline1."\n";
$headline2 = $adGroupAd->getAd()->getHeadlinePart2();
echo "headline2 : ".$headline2."\n";
$description = $adGroupAd->getAd()->getDescription();
echo "description : ".$description."\n";
$path1 = $adGroupAd->getAd()->getPath1();
echo "path1 : ".$path1."\n";
$path2 = $adGroupAd->getAd()->getPath2();
echo "path2 : ".$path2."\n";
=============================================================================================
[Problem 1]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
AdGroupAd.approvalStatusThe approvalStatus
, trademarks
, disapprovalReasons
, and trademarkDisapproved
fields of AdGroupAd
have been removed. Use AdGroupAd.policySummary
instead.
-------------------------------------------------------------------------------------------------------------------------
Before migration to v201710, I successfully retrieved approvalStatus, disapprovalReasons. As described in migration guide, I try to use AdGroupAd.policySummary API, which returns only null value.
$PolicySummary = $adGroupAd->getPolicySummary();
var_dump($PolicySummary); //return NULL
How should I write code for combinedApprovalStatus.
https://developers.google.com/adwords/api/docs/reference/v201710/AdGroupAdService.AdGroupAdPolicySummary
[Problem 2]
After migrating from v201609 to v201710, retrieving path1 & path2 of displayurl returns null.
As below code, headline1, headline2, description work well. But only path1 & path2 return null. what's the problem in my code
$headline1 = $adGroupAd->getAd()->getHeadlinePart1();
echo "headline1 : ".$headline1."\n";
$headline2 = $adGroupAd->getAd()->getHeadlinePart2();
echo "headline2 : ".$headline2."\n";
$description = $adGroupAd->getAd()->getDescription();
echo "description : ".$description."\n";
$path1 = $adGroupAd->getAd()->getPath1();
echo "path1 : ".$path1."\n";
$path2 = $adGroupAd->getAd()->getPath2();
echo "path2 : ".$path2."\n";
Thanks, in advance!!