How to get Google Ads impressions based on location

Viewed 20

I am working with Google Ads API. Based on my use case, I need to get the impressions, clicks, and other statistics about the products based on location(Without creating the campaign). Impressions according to the location

I contacted the Google Ads API team to address the issue but the doc reference they provided me didn't work in my case. (I'm not using keywords also)

  1. generate forecast metrics

And also the query I used to access the data is...

public void queryTest(long customerId,String campaignId) {
    try (GoogleAdsServiceClient googleAdsServiceClient =
                 googleAdsClient.getLatestVersion().createGoogleAdsServiceClient()) {
        SearchGoogleAdsStreamRequest request =
                SearchGoogleAdsStreamRequest.newBuilder()
                        .setCustomerId(Long.toString(customerId))
                        .setQuery("SELECT metrics.clicks, metrics.impressions,geographic_view.country_criterion_id FROM geographic_view WHERE geographic_view.country_criterion_id = 1009919")
                        .build();

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

        for (SearchGoogleAdsStreamResponse response : stream) {
            for (GoogleAdsRow googleAdsRow : response.getResultsList()) {
                System.out.println("outPut"+googleAdsRow.getGeographicView());
            }
        }
    }
}

Can someone please help me to resolve this issue?? Thank you!!

0 Answers
Related