【发布时间】:2020-11-12 19:33:08
【问题描述】:
我需要获取:
- 活动名称。
- 展示次数。
- 成本。
- 会话率。
- 转化次数。
- 日期。
- 预算。
- 此广告的图片/视频。
我可以从活动实体中获取所有内容吗?怎么样?
$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();
// Creates a query that retrieves all campaigns.
$query = 'SELECT [MYLIST] FROM campaign ORDER BY campaign.name';
// Issues a search stream request.
/** @var GoogleAdsServerStreamDecorator $stream */
$stream = $googleAdsServiceClient->searchStream($customerId, $query);
// Iterates over all rows in all messages and prints the requested field values for
// the campaign in each row.
foreach ($stream->iterateAllElements() as $googleAdsRow) {
/** @var GoogleAdsRow $googleAdsRow */
printf(
"Campaign with ID %d and name '%s' was found.%s",
$googleAdsRow->getCampaign()->getId(),
$googleAdsRow->getCampaign()->getName(),
AND SOMETHING HERE
PHP_EOL
);
}
【问题讨论】:
标签: php google-ads-api