获取 Google Ads API keywords_plan_idea_error:输入的值无效
$requestOptionalArgs = [];
$requestOptionalArgs['keywordSeed'] = new KeywordSeed(['keywords' => $keywords]);
$keywordPlanIdeaServiceClient->generateKeywordIdeas([
'language' => ResourceNames::forLanguageConstant(1000), // English
'customerId' => $customerId,
'geoTargetConstants' => $geoTargetConstants,
'keywordPlanNetwork' => KeywordPlanNetwork::GOOGLE_SEARCH
] + $requestOptionalArgs);
如果 $keywords 数组大小不超过 20,上面的代码可以正常工作。如果我将第 21 个关键字添加到 $keywords 数组,则会抛出以下错误。 keyword_plan_idea_error:输入的值无效。
$requestOptionalArgs = [];
$requestOptionalArgs['keywordSeed'] = new KeywordSeed(['keywords' => $keywords]);
$keywordPlanIdeaServiceClient->generateKeywordIdeas([
'language' => ResourceNames::forLanguageConstant(1000), // English
'customerId' => $customerId,
'geoTargetConstants' => $geoTargetConstants,
'keywordPlanNetwork' => KeywordPlanNetwork::GOOGLE_SEARCH
] + $requestOptionalArgs);
The above code is working fine if the $keywords array size is not more than 20. If I add the 21st keyword to the $keywords array then it's throwing the below error.keyword_plan_idea_error: The input has an invalid value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Google Ads API 每个请求最多可使用 20 个关键字。您需要将关键字分成块并循环遍历它们。
像这样的东西:
Google Ads API has a limit of 20 keywords per request. You'll need to separate your keywords into chunks and loop through them.
Something like this: