simple jquery Plugin that utilizes Google API to get data from a Place on Google Maps

Overview

jQuery Plugin to display Google Reviews of a Place on Google Maps

this will get the 5 reviews, google offers you.

But I need more than 5 reviews!

if you need more, let me direct you a bit: https://developers.google.com/my-business/content/review-data#list_all_reviews - but this will be a different project all by its own

I do not like jQuery!!!1eleven

The NPM Package is here - Frontend Devs will know how to webpack :) or simply extract the code and adapt it to your needs, dropping jQuery as a dependency.

Credits

Inspired by Steven Monson's magnificent article here: https://www.launch2success.com/guide/display-google-reviews-website-2017/ or check out Steven's github. Steven's code is based on peledies jquery plugin repo. So, I simply remixed their work into this repo. Thank you guys!

Dear beginners and copy-pasters

:octocat: For those of you, who are new in programming or can only copy-paste, please make sure, that jQuery, the Google Maps API and the .js-file of this plugin are successfully loaded, before you call this script in your html page.

./demo/index.html is a working demo, the comments will guide you 😉

Prerequisites

  • You must have jQuery in your project: jQuery

  • add the .js and .css of this repo to your project (see ./demo/index.html for inspiration 😉 )

  • if you do not have a working Google Maps API key already: create a Google API Key: https://console.developers.google.com/apis/ make sure to set a limit to your payments

  • add the following line with your Google Maps API key with the key param:

    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&key=YourApiKeyHere"></script>
  • add an empty div element in your html template with an unique ID, where the reviews should show up. In this case:

    <div id="google-reviews"></div>

How to get link to “View All Google Reviews” or "Write a review"

Please see the official Documents for this topic:
https://developers.google.com/my-business/content/review-data#list_all_reviews

  • Step 1. Open a browser, but don’t use Chrome. You can use Firefox, or Edge, or even Internet Explorer but not Google Chrome because it alters the URL and your link will not work correctly.

  • Step 2. Go to Google.com and search for your company’s name.

  • Step 3. Find the card on the right and click “View All Google Reviews” or "Write a review"

  • Step 4. Copy the URL in the address bar.

  • Step 5. Now paste the URL as a link on more_reviews_button_url or write_review_button_url param.

Call the Plugin

Grab your place's ID (https://developers.google.com/places/place-id) and call it as placeId parameter, when calling the plugin.

