=== ReplyOnTheFly Widget for Google Reviews ===
Contributors: replyonthefly
Tags: google reviews, google reviews widget, embed google reviews, reviews, testimonials
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed Google reviews on WordPress — written into the page itself, so search engines and AI assistants can actually read them.

== Description ==

Most review widgets draw themselves with JavaScript after the page loads. That works for visitors, and it works for Google, which runs JavaScript. It does not work for the crawlers behind AI assistants — ChatGPT, Claude and Perplexity read the HTML your server sends and never run a line of JavaScript. To them, a JavaScript review section is an empty box.

This plugin embeds your Google reviews into the page itself. Crawlers read real review text. Visitors get the live, interactive widget, which takes over the moment it loads. You maintain nothing: the reviews refresh in the background on a schedule.

**How it behaves**

* Reviews are fetched on a schedule, never while someone is loading your page. A slow or unreachable reviews service can never slow your site down.
* The last set of reviews stays up until a newer set arrives, so a failed refresh is invisible to visitors.
* The block reserves its space before the widget loads, so your page doesn't jump.
* Reviews are marked up as quotations with an author and a date, which is what extractors look for.
* Six layouts — carousel, grid, masonry, list, slider, and badge — with light, dark, and auto themes.
* Filter by keyword per page: a wedding page can show only reviews that mention weddings.
* Measures your AI visibility: counts how often AI crawlers read your site and when visitors arrive from AI assistants like ChatGPT or Perplexity, reported in your ReplyOnTheFly dashboard. It can also verify your site for Google Search Console automatically if you ask ReplyOnTheFly to set that up. Only your site's hostname and aggregate counts are ever sent — see External Services.
* Optional business info sync: with a ReplyOnTheFly business key set, the plugin keeps a LocalBusiness structured-data block and a visible name/address/hours block (shortcode `[rotf_business_info]`) in step with your live Google Business Profile. It stands down automatically if Yoast Local SEO or Rank Math's Local module already writes that markup.
* Optional blog post import (off by default): posts you approve in your ReplyOnTheFly account are created as normal WordPress posts twice a day, with images stored in your own media library. Once imported, a post belongs to you — the plugin never edits or deletes it.

**What you need**

A free ReplyOnTheFly account is not required to display your reviews, but connecting one lets the widget show your full review history instead of the five Google's public API hands out. Build your widget at replyonthefly.com and paste the code into this plugin's settings.

== External Services ==

This plugin is a client for the ReplyOnTheFly reviews service. It connects to the endpoints below, all operated by ReplyOnTheFly and served over HTTPS:

1. **Review data** — `https://www.replyonthefly.com/api/public/widget-reviews`. Called by your server on a schedule (hourly, via WP-Cron) and when you save settings or click "Refresh now". It sends the Google Place ID you configured and your site's URL (in the request's user agent, so we can identify misbehaving traffic). It returns the reviews Google makes available for that Place ID. No visitor data, cookies, or personal information is ever sent.

2. **Business search** — `https://www.replyonthefly.com/api/tools/place-search`. Called by your server only when an administrator types in the business search box on the settings screen. It sends the search text you typed and your site's URL (in the request's user agent) and returns matching Google Business listings so you can pick yours. Never called on the public site.

3. **Widget script** — `https://www.replyonthefly.com/widget/reviews.js`. Loaded in the visitor's browser to display the live, interactive widget. The script requests the same review data endpoint from the browser; the request includes the standard referrer header, which tells the service which site is displaying the widget.

4. **AI visibility measurement** — `https://www.replyonthefly.com/api/public/plugin/measure`. Two kinds of reports, both containing only your site's hostname and aggregate counts, never visitor identities, IP addresses, cookies, or browsing data: (a) your server reports, once per hour alongside the review refresh, how many times known AI crawlers (such as GPTBot or ClaudeBot) requested your pages, and receives back a Google site-verification token if you have asked ReplyOnTheFly to set up Search Console for you; (b) when a visitor arrives from an AI assistant (such as ChatGPT or Perplexity), the visitor's browser sends a single event naming the assistant — nothing about the visitor. These numbers power the AI-visibility reporting in your ReplyOnTheFly dashboard. Reports from sites not linked to a ReplyOnTheFly account are discarded.

5. **Business info sync** — `https://www.replyonthefly.com/api/public/site-kit`. Only used when you have entered a ReplyOnTheFly business key in settings; called by your server on the same hourly schedule. It sends that key and your site's URL (in the request's user agent) and returns the LocalBusiness structured data and the visible name/address/hours block that ReplyOnTheFly generates from your live Google Business Profile. The first successful sync sends a single confirmation (`.../api/public/site-kit/confirm`) containing the business key and your site URL, so your ReplyOnTheFly dashboard can show the connection as active. No visitor data is ever sent.

6. **Blog post import** — `https://www.replyonthefly.com/api/public/content-posts`. Off by default; runs only if you have enabled the import option AND set a business key. Called by your server twice a day, it sends the business key and your site's URL (in the request's user agent) and returns blog posts you have already approved in your ReplyOnTheFly account, which are created as normal WordPress posts. Images referenced by those posts are downloaded from ReplyOnTheFly's media hosting into your own media library so nothing is hotlinked. No visitor data is ever sent.

No data is sent to any other third party. Terms of service: https://www.replyonthefly.com/terms — Privacy policy: https://www.replyonthefly.com/privacy

== Installation ==

1. Install and activate the plugin.
2. Go to **Settings → Google Reviews** and search for your business — pick it and your reviews appear in the live preview. (Already built a widget at [replyonthefly.com](https://www.replyonthefly.com/tools/google-reviews-widget)? Pasting its embed code works too.)
3. Add the **Google Reviews** block to any page, or use the shortcode `[rotf_reviews]`.

== Frequently Asked Questions ==

= How do I embed Google reviews on WordPress? =

Install this plugin, search for your business in Settings → Google Reviews and pick it — your reviews appear in the live preview immediately. Then add the Google Reviews block or the `[rotf_reviews]` shortcode wherever you want the reviews to appear.

= Does this slow my site down? =

No. Your pages never wait on the reviews service. Reviews are fetched by a scheduled background job and stored in your database; rendering a page only reads what is already there.

= What happens if the reviews service goes down? =

Nothing visible. The reviews already stored keep showing until a refresh succeeds.

= Can different pages show different reviews? =

Yes. Any setting can be overridden per placement:

`[rotf_reviews layout="carousel" filter="brunch" max_reviews="3"]`

= What if no review matches my keyword? =

The widget shows your most recent reviews rather than an empty space, and switches to matching reviews on its own once someone writes one.

= Does this add review schema / star ratings in search results? =

No, deliberately. Google does not allow review rich results for reviews about a business on that business's own website — it names embedded review widgets specifically. A plugin that injected that markup anyway would earn nothing and risk a manual action.

== Screenshots ==

1. The Google Reviews block in the editor — the preview is the real server render.
2. A grid of Google reviews embedded on a page, with the live widget loaded.
3. Settings → Google Reviews: paste your embed code and every option comes across.
4. The badge layout — a compact Google rating widget for a header or footer.
5. Per-page keyword filtering: a wedding page showing only wedding reviews.

== Changelog ==

= 1.0.0 =
* First release. Embed Google reviews with a block or shortcode; google reviews widget layouts (carousel, grid, masonry, list, slider, badge); server-rendered review text for SEO and AI search; hourly background refresh; per-page keyword filters; optional credit setting.
