-1

I've stumbled upon something when using Google's Places API to retrieve info about a place.

When I retrieve the info for one specific place using the Place Details API request, I get a different total rating than when opening the same place (with the same id) using Google Maps.

Why is this?

The only qualification for the API data, clearly stated in the documentation, is that not all but a maximum of five reviews are returned using the API.

I cannot find anything anywhere saying that the API data is not expected to be the same as what is visible in the UI -- and, in fact, in all other cases than this, it has been the same.

Example:

enter image description here

This place has an overall rating of 5.0 based on "19 reviews", of which 17 contain text and 2 just the star ratings.

Using the same ID, here's what the API call returns:

{ html_attributions: [],
  result:
   { address_components:
      [ [Object], [Object], [Object], [Object], [Object], [Object] ],
     adr_address:
      'Chandlery Building, Hamble Point Marina, <span class="street-address">School Lane, Hamble</span>, <span class="extended-address">Hamble-le-Rice</span>, <span class="locality">Southampton</span> <span class="postal-code">SO31 4NB</span>, <span class="country-name">UK</span>',
     business_status: 'OPERATIONAL',
     formatted_address:
      'Chandlery Building, Hamble Point Marina, School Lane, Hamble, Hamble-le-Rice, Southampton SO31 4NB, UK',
     formatted_phone_number: '023 8045 7008',
     geometry: { location: [Object], viewport: [Object] },
     icon:
      'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png',
     international_phone_number: '+44 23 8045 7008',
     name: 'Inspiration Marine Group Ltd',
     opening_hours: { open_now: false, periods: [Array], weekday_text: [Array] },
     photos: [ [Object], [Object], [Object], [Object] ],
     place_id: 'ChIJQ0_yxRpwdEgRziRrjoX0cUM',
     plus_code:
      { compound_code: 'VM2P+CV Southampton, UK',
        global_code: '9C2WVM2P+CV' },
     rating: 4.9,
     reference: 'ChIJQ0_yxRpwdEgRziRrjoX0cUM',
     reviews: [ [Object], [Object], [Object], [Object], [Object] ],
     types: [ 'point_of_interest', 'store', 'establishment' ],
     url: 'https://maps.google.com/?cid=4859934327366689998',
     user_ratings_total: 19,
     utc_offset: 0,
     vicinity:
      'Chandlery Building, Hamble Point Marina, School Lane, Hamble, Southampton',
     website: 'http://www.inspirationmarine.co.uk/' },
  status: 'OK' }
mglonnro
  • 151
  • 10
  • 1
    And where did you read that the data from the API is guarranteed to be the same than the data on the website? – MrUpsidown Nov 17 '20 at 15:13
  • @MrUpsidown: I think it's a fair assumption. The Places API is part of the Google Maps platform, so when I access the exact same place through the Google Maps UI, I assume I'd get the same information as accessing it through the API... – mglonnro Nov 17 '20 at 18:09
  • 1
    You assume so but there is nothing that says that anywhere in the documentation. They are different products and it's not the first time I see or hear that there are discrepancies between the 2. Now what's your question anyway? Because you didn't ask anything... If you believe this is an issue, you should contact Google. – MrUpsidown Nov 17 '20 at 18:41
  • I do believe it is an issue and I chose to post the question here instead of (or in addition to) contacting Google. Maybe we'll overcome it :) – mglonnro Nov 17 '20 at 19:07
  • How do you believe we can overcome a data *issue*? This is a place to ask about programming issues. Seems your code works... Devs at SO are not responsible for Google data quality. If it was clearly stated that you *will* get the same data in the API and on the website, it would be an issue (for Google). But it isn't. Have you compared the data at all? How is the rating calculated? Is there for instance a more recent review on the website that isn't in the API yet and that changes the score? It would surely make sense to get the same results, it's just not guaranteed. – MrUpsidown Nov 17 '20 at 19:29
  • I meant to overcome the fact that I've decided to post the question here! And yes, I did check for recent reviews, and none of those to be found. I appreciate that it is not guaranteed to be the same, of course, due to a large number of factors, but I'm interested in a) am I doing something wrong and b) if not, then why. The arithmetic in this case (going through the UI reviews) should be (18 * 5 + 1 * 4)/19 = 4,947... so maybe there's some rounding issue somewhere. Thank you for your comments, anyway! EDIT: I'll try to contact Google to ask. – mglonnro Nov 17 '20 at 19:56
  • I can't think of what you could be doing wrong. Doing a request, getting results... now, how are they calculating the rating? What 5 reviews will you get? etc. isn't described anywhere, AFAIK. Your only option if you expect clarification is: https://issuetracker.google.com/issues?q=componentid:188872%2B%20status:open but don't expect anything to happen soon, they rarely answer quickly... – MrUpsidown Nov 17 '20 at 20:07

1 Answers1

2

I received an answer from Google explaining the difference:

  • The rating received through the Places API is an arithmetic average.
  • When the place is shown in Google Maps, the rating is calculated differently (my bold):

Your score is calculated from user ratings and a variety of other signals to ensure that the overall score best reflects the quality of the establishment. https://support.google.com/business/answer/4801187

I remember reading somewhere that Google actually changed this feature, and moved to simple arithmetic averages, but apparently, this was not completely so.

mglonnro
  • 151
  • 10
  • Which confirms that they are different products which can lead to different results ;) Thanks for sharing the info though. – MrUpsidown Nov 18 '20 at 12:58