本教程介绍了如何在商家资料中检索营业地点指标。借助 Google My Business API,您可以使用营业地点指标来检索以下类型的数据:
准备工作
在使用 Google My Business API 之前,您需要注册您的应用并获取 OAuth 2.0 凭据。要详细了解如何开始使用 Google My Business API,请参阅基本设置。
支持的数据分析
要了解支持的数据分析,请参阅指标参考页面。
基本数据分析
检索指定营业地点列表的基本数据分析。使用 accounts.locations.reportInsights API 可返回与某个营业地点关联的数据分析。
要返回与某个营业地点关联的基本数据分析,请使用以下命令:
POST
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights
{
"locationNames": [
"accounts/{accountId}/locations/{locationId}"
],
"basicRequest": {
"metricRequests": [
{
"metric": "QUERIES_DIRECT"
},
{
"metric": "QUERIES_INDIRECT"
}
],
"timeRange": {
"startTime": "2016-10-12T01:01:23.045123456Z",
"endTime": "2017-01-10T23:59:59.045123456Z"
}
}
}
行车路线
检索指定营业地点列表的行车路线指标。使用 accounts.locations.reportInsights API 可返回与某个营业地点关联的行车路线指标。
要返回行车路线指标,请使用以下命令:
POST
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights
{
"locationNames": [
"accounts/{accountId}/locations/{locationId}"
],
"drivingDirectionsRequest": {
"numDays": "NINETY"
}
}