How can I get Forecast keyword forecasts text?

80 views
Skip to first unread message

Vladymyr Karpov

unread,
Feb 16, 2022, 1:58:43 PM2/16/22
to Google Ads API and AdWords API Forum
Hello I want to get cpc for keywords. Response for forecast returns:

"keywordForecasts": [
    {
      "keywordPlanAdGroupKeyword": "customers/2705932929/keywordPlanKeywords/743359713813",
      "keywordForecast": {
        "impressions": 0,
        "clicks": 0,
        "costMicros": "0"
      }
    },

BUT this resource "customers/2705932929/keywordPlanKeywords/743359713813" doesn't exist! There was a conversation regarding this https://groups.google.com/g/adwords-api/c/uwP9auFv_a8/m/LxHVjnK3BAAJ
with a solution Mar 18, 2019, 8:38:42 PM
to AdWords API and Google Ads API Forum
Hi Gintaras, 

You can use the GoogleAdsService to get the text from keyword_plan_keyword resource for the corresponding keyword_plan_ad_group_keyword created in the plan. The query given below should be helpful. 

SELECT
 keyword_plan_keyword.text,
FROM
keyword_plan_keyword
WHERE
keyword_plan_keyword.id IN (14140579338)
LIMIT
100

Please let me know if you have any additional questions. 

Thanks,
Sreelakshmi, Google Ads API Team

Please help me how can I retrieve text for keyword forecast. 
Thank you!

Best, Vlad











Google Ads API Forum Advisor

unread,
Feb 17, 2022, 12:55:13 PM2/17/22
to vlad...@seosamba.com, adwor...@googlegroups.com
Hello,

Thanks for reaching out. Can you please clarify your concern? Is your concern that the keyword plan, 743359713813, does not exist? 

If the issue is that the keywordForecasts does not contain the average_cpc field in the response? You should be able to get this value through the keyword_plan_ad_group_keyword resource. 

Regards,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


ref:_00D1U1174p._5004Q2WwNp9:ref

Vladymyr Karpov

unread,
Feb 17, 2022, 1:06:52 PM2/17/22
to Google Ads API Forum Advisor, adwor...@googlegroups.com
Hello Matt, the issue is that this resource you API returns -  customers/2705932929/keywordPlanKeywords/743359713822 does not exists and I’m not able to get text query of it. 
I have this as response data - {
      "keywordPlanAdGroupKeyword": "customers/2705932929/keywordPlanKeywords/743359713840",
      "keywordForecast": {
        "impressions": 0,
        "clicks": 0,
        "costMicros": "0"
      }
    },
How can I get the text of this keyword? This is keyword, but your API has only this resource for ad group keywords

Immutable. The resource name of the Keyword Plan ad group keyword. KeywordPlanAdGroupKeyword resource names have the form: <code>customers/{customer_id}/keywordPlanAdGroupKeywords/{kp_ad_group_keyword_id}</code>

but api returns it in old form
 customers/2705932929/keywordPlanKeywords/743359713822 And I’m not able neither match nor retrieve text of this keyword.

Could you please help. Thank you.

Best, Vlad

Google Ads API Forum Advisor

unread,
Feb 18, 2022, 11:22:11 AM2/18/22
to vlad...@seosamba.com, adwor...@googlegroups.com
Hi Vladymyr,

I work with Mat and will assist you. Mat had suggested you run a  keyword_plan_ad_group_keyword  report. I did so and got the keyword.

Could you send us privately a full API log of request and response of your forecast, combined with a full screen screenshot of the UI of what your attempting to recreate in your API call?

The request and response appears similar to the JSON Mappings in our REST documentation with additional information such as  request ID . Our client libraries have loggers with logging instructions, to see these instructions you can click on the client library you use in the sidebar of our client library guide and click on "Logging”. Setting the log level to 'DEBUG' will generate the requested logs.

Regards,

Google Logo
Aryeh
Google Ads API Team
 


ref:_00D1U1174p._5004Q2WwNp9:ref

Vladymyr Karpov

unread,
Feb 18, 2022, 11:44:29 AM2/18/22
to Google Ads API and AdWords API Forum
Hi Aryeh, please read my request. I'm able to get keywords from keyword_plan_ad_group_keyword report. Please check this example https://github.com/googleads/google-ads-php/blob/827776059b1f459f9751bfa9855033f57b593043/examples/Planning/GenerateForecastMetrics.php. It returns as a result 
$metrics = $forecast->getKeywordForecast();


printf(


"%d) Keyword ID: %s%s",


++$i,


$forecast->getKeywordPlanAdGroupKeyword(),


PHP_EOL


);
Keyword ID $forecast->getKeywordPlanAdGroupKeyword() is in format which does not match with Keyword returned from keyword_plan_ad_group_keyword report. 
$forecast->getKeywordPlanAdGroupKeyword() =  "customers/XXXXXXX/keywordPlanKeywords/YYYYYY"
keyword_plan_ad_group_keyword report returns keyword in format
customers/{customer_id}/keywordPlanAdGroupKeywords/{kp_ad_group_keyword_id}
this info is on report page:
keyword_plan_ad_group_keyword.resource_name
Field description
Immutable. The resource name of the Keyword Plan ad group keyword. KeywordPlanAdGroupKeyword resource names have the form: customers/{customer_id}/keywordPlanAdGroupKeywords/{kp_ad_group_keyword_id}

To get text representation I must match  customers/XXXXXXX/keywordPlanKeywords/YYYYYY from Forecast report example with customers/XXXX/keywordPlanAdGroupKeywords/YYYYYY from keyword_plan_ad_group_keyword report.
They are not equal each other so matching is not possible

But I need to match them to show in my Application
 Keyword: "I like pizza" : {
        "impressions": 0,
        "clicks": 0,
        "costMicros": "0"
      }
"I like jazz": {
        "impressions": 52.995262145996094,
        "ctr": 0.2561069428920746,
        "averageCpc": "777946",
        "clicks": 13.572454452514648,
        "costMicros": "10558639"
      }
and so on. 


Please help me to solve this issue.

Best, Vlad
Reply all
Reply to author
Forward
0 new messages