<script>
jQuery(document).ready(function($) {
  if ($("#google-reviews").length == 0) {
    return
  }
  // Find a placeID via https://developers.google.com/places/place-id
  $("#google-reviews").googlePlaces({
    placeId: 'ChIJZa6ezJa8j4AR1p1nTSaRtuQ',
    // the following params are optional (default values)
    header: "<h3>Google Reviews</h3>", // html/text over Reviews
    footer: '', // html/text under Reviews block
    maxRows: 5, // max 5 rows of reviews to be displayed
    minRating: 4, // minimum rating of reviews to be displayed
    months: ["Jan", "Feb", "MĂ€r", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
    textBreakLength: "90", // length before a review box is set to max width
    shortenNames: true, // example: "Max Mustermann" -> "Max M."",
    moreReviewsButtonUrl: '', // url to Google Place reviews popup
    moreReviewsButtonLabel: 'Show More Reviews',
    writeReviewButtonUrl: '', // url to Google Place write review popup
    writeReviewButtonLabel: 'Write New Review',
    showProfilePicture: true
  });
});
</script>

Are Pull Requests welcome?

Yes, of course :octocat:

You do not need to update the demo folder! I will do this, when your code was merged.

Comments
  • Uncaught TypeError: Cannot read property 'length' of undefined

    Uncaught TypeError: Cannot read property 'length' of undefined

    Uncaught TypeError: Cannot read property 'length' of undefined at filterReviewsByMinRating (jquery-google-reviews.js:76) at callback (jquery-google-reviews.js:115) at places_impl.js:17 at places_impl.js:15 at util.js:208 at common.js:54 at Zl.f (common.js:15) at Ml.j (common.js:54) at Object.c [as _rgg3c0] (common.js:48) at PlaceService.GetPlaceDetails?2sen-US&8sChIJHduuXU1VwokRBtBklimBjmQ&10e3&17m1&2e1&key=AIzaSyCJP67JWpe96_DILfz-_QpN3Gf_DltGqlI&callback=xdc._rgg3c0&token=99670:1

    opened by mtmfahath 6
  • Latest Reviews

    Latest Reviews

    Hi There!

    Awesome work putting up a basic request and html setup! But i noticed one thing when i try to use it in my project. The data you get in the response is the top 5 most relevant reviews instead of latest reviews. Is there a way to tell the API to get the latest review instead of most relevant reviews?

    Cheers

    opened by Ace000001 5
  • Truncate reviews text?

    Truncate reviews text?

    Hello,

    First of all I'm not a JS tech guy, more HTML/CSS.

    Any option to truncate the reviews text depending of the number of words/letters instead of "textBreakLength"? And a an ellipsis or a custom text like "Read more..."?

    Thanks, have a nice day.

    enhancement 
    opened by Eudes95 5
  • How to call new comments?

    How to call new comments?

    I've been using this plugin and it works great. But the problem is it does not fetch latest comments. I've tried to call the reviews again and and even from a different project but still the same selected reviews are the only ones that plugin fetches. So how to call new comments?

    question 
    opened by RavenWits 2
  • API not authorized

    API not authorized

    Hi, i've got an issue with the API. When i just activated it it works without any problem, but after a few minutes i get an error "This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console[...]" ... If i desactivate and reactivate the API it works again for a few minutes.

    Any ideas ?

    opened by j-barot 2
  • Google Reviews Error

    Google Reviews Error

    Uncaught TypeError: Cannot read property 'open_now' of undefined at callback (jquery-google-reviews.js:113) at places_impl.js:17 at places_impl.js:15 at util.js:208 at common.js:54 at Zl.f (common.js:15) at Ml.j (common.js:54) at Object.c [as _rgg3c0] (common.js:48) at PlaceService.GetPlaceDetails?2sen-US&8sChIJHduuXU1VwokRBtBklimBjmQ&10e3&17m1&2e1&key=AIzaSyCJP67JWpe96_DILfz-_QpN3Gf_DltGqlI&callback=xdc._rgg3c0&token=122370:1

    opened by mtmfahath 2
  • Not working

    Not working

    Hello,

    i downloaded the project and applied an api key from Google Places API. Also, i inserted a place id, but when i opened the index.html file, nothing was apperared in my browser. Is there something else that i can do?

    opened by geothan 1
Releases(v1.3.0)
Owner
Simon Neutert
I code, I cycle, I smile. Formschöner Entwickler, stabiles Backend, Frontend blingbling. Jugendstil, hohe Stirn. Code on Apple all day, keeps bugs at bay.
Simon Neutert
A Technical Blogging Website that utilizes Notion as a CMS for ease of modification with the help of the notion-API & whose content has been rendered with next-js and react-notion-x

GDSC MCE Blogs This repo is what GDSC MCE uses to power their blogging website gdsc-mce-blogs. It uses Notion as a CMS, fetching content from Notion a

null 7 Dec 16, 2022
A MERN Stack dapp the utilizes three solidity contracts

A MERN Stack dapp the utilizes three solidity contracts. It verifies user ownership of third party NFTs, generates an image incorporating a third party NFT image pulled from IPFS, mints a new NFT for users that includes an on-chain message and metadata to Opensea standards.

Max Girteit 5 Jun 30, 2022
This website utilizes JavaScript, HTML, and CSS to allow the user to create a to-do list that they can add to, remove from, and edit.

todo Description the project. "To-do list" is a tool that helps to organize your day. It simply lists the things that you need to do and allows you to

Emily Robertson 8 Jul 23, 2022
A store locator plugin using Google Maps API version 3

jQuery Google Maps Store Locator Plugin The files you're looking for are in the dist/ directory Please see my blog for more information and examples.

Bjorn Holine 484 Dec 12, 2022
A landing page, as well as a results page, that utliize both Yelp API and Google Maps API.

Economic Eats Group Project #1 Maintained By: Austin Donovan John Hysong John Guzzetta Jahnathan Exantus Description This project contains a landing p

John Guzzetta IV 7 Aug 4, 2022
A Travel companion app using Google Maps API, Travel Search and Weather API

Travel Advisor Introduction An advanced Travel Companion Application using Google Maps. With Geolocation, Google Maps API, Searching for places, Fetch

Sunny Bhadani 4 Nov 11, 2022
Reddit Place Tracer is a browser based userscript for the 2022 Reddit /r/Place project

Reddit Place Tracer is a browser based userscript for the 2022 Reddit /r/Place project which adds a transparent image on top of the canvas to aid communities with drawing the same image. It shows how the canvas should look, where each pixel goes, and what color. The user must manually click on these spots. It is not an automated bot and does not break any rules.

null 3 Apr 3, 2022
OnePiece /r/place repo to store the template and script for outlining the place to put titles

onepiece-place OnePiece /r/place repo to store the template and script for outlining the place to put titles This script & repo are cloned from Antice

Lopeh 11 Apr 9, 2022
The /r/place Atlas is a project aiming to catalog all the artworks created during Reddit's 2022 /r/place event.

The 2022 Place Atlas The /r/place Atlas is a project aiming to catalog all the artworks created during Reddit's 2022 /r/place event. This project was

Place Atlas 397 Dec 28, 2022
A Single place to Discover, Collaborate, and Get your data right

A Single place to Discover, Collaborate, and Get your data right Darkseal Darkseal includes the following: Metadata schemas - Defines core abstraction

GuinsooLab 13 Dec 28, 2022
jQuery plugin for enhancing HTML Image maps

ImageMapster: A jQuery Plugin to make image maps useful ImageMapster activates the areas in HTML imagemaps so you can highlight and select them. It ha

James Treworgy 787 Jan 4, 2023
SimpleEdit is a jQuery plugin for in-place editing.

jQuery SimpleEdit !!! Outdated, use modern tools like Svelte, Vue, React or Angular !!! SimpleEdit is a jQuery plugin for in-place editing. Dependenci

Walter Woshid 3 Aug 9, 2022
Google-Drive-Directory-Index | Combining the power of Cloudflare Workers and Google Drive API will allow you to index your Google Drive files on the browser.

?? Google-Drive-Directory-Index Combining the power of Cloudflare Workers and Google Drive will allow you to index your Google Drive files on the brow

Aicirou 127 Jan 2, 2023
A great place for platforms to get started on Cloudflare Workers!

Workers for Platforms Example Project Blog post Docs For SaaS companies, it's challenging to keep up with the never ending requests for customizations

Cloudflare 29 Dec 23, 2022
It's a javascript Class which contains utility methods that simplify working with google maps web SDK

About GoogleMapsJSHelper It's a javascript Class which contains utility methods that simplify working with google maps web SDK Note: i used ES7 Class

Sami Alateya 6 Jul 23, 2022
Cross provider map drawing library, supporting Mapbox, Google Maps and Leaflet out the box

Terra Draw Frictionless map drawing across mapping providers. TerraDraw centralises map drawing logic and provides a host of out the box drawing modes

James Milner 106 Dec 31, 2022
Google Clone using NEXT JS ,SSR, Tailwind and Google API's to search data.

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Hamnaikbalkhan 7 Sep 23, 2022
Bertin.js is a JavaScript library for visualizing geospatial data and make thematic maps for the web.

Bertin.js is a JavaScript library for visualizing geospatial data and make thematic maps for the web. The project is under active development. Some of

Nicolas LAMBERT 229 Dec 20, 2022