Method: accounts.locations.reportInsights

Returns a report containing insights on one or more metrics by location.

Available since v3.2.

HTTP request

POST https://mybusiness.googleapis.com/v3/{name=accounts/*}/locations:reportInsights

The URL uses Google API HTTP annotation syntax.

Path parameters

Parameters
name

string

The account resource name.

Request body

The request body contains data with the following structure:

JSON representation
{
  "locationNames": [
    string
  ],
  "basicRequest": {
    object(BasicMetricsRequest)
  },
  "drivingDirectionsRequest": {
    object(DrivingDirectionMetricsRequest)
  }
}
Fields
locationNames[]

string

A collection of locations to fetch insights for, specified by their names.

basicRequest

object(BasicMetricsRequest)

A request to include basic metric insights in the report.

drivingDirectionsRequest

object(DrivingDirectionMetricsRequest)

A request to include insights about driving-direction requests in the report.

Response body

If successful, the response body contains data with the following structure:

Response message for Insights.ReportLocationInsights.

JSON representation
{
  "locationMetrics": [
    {
      object(LocationMetrics)
    }
  ],
  "locationDrivingDirectionMetrics": [
    {
      object(LocationDrivingDirectionMetrics)
    }
  ]
}
Fields
locationMetrics[]

object(LocationMetrics)

A collection of metric values by location.

locationDrivingDirectionMetrics[]

object(LocationDrivingDirectionMetrics)

A collection of values for driving direction-related metrics.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/plus.business.manage

For more information, see the OAuth 2.0 Overview.

BasicMetricsRequest

A request for basic metric insights.

JSON representation
{
  "metricRequests": [
    {
      object(MetricRequest)
    }
  ],
  "timeRange": {
    object(TimeRange)
  }
}
Fields
metricRequests[]

object(MetricRequest)

A collection of metrics to return values for including the options for how the data should be returned.

timeRange

object(TimeRange)

The range to gather metrics for. The maximum range is 18 months and 3 days from the request date for start time and 3 days from the request date for the end time. In some cases, the data may still be missing for days close to the request date. Missing data will be specified in the Value.

MetricRequest

A request to return values for one metric and the options for how those values should be returned.

JSON representation
{
  "metric": enum(Metric),
  "options": [
    enum(MetricOption)
  ]
}
Fields
metric

enum(Metric)

The requested metric.

options[]

enum(MetricOption)

How the values should appear when returned.

Metric

A metric of data about a business.

Enums
METRIC_UNSPECIFIED No metric specified.
ALL Shorthand to request all available metrics.
QUERIES_DIRECT The number of times the listing was shown when searching for it directly.
QUERIES_INDIRECT The number of times the listing was shown as a result of a categorical search (for example, restaurant).
VIEWS_MAPS The number of times the listing was viewed on Google Maps.
ACTIONS_WEBSITE The number of times the website was clicked on the listing.
ACTIONS_PHONE The number of times the phone number was clicked on the listing.
ACTIONS_DRIVING_DIRECTIONS The number of times driving directions were requested for the listing.

MetricOption

Option to specify how data should be displayed in the response.

Enums
METRIC_OPTION_UNSPECIFIED No metric option specified. Will default to AGGREGATED_TOTAL in a request.
AGGREGATED_TOTAL Return values aggregated over the phone time frame. This is the default value.
AGGREGATED_DAILY Return daily timestamped values across time range.
BREAKDOWN_DAY_OF_WEEK Values will be returned as a breakdown by day of the week. Only valid for ACTIONS_PHONE.
BREAKDOWN_HOUR_OF_DAY Values will be returned as a breakdown by hour of the day. Only valid for ACTIONS_PHONE.

TimeRange

A range of time. Data will be pulled over the range as a half-open inverval (that is, [startTime, endTime)).

JSON representation
{
  "startTime": string,
  "endTime": string
}
Fields
startTime

string (Timestamp format)

Epoch timestamp for the start of the range (inclusive).

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

endTime

string (Timestamp format)

Epoch timestamp for the end of the range (exclusive).

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

