Number of performance max campaigns: ~50
Number of search categories pulled per campaign: 3000
Number of API calls: ~50*3000 = 1,50,000
Number of parallel threads - 10
Average API call time taken to pull Search term insights per each search category: ~3.5 seconds
Total time: 1,50,000 * 3.5 = 5,25,000 seconds / 60*60 = ~145.8333 hours / 10 = ~14.5 hours
"SELECT \n" +
" campaign.id, \n" +
" campaign.name, \n" +
" campaign.advertising_channel_type, \n" +
" segments.date \n" +
"FROM campaign \n" +
"WHERE \n" +
" metrics.impressions > 0 \n" +
" AND campaign.advertising_channel_type = 'PERFORMANCE_MAX' \n" +
" AND segments.date BETWEEN '" + dateRange.getStartDate().toString() + "' AND '" + dateRange.getEndDate().minusDays(1) + "' ";
Query to pull search categories for each performance max campaigns:"SELECT \n" +
" metrics.clicks, \n" +
" metrics.impressions, \n" +
" campaign_search_term_insight.id \n" +
"FROM campaign_search_term_insight \n" +
"WHERE \n" +
" campaign_search_term_insight.campaign_id = " + campaignId + " \n" +
" AND segments.date = '" + date.toString() + "' \n" +
" AND metrics.impressions > 0 \n" +
"ORDER BY \n" +
" metrics.impressions DESC, \n" +
" metrics.clicks DESC \n" +
"LIMIT = 3000 ";Query to pull search term insights for each search category:"SELECT \n" +
" campaign_search_term_insight.category_label, \n" +
" metrics.clicks, \n" +
" metrics.ctr, \n" +
" metrics.impressions, \n" +
" segments.search_term, \n" +
" segments.search_subcategory, \n" +
" segments.date \n" +
"FROM campaign_search_term_insight \n" +
"WHERE \n" +
" segments.date BETWEEN '" + dateRange.getStartDate().toString() + "' AND '" + dateRange.getEndDate().minusDays(1) + "' \n" +
" AND campaign_search_term_insight.id = " + searchCategoryId + " \n" +
" AND campaign_search_term_insight.campaign_id = " + campaignId + " ";
We are looking to understand why API calls are taking longer time and how to reduce the API call time.
Thanks
Siva Deepthi BadamHi,
Thank you for reaching out to Google Ads API Support.
I understand your concern is related to high API call time. To speed up the data retrieval process, I would suggest you refer to Paging Through Results documentation. To assist you further, could you please provide us with complete API logs (request and response logs with request-id and request header) generated at your end.
If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.
Reply privately to the author option, or direct private reply to this email.
![]() |
Google Ads API Team |
[2025-03-06 13:27:10Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vH6ha:ref" (ADR-00291958)