Empty response from $keywordPlanServiceClient->generateForecastMetrics

160 views
Skip to first unread message

Aqeel Ashraf

unread,
Jun 5, 2023, 11:39:45 AM6/5/23
to Google Ads API and AdWords API Forum
Hi,

I am using google-ads-php. It was working fine till tomorrow. Today we start getting empty response when I call:

$keywordPlanServiceClient = $googleAdsClient->getKeywordPlanServiceClient();
       
        $estimateResults = array();
        $retArray = array();
        $strKeywords = explode(PHP_EOL, $_REQUEST['search_keywords']);
        // Issues a request to generate forecast metrics based on the specific keyword plan ID.
        $generateForecastMetricsResponse = $keywordPlanServiceClient->generateForecastMetrics(
            ResourceNames::forKeywordPlan($customerId, $keywordPlanId)
        );
        var_dump($generateForecastMetricsResponse);

Please let me know what will be the reason. I am using example AddKeywordPlan.php, using v12. Why it suddenly getting empty response?

Waiting for quick  response.

Aqeel Ashraf

Google Ads API Forum Advisor

unread,
Jun 8, 2023, 3:05:32 PM6/8/23
to aqeel...@gmail.com, adwor...@googlegroups.com

Hi Aqeel,

Thank you for reaching out to the Google Ads API support team.

With regard to your concern, can you confirm if you already check this blog post (https://ads-developers.googleblog.com/2023/04/ad-group-and-keyword-forecasts-being.html) with regard to Ad group and keyword forecasts being removed in the Google Ads API? If you haven't seen it yet, kindly check it and if you are using KeywordPlanAdGroupForecast or KeywordPlanKeywordForecast in your applications, update your applications to ensure that they can handle blank responses.

If this is not what is happening to you, kindly provide us with the complete request and response logs with request ID generated in the API side. This is so we could further investigate and provide appropriate guidance. 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.

Reference Links:

This message is in relation to case "ref:_00D1U1174p._5004Q2m9VpD:ref"

Thanks,
 
Google Logo Google Ads API Team

 

Aqeel Ashraf

unread,
Jun 13, 2023, 6:45:03 AM6/13/23
to Google Ads API and AdWords API Forum
Hi,

I upgraded to V14. As GenerateForecastMetrics is removed, is there any example available for GenerateKeywordForecastMetrics()? So, I can see how I can use that and implement in my code. Thanks

Google Ads API Forum Advisor

unread,
Jun 15, 2023, 4:03:19 AM6/15/23
to aqeel...@gmail.com, adwor...@googlegroups.com
Hi Aqeel,

Thank you for getting back to us. 

Moving forward to your concern, I am afraid that the sample code for KeywordPlanCampaignForecstMetrics is not available in all client libraries yet. However, you may try it using the API explorer. You may follow this document to generate metrics. You may also check this link https://developers.google.com/google-ads/api/rest/reference/rest/v14/customers/generateKeywordForecastMetrics as a reference for Rest API.

Reference link:
Let us know if this helps.

Aqeel Ashraf

unread,
Jun 20, 2023, 12:26:49 PM6/20/23
to Google Ads API and AdWords API Forum
Hi,

When tried to call the generate keyword forecast metrices, then it shows "Internal Server Error", please see my code snipped below:

$generateKeywordForecastMetricsResponse = $KeywordPlanIdeaServiceClient->generateKeywordForecastMetrics(
            ResourceNames::forKeywordPlanCampaign($customerId, $keywordCampaignId)
        );

The above code generates error, could you please let me know what's wrong in above code? Thanks

Aqeel Ashraf

unread,
Jun 21, 2023, 10:29:59 AM6/21/23
to Google Ads API and AdWords API Forum
I manage to move 1 step further. Please see details below:

$KeywordPlanIdeaServiceClient = $googleAdsClient->getKeywordPlanIdeaServiceClient();
$reqArr = array("customerId" => $customerId, "currencyCode" => "EUR");
$generateKeywordForecastMetricsResponse = $KeywordPlanIdeaServiceClient->generateKeywordForecastMetrics(
$campaigntoforecast, $reqArr);

When I run the above, it shows following error:

Request with ID McC5p-yikN36-NZTR_snFg has failed. Google Ads failure details:date_error: The string date's format
should be yyyy-mm-dd.

If I pass the date range, then it start showing Internal Server Error, please see below how I am passing the date range:

$KeywordPlanIdeaServiceClient = $googleAdsClient->getKeywordPlanIdeaServiceClient();
$reqArr = array(
"customerId" => $customerId,
"currencyCode" => "EUR",
"forecastPeriod" => array(
"start_date" => "2023-07-1",
"end_date" => "2024-06-30"
)
);
$generateKeywordForecastMetricsResponse = $KeywordPlanIdeaServiceClient->generateKeywordForecastMetrics(
$campaigntoforecast, $reqArr);

Could you please have a look on above code and help send the forecastPeriod (date range) in correct format. Thanks

Google Ads API Forum Advisor

unread,
Jun 22, 2023, 7:32:07 AM6/22/23
to aqeel...@gmail.com, adwor...@googlegroups.com

Hello Aqeel,

For us to check this, can you provide us with the complete request and response logs with request ID and request header generated on your end when this occurs? This is so we could investigate further and provide appropriate guidance.

Reference links included in this email:

Patrick P

unread,
Jun 23, 2023, 10:39:39 AM6/23/23
to Google Ads API and AdWords API Forum
Hey Aqeel -- your start_date should probably be 2023-07-01

Google Ads API Forum Advisor

unread,
Jun 26, 2023, 8:07:29 AM6/26/23
to jpat...@gmail.com, adwor...@googlegroups.com

Hi Patrick,

Thank you for your response.

We really appreciate your insights with regards to this concern. 

@Aqeel - If the issue still persists on your end, kindly provide us the previously requested complete logs via Reply privately to the author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Looking forward to your response.

Reply all
Reply to author
Forward
0 new messages