You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Google Ads API获取无广告系列的地域维度产品统计数据

解决方案

核心问题说明

你当前使用的geographic_view是基于已有广告系列投放数据的维度聚合视图,如果没有任何已创建的广告系列,该视图不会返回任何metrics数据——因为曝光、点击等统计数据本质是广告投放后产生的行为数据,无投放则无此类数据。

针对你的需求的两种处理路径

1. 若需获取实际投放的地域统计数据

必须创建至少一个匹配产品场景的广告系列(比如Shopping广告系列)并完成投放,之后才能通过geographic_view结合产品维度的查询获取对应数据。调整后的GAQL查询示例:

SELECT 
  metrics.clicks, 
  metrics.impressions, 
  geographic_view.country_criterion_id,
  product_view.title
FROM geographic_view
JOIN product_view ON geographic_view.campaign_id = product_view.campaign_id
WHERE geographic_view.country_criterion_id = 1009919

2. 若需无需投放的潜在地域数据(替代generate forecast metrics)

如果你是Shopping产品场景,且已将Merchant Center与Google Ads账号关联,可以使用ShoppingPerformanceView获取产品在不同地域的潜在表现数据(该视图无需创建广告系列,基于Merchant Center的产品数据和Google搜索生态的潜力数据)。对应的GAQL查询示例:

SELECT
  segments.country,
  metrics.impressions,
  metrics.clicks,
  product_view.id
FROM shopping_performance_view
WHERE segments.country = 'US'

代码调整示例(针对潜在数据场景)

public void queryShoppingGeoMetrics(long customerId) {
    try (GoogleAdsServiceClient googleAdsServiceClient =
                 googleAdsClient.getLatestVersion().createGoogleAdsServiceClient()) {
        SearchGoogleAdsStreamRequest request =
                SearchGoogleAdsStreamRequest.newBuilder()
                        .setCustomerId(Long.toString(customerId))
                        .setQuery("SELECT segments.country, metrics.clicks, metrics.impressions, product_view.id FROM shopping_performance_view WHERE segments.country = 'CN'")
                        .build();

        ServerStream<SearchGoogleAdsStreamResponse> stream =
                googleAdsServiceClient.searchStreamCallable().call(request);

        for (SearchGoogleAdsStreamResponse response : stream) {
            for (GoogleAdsRow googleAdsRow : response.getResultsList()) {
                System.out.printf("地域:%s,点击量:%d,曝光量:%d,产品ID:%d%n",
                        googleAdsRow.getSegments().getCountry(),
                        googleAdsRow.getMetrics().getClicks(),
                        googleAdsRow.getMetrics().getImpressions(),
                        googleAdsRow.getProductView().getId());
            }
        }
    }
}

关键注意事项

  • shopping_performance_view返回的是产品在Google搜索中的潜力数据,并非实际投放产生的真实数据;若需真实投放数据,必须创建广告系列并完成投放。
  • 确保你的Google Ads账号已正确关联Merchant Center,且产品已通过Merchant Center的审核。

内容的提问来源于stack exchange,提问作者Kushani Hansika

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 11:20:27