My Business
4.8K members online now
4.8K members online now
For developers who are using the Google My Business API to manage locations
Guide Me
star_border
Reply

Questions about InsightsResponse

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

 

I followed a sample PHP code in another thread, but I have an issue with a particular line of code:

 

$reportLocationInsightsRequest->setBasicRequest($basicRequest);
$reportLocationInsightsRequest->setLocationNames('accounts/XXXXXXXXXX/locations/YYYYYYYYY');
$reportLocationInsightsResponse = $location->reportInsights('XXXXXXXXXXX', $reportLocationInsightsRequest);

 

The bold line is the one that leads to an error:

Call to undefined method Google_Service_MyBusiness_ListLocationsResponse::reportInsights()

 

I have loaded the MyBusiness.php file so it's not that. 

 

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Luau D
February 2017

Re: Questions about InsightsResponse

Google Employee
# 2
Google Employee

Hi @Luau D

 

Please make sure you are using the v3.2 version of PHP client library when retrieving location insights through the Google My Business API and include the library file as shown in the following line of code:

 

include_once "MyBusiness.php";

 

Also make sure you define the correct $locations variable when retrieving location insights through the Google My Business API such as the following:

 

$mybusinessService = new Google_Service_Mybusiness($client);
$locations = $mybusinessService->accounts_locations;

 

Please let us know if you have any other questions about the Google My Business API.

 

Thanks,

The Google My Business API team

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Luau D
February 2017

Re: Questions about InsightsResponse

Google Employee
# 2
Google Employee

Hi @Luau D

 

Please make sure you are using the v3.2 version of PHP client library when retrieving location insights through the Google My Business API and include the library file as shown in the following line of code:

 

include_once "MyBusiness.php";

 

Also make sure you define the correct $locations variable when retrieving location insights through the Google My Business API such as the following:

 

$mybusinessService = new Google_Service_Mybusiness($client);
$locations = $mybusinessService->accounts_locations;

 

Please let us know if you have any other questions about the Google My Business API.

 

Thanks,

The Google My Business API team

Re: Questions about InsightsResponse

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you for your help, Shalini S

 

I noticed that in the GMB dashboard there are metrics like Photo views and Photo quantity but in the GMB API documentation there is no mention of getting that data. Is there anyway we can do this?

 

And also a question about refresh tokens - it's not enough to just set access type to offline right? I have to use the refresh token to get a new access token every time the access token expires? 

Re: Questions about InsightsResponse

[ Edited ]
Google Employee
# 4
Google Employee

Hi @Luau D,

 

1. No, unfortunately Google My Business API doesn’t currently provide Photo views and Photo quantity insight data. You can only retrieve the Basic Insights and Driving directions types of insight data using Google My Business API.

 

2. Yes, once the access token expires, the application should use the refresh token to obtain a new one. This way, your application will always be able to request a new access token when necessary. This process requires a user to manually authorize the application only once.

 

Thanks,

The Google My Business API team