Call generate_historical_metrics for multiple keyword plans in a single call

68 views
Skip to first unread message

Nam Đào

unread,
Jan 17, 2023, 1:51:50 AM1/17/23
to Google Ads API and AdWords API Forum
Hi all, 
We have a tool that generates localized keyword suggestions to our clients based on historical search volumes. For that purpose we have been fetching historical metrics for ~1000 keywords on ~100 coutries.
 Basically our app makes;
1 mutate request for creating 199 KeywordPlans
1 search request for fetching the KeywordPlans
1 mutate request for creating 199 KeywordPlanCampaigns
1 search request for fetching the KeywordPlanCampaigns
1 mutate request for creating 199 KeywordPlanAdGroups
1 search request for fetching the KeywordPlanAdGroups
199 mutate requests for creating 1000 KeywordPlanAdGroupKeywords under each KaywordPlanAdGroup.
It took me 20 minutes to get the job done.
If I could call generate_historical_metrics for multiple keyword plans in a single call, it would be much faster.
Am I missing out on something?

Google Ads API Forum Advisor

unread,
Jan 17, 2023, 9:45:57 AM1/17/23
to daon...@gmail.com, adwor...@googlegroups.com
Hi Nam,

Thank you for raising this concern to the Google Ads API Forum.

With regard to your concern, the GenerateForecastMetricsRequest in a keyword_plan can only be processed in one request. However, could you confirm if the feature for GenerateForecastMetricsRequest that you are looking for is possible in the Google Ads UI? If possible, please help us with the instruction on how to configure it in the UI by providing a screenshot of this, so that we can possibly raise a feature request to the team.

Best regards,
Google Logo
Jinky
Google Ads API Team
 


ref:_00D1U1174p._5004Q2hz9s8:ref

Google Ads API Forum Advisor

unread,
Jan 17, 2023, 9:48:19 AM1/17/23
to daon...@gmail.com, adwor...@googlegroups.com
Hi Nam,

For security purposes, you can provide it via the Reply privately to author option. If this option is not available, then send it instead on this email address googleadsapi-support@google.com.

Nam Đào

unread,
Jan 17, 2023, 7:57:32 PM1/17/23
to Google Ads API and AdWords API Forum
My feature is not possible in the Google Ads UI.
My tool will get data on a monthly basis, it is located on a separate server.

On Tuesday, January 17, 2023 at 9:48:19 PM UTC+7 adsapi wrote:
Hi Nam,

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

Google Ads API Forum Advisor

unread,
Jan 18, 2023, 12:23:05 AM1/18/23
to daon...@gmail.com, adwor...@googlegroups.com

Hi Nam,

I work with Jinky. Thanks for getting back to us.

Thanks for confirming that your said feature is not possible in the Google Ads UI. To generate forecast metrics, you may breakdown your implementation for your tool in following 2 steps:

  1. Create a KeywordPlan, KeywordPlanCampaigns, KeywordPlanAdGroups, KeywordPlanCampaignKeywords, and KeywordPlanAdGroupKeywords.
  2. Call KeywordPlanService.GenerateForecastMetrics with that keyword plan.

 

You may try to use bulk mutates, and see if it helps you. Also, ​​BatchJobService supports all of the operations listed in MutateOperation, with a few important exceptions.

The Google Ads API executes all operations in a job with partial failure enabled. However, the following operations in MutateOperation do not support partial failure because they must be atomic. As a result, they are not supported within batch jobs and you should avoid adding them to your jobs.

If you need to execute any of these operations, use the mutate method of GoogleAdsService instead, and set partial_failure to false in your requests.

Your one request of  GoogleAdsService.Mutate containing MutateOperation may create following:

 

  1. creating 199 KeywordPlans
  2. creating 199 KeywordPlanCampaigns
  3. creating 199 KeywordPlanAdGroups 
  1. creating 1000 KeywordPlanAdGroupKeywords under each KaywordPlanAdGroup.

     

    Once you created the KeywordPlan, then second step is to run code example to make request to KeywordPlanService.GenerateForecastMetrics after creating the KeywordPlan, and then iterates through each of the KeywordPlanKeywordForecasts and displays each of the forecast metrics.

    I hope this helps. Let us know if you have any questions.

    Regards,

    Google Logo
    Yasar
    Google Ads API Team
     


    ref:_00D1U1174p._5004Q2hz9s8:ref

    Nam Đào

    unread,
    Jan 18, 2023, 2:58:13 AM1/18/23
    to Google Ads API and AdWords API Forum
    Thanks,
    Stage 1 I used MutateOperation, everything is fine
    But in stage 2, make request to KeywordPlanService.GenerateForecastMetrics. I have to call each request for each keywordplan. Is it possible to request to KeywordPlanService.GenerateForecastMetrics for multiple keywordplans at the same time?

    Google Ads API Forum Advisor

    unread,
    Jan 18, 2023, 3:42:34 AM1/18/23
    to daon...@gmail.com, adwor...@googlegroups.com

    Hi Nam,

    There is no way to have multiple keyword plans at the same time for the KeywordPlanService.GenerateForecastMetrics in the Google Ads API. Add to that, all requests to Keyword Planning services for both standard and basic access are rate limited. Fewer requests are allowed per minute when compared to other services. Our recommendation is to cache or store results as you will receive the same response over a long time span. For example, if you request a set of existing keywords, the response is not going to change over a period of hours or days. In the case of historical metrics, the statistics refresh monthly.

    Let us know if you have any other questions by opening a new forum thread or by reaching out to us via a support email alias.

    Regards,

    Reply all
    Reply to author
    Forward
    0 new messages