public function getAdGroups(){ $session = self::setSession(); $adWordsServices = new AdWordsServices(); $adGroupService = $adWordsServices->get($session, AdGroupService::class); $adGroupData = array(); // Create selector. $selector = new Selector(); $selector->setFields(['Id', 'Name', 'Status', 'AdGroupType', 'CampaignId', 'CampaignName', 'BiddingStrategyType', 'ContentBidCriterionTypeGroup','CpcBid', 'CpmBid']); $selector->setPredicates( [ new Predicate( 'Status', PredicateOperator::IN, [AdGroupStatus::ENABLED, AdGroupStatus::PAUSED] ) ] ); $selector->setOrdering([new OrderBy('Name', SortOrder::ASCENDING)]); try{ // Make the get request. $result = $adGroupService->get($selector); print_r($result); exit(); // print_r($result->getEntries()); exit(); $keyIndex = 0; if ($result->getEntries() !== null) { foreach ($result->getEntries() as $campaignRes) { // print_r($campaignRes); $campaignData[$keyIndex]['id'] = $campaignRes->getId(); $campaignData[$keyIndex]['name'] = $campaignRes->getName(); $campaignData[$keyIndex]['status'] = $campaignRes->getStatus(); $campaignData[$keyIndex]['amount'] = $campaignRes->getBudget()->getAmount()->getMicroAmount(); $campaignData[$keyIndex]['type'] = $campaignRes->getAdvertisingChannelType(); $campaignData[$keyIndex]['biddingStrategyType'] = $campaignRes->getBiddingStrategyConfiguration()->getBiddingStrategyType(); ++$keyIndex; } } return $campaignData[; }
It sliting all AdGroups including from removed campaigns too, i need to filter it out. Please guide me on this. Am using AdWords API v201809 php version. -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 "AdWords API and Google Ads 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 on the web visit https://groups.google.com/d/msgid/adwords-api/c38a4b6e-55c2-4007-982c-06d852ee5386o%40googlegroups.com.