本教學課程說明如何在商家檔案中擷取地點指標。 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" } }