Google Business Performance API 的
NEW API 方法可擷取單一 API 要求中的多個「DailyMetrics」。
請詳閱
淘汰時間表和從 v4 reportInsights API 方法遷移至 Google Business Profile Performance API 的操作說明。
擷取位置洞察資料
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本教學課程將說明如何在商家檔案中擷取位置指標。Google My Business API 可讓您使用位置指標,擷取下列類型的資料:
事前準備
使用 Google 我的商家 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"
}
}
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-01-29 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-01-29 (世界標準時間)。"],[[["This tutorial demonstrates how to retrieve location metrics, such as basic insights and driving directions, using the Google My Business API."],["Before using the API, you'll need to register your application and obtain OAuth 2.0 credentials as outlined in the basic setup guide."],["You can retrieve basic insights like direct and indirect queries for specific locations within a defined timeframe using the `accounts.locations.reportInsights` API."],["Driving direction metrics, including data for the past 90 days, can also be retrieved using the `accounts.locations.reportInsights` API with a driving directions request."],["Refer to the Metric reference page for a comprehensive list of supported insights available through the Google My Business API."]]],[]]