La API de
Google Business Performance tiene un método de API
NUEVO que permite recuperar varias métricas "DailyMetrics" en una sola solicitud a la API.
Revise el
programa de baja y las instrucciones para migrar del método de la API de reportInsights versión 4 a la API de rendimiento del Perfil de Negocio de Google.
Cómo recuperar estadísticas de ubicación
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En este instructivo, se muestra cómo recuperar métricas de ubicación en el Perfil de Negocio.
La API de Google Mi Negocio te permite trabajar con métricas de ubicación para recuperar los siguientes tipos de datos:
Antes de comenzar
Antes de usar la API de Google Mi Negocio, debes registrar tu aplicación y obtener credenciales de OAuth 2.0. Para obtener detalles sobre cómo comenzar a usar la API de Google My Business, consulta Configuración básica.
Estadísticas compatibles
Para obtener información sobre las estadísticas compatibles, consulta la página de referencia de Métrica.
Información básica
Recupera estadísticas básicas para una lista determinada de ubicaciones. Usa la API de accounts.locations.reportInsights
para mostrar las estadísticas asociadas con una ubicación.
Para mostrar las estadísticas básicas asociadas con una ubicación, usa lo siguiente:
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"
}
}
}
Ruta en auto
Recupera las métricas de instrucciones sobre cómo llegar en auto para una lista determinada de ubicaciones. Usa la API de accounts.locations.reportInsights
para mostrar las métricas de dirección de conducción asociadas con una ubicación.
Para mostrar las métricas de dirección de conducción, usa lo siguiente:
POST
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights
{
"locationNames": [
"accounts/{accountId}/locations/{locationId}"
],
"drivingDirectionsRequest": {
"numDays": "NINETY"
}
}
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-08-29 (UTC)
[null,null,["Última actualización: 2025-08-29 (UTC)"],[[["\u003cp\u003eThis tutorial demonstrates how to retrieve location metrics, such as basic insights and driving directions, using the Google My Business API.\u003c/p\u003e\n"],["\u003cp\u003eBefore using the API, you'll need to register your application and obtain OAuth 2.0 credentials as outlined in the basic setup guide.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve basic insights like direct and indirect queries for specific locations within a defined timeframe using the \u003ccode\u003eaccounts.locations.reportInsights\u003c/code\u003e API.\u003c/p\u003e\n"],["\u003cp\u003eDriving direction metrics, including data for the past 90 days, can also be retrieved using the \u003ccode\u003eaccounts.locations.reportInsights\u003c/code\u003e API with a driving directions request.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the Metric reference page for a comprehensive list of supported insights available through the Google My Business API.\u003c/p\u003e\n"]]],[],null,["# Retrieve location insights\n\n\u003cbr /\u003e\n\nThis tutorial shows you how to retrieve location metrics in Business Profile.\nThe Google My Business API provides you with the ability to work with location\nmetrics to retrieve the following types of data:\n\n- [Supported insights](#supported_insights)\n- [Basic insights](#basic_insights)\n- [Driving directions](#driving_directions)\n\nBefore you begin\n----------------\n\nBefore you use the Google My Business API, you need to register your application\nand obtain OAuth 2.0 credentials. For details on how to get started with the\nGoogle My Business API, see [Basic setup](/my-business/content/basic-setup).\n\nSupported insights\n------------------\n\nFor supported insights, see the [Metric](/my-business/reference/rest/v4/Metric)\nreference page.\n\nBasic insights\n--------------\n\nRetrieves basic insights for a given list of locations. Use the [`accounts.locations.reportInsights`](/my-business/reference/rest/v4/accounts.locations/reportInsights)\nAPI to return the insights that are associated with a location.\n\nTo return the basic insights associated with a location, use the following:\nHTTP \n\n```\nPOST\nhttps://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights\n{\n \"locationNames\": [\n \"accounts/{accountId}/locations/{locationId}\"\n ],\n \"basicRequest\": {\n \"metricRequests\": [\n {\n \"metric\": \"QUERIES_DIRECT\"\n },\n {\n \"metric\": \"QUERIES_INDIRECT\"\n }\n ],\n \"timeRange\": {\n \"startTime\": \"2016-10-12T01:01:23.045123456Z\",\n \"endTime\": \"2017-01-10T23:59:59.045123456Z\"\n }\n }\n}\n```\n\nDriving directions\n------------------\n\nRetrieves driving direction metrics for a given list of locations. Use the\n[`accounts.locations.reportInsights`](/my-business/reference/rest/v4/accounts.locations/reportInsights)\nAPI to return driving direction metrics that are associated with a location.\n\nTo return the driving direction metrics, use the following:\nHTTP \n\n```\nPOST\nhttps://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights\n{\n \"locationNames\": [\n \"accounts/{accountId}/locations/{locationId}\"\n ],\n \"drivingDirectionsRequest\": {\n \"numDays\": \"NINETY\"\n }\n}\n```"]]