Hi Everyone!
This is a heads up that the locations.reportInsights and locations.localPosts.reportInsights methods in the Google My Business API version 4.9 will no longer be supported starting February 20, 2023.
Google will be updating to their new Business Profile Performance API, which features significant structural changes compared to the Google My Business API and the discontinuation of some metrics previously accessible via the Google My Business API. Due to this change, you’ll need to make changes to any data source queries and Klips that utilize this API in order to continue to use Google My Business data in Klipfolio.. This deprecation only affects connections to Google My Business that use the locations.reportInsights and locations.localPosts.reportInsights methods, so any queries currently set to pull things like reviews, for example, will work as expected past this deprecation date.
You can find more detailed information about this deprecation and the new Business Profile Performance API, as well as information about which metrics are being replaced and which are not, here: https://developers.google.com/my-business/content/sunset-dates.
Handling Deprecated Queries from GMB API v4.9:
Principally, the API replacing the existing GMB API methods uses a GET request structure where parameters are set within the query URL, rather than a POST request that defines parameters in the request body. Specific details about this new API method can be found here:
https://developers.google.com/my-business/reference/performance/rest/v1/locations/getDailyMetricsTimeSeries
With that in mind, all updates to your data sources will need to be done manually.
Here’s an example of how to update one of these requests. This example request is a daily summary of website actions in 2022:
Query Before Migration:
Request URL:
POST https://mybusiness.googleapis.com/v4/{your_account_id}/locations:reportInsights
Request Body:
{
"locationNames": [
"accounts/<your_account_id>/locations/<your_location_id>"
],
"basicRequest": {
"metricRequests": [
{
"metric": "ACTIONS_WEBSITE",
"options": [
"AGGREGATED_DAILY"
]
}
],
"timeRange": {
"startTime": "2022-01-01",
"endTime": "2022-12-31"
}
}
}
After Migration:
Request URL:
GET https://businessprofileperformance.googleapis.com/v1/locations/<your_location_id>:getDailyMetricsTimeSeries?dailyMetric=WEBSITE_CLICKS&dailyRange.start_date.year=2022&dailyRange.start_date.month=1&dailyRange.start_date.day=1&dailyRange.end_date.year=2022&dailyRange.end_date.month=12&dailyRange.end_date.day=31
Note: The new locations.getDailyMetricsTimeSeries method only allows one metric to be queried per request. If you previously returned multiple metrics in your requests to the old endpoints, you’ll either need to configure multiple data sources or set your request up to use a dynamic property for the dailyMetric parameter.
What happens to Klips that use these deprecated fields?
With the JSON structure changed due to the change in API, Existing Klips and the XPath expression used to retrieve date and metric values will now return an empty string.
This means the XPath will need to be updated in the Klip
Example:
Before (metric values)
@/locationMetrics/metricValues/dimensionalValues/value;
After (metric values)
@/timeSeries/datedValues/value;
Before (date values)
@/locationMetrics/metricValues/dimensionalValues/timeDimension/timeRange/startTime;
After (date values)
CONCAT(@/timeSeries/datedValues/date/year; , “-” , @/timeSeries/datedValues/date/month , “-”
, @/timeSeries/datedValues/date/day)
Note: In the new API, year, month, and day are returned as separate values and must be brought together using the CONCAT function in order to mirror the original ‘startTime’ value
Let us know if you have any questions around this, we are always happy to help!