DrivingDirectionMetricsRequest

A request for driving direction insights.

JSON representation
{
  "numDays": enum(NumDays),
  "languageCode": string
}
Fields
numDays

enum(NumDays)

The number of days to aggregate data for. Results returned will be available data over the last number of requested days. Valid values are 7, 30, and 90.

languageCode

string

The BCP 47 code for the language. If a language code is not provided, it defaults to English.

NumDays

Number of days that this request can support.

Enums
SEVEN 7 days. This is the default value.
THIRTY 30 days
NINETY 90 days

LocationMetrics

A series of Metrics and BreakdownMetrics associated with a Location over some time range.

JSON representation
{
  "locationName": string,
  "timeZone": string,
  "metricValues": [
    {
      object(MetricValue)
    }
  ]
}
Fields
locationName

string

The location resource name these values belong to.

timeZone

string

IANA timezone for the location.

metricValues[]

object(MetricValue)

A list of values for the requested metrics.

MetricValue

A value for a single Metric from a starting time.

JSON representation
{
  "metric": enum(Metric),
  "totalValue": {
    object(DimensionalMetricValue)
  },
  "dimensionalValues": [
    {
      object(DimensionalMetricValue)
    }
  ]
}
Fields
metric

enum(Metric)

The metric for which the value applies.

totalValue

object(DimensionalMetricValue)

The total aggregated value for this metric. Set for the AGGREGATED_TOTAL option.

dimensionalValues[]

object(DimensionalMetricValue)

Dimensional values for this metric.

DimensionalMetricValue

A value for a single metric with a given time dimension.

JSON representation
{
  "metricOption": enum(MetricOption),
  "timeDimension": {
    object(TimeDimension)
  },
  "value": string
}
Fields
metricOption

enum(MetricOption)

The option that requested this dimensional value.

timeDimension

object(TimeDimension)

The dimension for the value.

value

string (Int64Value format)

The value. If no value is set, then the requested data is missing.

TimeDimension

The dimension for which data is divided over.

JSON representation
{
  "dayOfWeek": enum(DayOfWeek),
  "timeOfDay": {
    object(TimeOfDay)
  },
  "timeRange": {
    object(TimeRange)
  }
}
Fields
dayOfWeek

enum(DayOfWeek)

The day of the week ("MONDAY" to "SUNDAY") this value corresponds to. Set for BREAKDOWN_DAY_OF_WEEK option.

timeOfDay

object(TimeOfDay)

The hour of the day (0 to 23) this value corresponds to. Set for BREAKDOWN_HOUR_OF_DAY option.

timeRange

object(TimeRange)

The range of time this value covers. The time zone is set in the LocationMetrics this detail belongs to. Set for AGGREGATED_TOTAL and AGGREGATED_DAILY options.

LocationDrivingDirectionMetrics

A location indexed with the regions that people usually come from. This is captured by counting how many driving-direction requests to this location are from each region.

JSON representation
{
  "locationName": string,
  "topDirectionSources": [
    {
      object(TopDirectionSources)
    }
  ],
  "timeZone": string
}
Fields
locationName

string

The location resource name this metric value belongs to.

topDirectionSources[]

object(TopDirectionSources)

Driving-direction requests by source region. By convention, these are sorted by count with at most 10 results.

timeZone

string

Time zone (IANA timezone IDs, for example, 'Europe/London') of the location.

TopDirectionSources

Top regions where driving-direction requests originated from.

JSON representation
{
  "dayCount": number,
  "regionCounts": [
    {
      object(RegionCount)
    }
  ]
}
Fields
dayCount

number

The number of days data is aggregated over.

regionCounts[]

object(RegionCount)

Regions sorted in descending order by count.

RegionCount

A region with its associated request count.

JSON representation
{
  "latlng": {
    object(LatLng)
  },
  "label": string,
  "count": string
}
Fields
latlng

object(LatLng)

Center of region.

label

string

Human-readable label for the region.

count

string (int64 format)

Number of driving-direction requests from this region.

Send feedback about...

Google My Business API
Google My Business API
Need help? Visit our support page.