在此输入代码...private function runExample(GoogleAdsClient $googleAdsClient, $customerId, $beginTime, $endTime) { // $beginTime = date('Ymd', strtotime($beginDate)); // $endTime = date('Ymd', strtotime($endDate)); $beginTime = '2020-01-01'; $endTime = '2020-01-30'; echo 'account:'.$customerId.PHP_EOL; $googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient(); // Creates a query that retrieves all keyword statistics. $query = "SELECT campaign.id, campaign.name, ad_group.id, ad_group.name, ad_group_ad.ad.id, ad_group_ad.ad.type, ad_group_ad.ad.name, asset.id, asset.name, asset.type, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, segments.date FROM ad_group_ad_asset_view WHERE segments.date BETWEEN '{$beginTime}' AND '{$endTime}' AND metrics.impressions > 0 ORDER BY ad_group_ad_asset_view.performance_label";
// Issues a search request by specifying page size. $response = $googleAdsServiceClient->search($customerId, $query, ['pageSize' => self::PAGE_SIZE]); // Iterates over all rows in all pages and prints the requested field values for foreach ($response->iterateAllElements() as $googleAdsRow) { /** @var GoogleAdsRow $googleAdsRow */ // $campaign = $googleAdsRow->getCampaign(); // $adGroup = $googleAdsRow->getAdGroup(); $asset = $googleAdsRow->getAsset(); // $metrics = $googleAdsRow->getMetrics(); $assetId = $asset->getIdUnwrapped(); $assetName = $asset->getNameUnwrapped(); $assetType = $asset->getType(); $assetResourceName = $asset->getResourceName(); // echo $campaignId.' '.$campaignName.' '.$adsetId.' '.$adsetName.' '.$assetId.' '.$assetName.' '.$cost.' '.$impression.' '.$click.PHP_EOL; echo ' id: '.$assetId.' name:'.$assetName.' type:'.$assetType.' resource:'. $assetResourceName.PHP_EOL; } } the result is like this, without asset name, but I actually have the name in the web : id: 7788315326 name: type:2 resource:customers/ 11751213962/assets/7788315326 -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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/12cb2d43-a239-4195-b95d-a7ec5854ec7a%40googlegroups.com.