google ads api AggregateMetricResults is null

108 views
Skip to first unread message

Yawu Zhu

unread,
Apr 27, 2022, 12:57:18 AM4/27/22
to Google Ads API and AdWords API Forum
public void GenerateHistoricalMetrics(GoogleAdsClient client, long customerId, long keywordPlanId)
        {
            KeywordPlanServiceClient kpServiceClient = client.GetService(Services.V10.KeywordPlanService);
            try
            {
                GenerateHistoricalMetricsRequest generateHistoricalMetricsRequest = new GenerateHistoricalMetricsRequest
                {
                    KeywordPlanAsKeywordPlanName = KeywordPlanName.FromCustomerKeywordPlan(customerId.ToString(), keywordPlanId.ToString()),
                    AggregateMetrics = new KeywordPlanAggregateMetrics(),
                    HistoricalMetricsOptions = new HistoricalMetricsOptions(),
                };

                generateHistoricalMetricsRequest.AggregateMetrics.AggregateMetricTypes.Add(KeywordPlanAggregateMetricType.Device);

                GenerateHistoricalMetricsResponse response = kpServiceClient.GenerateHistoricalMetrics(generateHistoricalMetricsRequest);

            }
            catch (GoogleAdsException e)
            {
                throw;
            }
        }


Why is AggregateMetricResults empty in my returned results, while Metrics has data? Is it true that my AggregateMetrics.AggregateMetricTypes are not set? How can I do this?

thanks

Google Ads API Forum Advisor

unread,
Apr 28, 2022, 1:44:25 AM4/28/22
to mao...@topkee.com.hk, adwor...@googlegroups.com

Hi Yawu,
 

Thanks for reaching out to the Google Ads API Support team.


So our team can better check this concern, could you provide the complete Ads API logs (request and response with request-id) to further investigation on this?


You can provide it via Reply privately to the author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.
 

Regards,

Google Logo
Darwin
Google Ads API Team
 


ref:_00D1U1174p._5004Q2aNzJy:ref
Reply all
Reply to author
Forward
0 new messages