How to use it
- In Google Cloud, enable Places API (New) and create an API key. Restrict the key to that API.
- In Bricks > Kiln, turn on Query loop: Google reviews, paste the key and a Default Place ID. The link under the field opens Google's Place ID finder.
- Select a Container, Block or Div and turn on its query loop.
- In the Query editor, choose the query type Google reviews (Kiln).
- Under the Query control, set what to show:
- Place ID: leave it empty to use the default. Dynamic data is allowed, so a custom field can hold a different place on each page. Every place a loop names must be the default or listed under Other Place IDs; any other ID shows nothing.
- Number: from 1 to 5. Google returns at most five reviews for a place.
- Minimum stars: from 1 to 5.
- Order: As Google shows them (the default) or Newest first.
- Inside the loop, add the tags below from the dynamic data picker (group Kiln) or type them.
Review tags (inside the loop)
{kiln_review_author}: the reviewer's name.{kiln_review_author_url}: the reviewer's Google profile.{kiln_review_author_photo}: the reviewer's photo. Use it as an image source, or as a URL in text.{kiln_review_rating}: the rating as a number from 1 to 5.{kiln_review_stars}: the rating as stars, for example ★★★★☆. In text it carries a label for screen readers ("4 out of 5 stars").{kiln_review_text}: the review. Add a word count to shorten it:{kiln_review_text:30}.{kiln_review_time}: Google's relative time, for example "2 months ago".{kiln_review_date}: the date in your site's date format. Add a PHP date format to change it:{kiln_review_date:j M Y}.{kiln_review_url}: the review on Google Maps.
Place tags (anywhere on the page)
{kiln_place_rating}: the average rating, for example 4.8.{kiln_place_reviews_count}: the total number of reviews on Google.{kiln_place_name}: the place's name.{kiln_place_maps_url}: the place on Google Maps.
Place tags use the default place. Add a Place ID to use another one: {kiln_place_rating:ChIJ…}. List that ID
under Other Place IDs in the settings first.
Where it appears in Bricks
- Query editor: the query type Google reviews (Kiln).
- Container, Block, Div, Content tab, directly under the Query control: the fields above. They show while that query type is chosen.
- Dynamic data picker: the tags, in the Kiln group, labelled "Google review: author name", "Google place: rating" and so on.
How it works with Bricks
- You choose how Kiln treats Google's answer (Settings, below). Google's Maps Platform terms don't allow
storing reviews, so Kiln won't decide for you, and the loop shows nothing until you choose:
- Store it for 6, 12 or 24 hours: Kiln asks Google once per place and language in that window, and page views in between cost nothing. This goes beyond Google's terms; the risk, such as Google suspending the key, is yours.
- Ask Google on every page view: within the terms. Each page view costs one request per place and language it shows, billed to your key and shared by every loop and tag on that page. Editing in the builder costs requests too. The page waits for Google's answer, up to 10 seconds if Google is slow. A page cache plugin that stores whole pages stores the reviews too.
- If Google answers with an error, or your quota runs out, the loop is empty and the place tags print nothing. After a failed request Kiln waits 10 minutes before asking again.
- Reviews come in the site's language when Google has a translation. On a multilingual site Kiln asks for and stores
each language separately. The
kiln/google_reviews/languagefilter changes the language sent. - Review text is plain text. Braces and square brackets in it are encoded, so a reviewer cannot place a Bricks tag or a shortcode in a review and have it run, even in a Rich Text element.
- Kiln asks Google only about the places you listed. A Place ID that reaches a page any other way, for example from a search term or a URL parameter, costs no request and shows nothing.
- Kiln runs profile links through WordPress' URL check and drops any that is not http or https.
Limits
- Google's API returns at most five reviews per place, chosen by Google. Kiln cannot list every review.
- The review tags work only inside a Kiln Google reviews loop. Elsewhere they print nothing.
- With no key, or a Place ID Google does not know, the loop is empty and the place tags print nothing.
- Google's terms for Places content apply to your site: show the reviewer's name next to each review and credit Google. Read the current Places API policies before you launch.
- Google bills the requests to your Cloud account. Set a budget alert in Google Cloud.
Settings
Bricks > Kiln > Query loop: Google reviews:
- Places API key: Kiln keeps it on your server and never prints it in a page. The field stays empty after saving. Paste a new key to replace it, or tick Remove when I save.
- Default Place ID: the place every loop and place tag uses unless it names another.
- Other Place IDs: one per line, up to 50. Loops and tags may name these places too.
- Google's answer: Store it, and ask again after 6, 12 or 24 hours, or Ask Google on every page view. No default: choose one. Switching away from storing, or changing the hours, deletes what Kiln stored.
- After a failed request, the settings show when it happened and Google's answer code (400 or 403: check the key; 429: the quota ran out).
Requirements
Bricks 2.4 or newer, and a Google Cloud project with Places API (New) enabled and billing set up.