Google Business Performance API has a
NEW API method that allows fetching multiple `DailyMetrics` in a single API request. Review the
deprecation schedule and instructions to migrate over from v4 reportInsights API method to Google Business Profile Performance API.
Retrieve location insights
Stay organized with collections
Save and categorize content based on your preferences.
This tutorial shows you how to retrieve location metrics in Business Profile.
The Google My Business API provides you with the ability to work with location
metrics to retrieve the following types of data:
Before you begin
Before you use the Google My Business API, you need to register your application
and obtain OAuth 2.0 credentials. For details on how to get started with the
Google My Business API, see Basic setup.
Supported insights
For supported insights, see the Metric
reference page.
Basic insights
Retrieves basic insights for a given list of locations. Use the accounts.locations.reportInsights
API to return the insights that are associated with a location.
To return the basic insights associated with a location, use the following:
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"
}
}
}
Driving directions
Retrieves driving direction metrics for a given list of locations. Use the
accounts.locations.reportInsights
API to return driving direction metrics that are associated with a location.
To return the driving direction metrics, use the following:
POST
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights
{
"locationNames": [
"accounts/{accountId}/locations/{locationId}"
],
"drivingDirectionsRequest": {
"numDays": "NINETY"
}
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-16 UTC."],[[["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."]]],[]]