Stefanowitsch Posted December 20, 2022 Share Posted December 20, 2022 Hello there! I've come across a task to include the google reviews for a client website. You can see that kind of stuff nowadays on nearly every website, I personally am not a big fan of those review carousels but that doesn't matter. I am aware that there seems to be no module for ProcessWire to include those reviews into the site "out-of-the-box". So right now I only see two solutions: 1. Getting the reviews directly trough the Google Maps API PRO: You get a nicely formatted JSON Object that contains all data CONTRA: The maximum amount of reviews you recieve is limited to 5. Which is kind of a bummer. Plus: You have to register a Google Maps API Account to get an API Key which is mandatory for such requests. And this service is not free, too https://mapsplatform.google.com/pricing/ 2. Fetching the reviews over an HTTP request Thanks to @bernhard there is another solution. You take the link of a specific review and via DOM parsing (https://simplehtmldom.sourceforge.io/docs/1.9/api/file_get_html/) you fetch the review data directly form the source, save it as a page and use this as the source for your review. PRO: You only show the reviews you want in any order and as many as you need. CONTRA: A bit of work is involved, you have to add those review links manually to get the data. Other Solutions: It seems that every WordPress website includes such a review widget, and I just had to take a look to see what is different - please forgive me ?This widget here only needs the place ID to fetch all the reviews. No API Key required and the amount is not limited to 5. I wonder how this is possible? So what are your thoughts about this? Have you ever included google reviews in one way or the other on a website? 1 Link to comment Share on other sites More sharing options...
wbmnfktr Posted December 20, 2022 Share Posted December 20, 2022 3 hours ago, Stefanowitsch said: Google Maps API Account to get an API Key which is mandatory for such requests. And this service is not free Well... it depends. You get a credit of about $200 each month to work with some APIs. When you reach those limits you should have enough business to pay that small fee. ? Fun aside... grabbing all the review data via API and storing it as pages would make the most sense here. 3 hours ago, Stefanowitsch said: The maximum amount of reviews you recieve is limited to 5 Check the Google My Business API. That seems to be an easy way to get all reviews. https://developers.google.com/my-business/content/review-data#list_all_reviews If I remember correctly there was yet another API that allowed getting reviews. But can't find it right now. Those WordPress plugins... I always wanted but never took the time to download and explore them. It's plain old PHP so it should be kind of easy to take them apart. I personally grab the reviews (or some of them) manually and update them once in a while. This way I (or the client) have full control on what's listed on the site. Adding a link to the real review and the full business entry on Maps. That works pretty well. 2 Link to comment Share on other sites More sharing options...
Pixrael Posted December 20, 2022 Share Posted December 20, 2022 Comments on this YouTube video: 4 Link to comment Share on other sites More sharing options...
Stefanowitsch Posted December 21, 2022 Author Share Posted December 21, 2022 13 hours ago, Pixrael said: Comments on this YouTube video: Interesting. I was sure I saw this particular plugin on a website with more than 5 reviews being displayed. Anyway, there seems to be no way nowadays to fetch the reviews over any API key without enabling the billing. I got the same message in my console while testing. I now decided to use this solution: - Fetch the latest 5 reviews via the google API - Save the recieved JSON object to a field in the ProcessWire backend - Render the reviews based on that field data I will create a cronjob that fetches new reviews maybe once a week so hat you don't need to do an API request every single time someone visits the page. 2 Link to comment Share on other sites More sharing options...
bernhard Posted December 21, 2022 Share Posted December 21, 2022 7 hours ago, Stefanowitsch said: I will create a cronjob that fetches new reviews maybe once a week so hat you don't need to do an API request every single time someone visits the page. What about this: I (Stefanowitsch) will create a cronjob module that fetches new reviews maybe once a week so hat you don't need to do an API request every single time someone visits the page. ?? 3 Link to comment Share on other sites More sharing options...
Stefanowitsch Posted December 21, 2022 Author Share Posted December 21, 2022 2 minutes ago, bernhard said: What about this: I will create a cronjob module that fetches new reviews maybe once a week so hat you don't need to do an API request every single time someone visits the page. ?? You got me!! 1 Link to comment Share on other sites More sharing options...
markus-th Posted December 21, 2022 Share Posted December 21, 2022 ?♂️ I would leave a beer from Franconia for the module ? 1 Link to comment Share on other sites More sharing options...
Stefanowitsch Posted December 22, 2022 Author Share Posted December 22, 2022 18 hours ago, Markus Thomas said: ?♂️ I would leave a beer from Franconia for the module ? It is happening ? but I will need a few more days... 6 2 Link to comment Share on other sites More sharing options...
zoeck Posted December 22, 2022 Share Posted December 22, 2022 22 hours ago, Markus Thomas said: ?♂️ I would leave a beer from Franconia for the module ? I hope no beer from Kulmbach ? Greetings from Bamberg ? Link to comment Share on other sites More sharing options...
markus-th Posted December 22, 2022 Share Posted December 22, 2022 32 minutes ago, zoeck said: I hope no beer from Kulmbach ? Greetings from Bamberg ? Of course, after all Kulmbach is the secret capital of beer ? Greetings to Bamberg ? Link to comment Share on other sites More sharing options...
Stefanowitsch Posted December 30, 2022 Author Share Posted December 30, 2022 Greetings, everyone! I want to tell you that the module is finished. I have one little concern, though: I planned to in include a save and preview function of the received data for debugging/development purpose. However this would violate the terms of the google maps platform as it seems: https://cloud.google.com/maps-platform/terms 3.2.3 Restrictions Against Misusing the Services. (a) No Scraping. Customer will not export, extract, or otherwise scrape Google Maps Content for use outside the Services. For example, Customer will not: (i) pre-fetch, index, store, reshare, or rehost Google Maps Content outside the services; (ii) bulk download Google Maps tiles, Street View images, geocodes, directions, distance matrix results, roads information, places information, elevation values, and time zone details; (iii) copy and save business names, addresses, or user reviews; or (iv) use Google Maps Content with text-to-speech services. (b) No Caching. Customer will not cache Google Maps Content except as expressly permitted under the Maps Service Specific Terms. (c) No Creating Content From Google Maps Content. Customer will not create content based on Google Maps Content. For example, Customer will not: (i) trace or digitize roadways, building outlines, utility posts, or electrical lines from the Maps JavaScript API Satellite base map type; (ii) create 3D building models from 45° Imagery from Maps JavaScript API; (iii) build terrain models based on elevation values from the Elevation API; (iv) use latitude/longitude values from the Places API as an input for point-in-polygon analysis; (v) construct an index of tree locations within a city from Street View imagery; or (vi) convert text-based driving times into synthesized speech results. This also means that all the review scraper tools out there and the other strategies that we discussed here (fetch the reviews manually and save as page) are also not what google wants us to do. What do you think about that? 2 Link to comment Share on other sites More sharing options...
wbmnfktr Posted December 31, 2022 Share Posted December 31, 2022 Won't say anything about how I do or would handle this particular topic but... -- I AM NOT A LAWYER -- In regards to ... 3.2.3 (a) (i): this seems to be the only part that would apply to the module's purpose by quite a far stretch. 3.2.3 (b): I found this: https://cloud.google.com/maps-platform/terms/maps-service-terms which would allow caching some data for about 30 days, BUT it brings me to another questions: Do the Google Maps terms apply for reviews? 3.2.3 (c): this has almost nothing to do with reviews or this module. So... which API are you using? Is it the classic Google Maps API or some sub-API or maybe even Google Business (Review) API? Which API keys would I need to use your module? 1 Link to comment Share on other sites More sharing options...
Stefanowitsch Posted December 31, 2022 Author Share Posted December 31, 2022 Long story short: When using the module all requests come directly over the Google Maps API. Every user has to generate an own and unique Google API Key and also activate a billing account. Otherwise no data will be send by Google. This is the only way to receive data over the Google API. In fact you pay for the data you are receiving. Would be a bummer if you are not allowed to store that data for your own usage. Link to comment Share on other sites More sharing options...
Stefanowitsch Posted January 3, 2023 Author Share Posted January 3, 2023 Update: I finally released the module. Feel free to test it and give me some feedback: I scrapped the idea of saving the review data for any purpose. I contacted the google support with this question and they confirmed that it would violate their terms to save this data in any way. 4 Link to comment Share on other sites More sharing options...
Recommended Posts