# Add review widgets to your store

> Show product reviews on any online store with one script tag: a star rating badge, a reviews list and review carousels that match your theme.

Reytd's widgets show your product reviews on your own store: a star rating badge next to each product's title, the reviews on each product page, and review carousels. They work on any site you can add a script tag to, and they pick up your theme's font and text colour; you choose the stars' colour. The script is about 9 KB, so it travels light.

## What you need

- **A Reytd store** with its products, so each review belongs to a product. Products come in through the [API](https://reytd.com/docs/api.json) or, on Growth and Pro, a CSV or Excel import in Reytd.
- **Access to your site's theme or HTML**, to add one script tag and the widgets' elements.

On WooCommerce, you need neither: our [plugin](https://reytd.com/docs/integrations/woocommerce.md) sends your products and places the widgets for you. A Shopify app is coming soon; until then, the widgets work on Shopify like on any other site, by adding the script and the elements to the theme.

## Add the script

Add this once for your whole site, for example in your theme's `<head>`. Your own snippet, with your store's handle filled in, is on the **Widgets** page in Reytd.

```html
<script
    src="https://widgets.reytd.com/v1/reytd.js"
    data-store="your-store"
    async
></script>
<style>
    .reytd-stars {
        min-height: 1.5em;
    }
</style>
```

The `<style>` keeps a line for each star badge before the script has run, so the stars land in their own spot instead of pushing your page down.

`data-store` is your store's handle, which tells the widgets whose reviews to show. It never changes, even if you rename the store, so the script keeps working. Added the script twice by mistake? No harm done: it only runs once.

To try the widgets with your store's sandbox, for example on a development copy of your shop, load the script from `sandbox-widgets.reytd.com` instead of `widgets.reytd.com`. The sandbox's page in Reytd has the snippet.

In the sandbox, the widgets show the sandbox's reviews, with the same script as live (the sandbox's address passes it on), and they don't count in your widget stats. If your site has a Content Security Policy, allow `https://sandbox-widgets.reytd.com` in `script-src` and `connect-src` too (see [If a widget shows nothing](#if-a-widget-shows-nothing)).

## Place the widgets

Each widget is an empty element with a class, placed where it should appear. The script finds them and fills them in, including ones added to the page later, such as in quick views or infinite scroll.

```html
<div class="reytd-stars" data-product="10001"></div>
<div class="reytd-reviews" data-product="10001"></div>
<div class="reytd-carousel"></div>
```

A widget names its product in one of three ways:

- `data-product`: the id you send for the product through the API, usually your shop's own product id.
- `data-sku`: the product's SKU. If more than one of your products has the same SKU, the widget shows no reviews rather than another product's. That happens when a variant shares its parent's SKU, or with a placeholder like "N/A": use `data-product` for those.
- `data-group`: a product group's id, to show the reviews of every product in the group, for example all colours of a T-shirt (on Growth and Pro).

Give an element more than one, and `data-product` wins, then `data-sku`, then `data-group`. A star badge or reviews widget with none of them stays empty. On Growth and Pro, a product that's in a group already shows the whole group's reviews, its own first; on Free, each product shows its own.

The three widgets each have their own guide:

- [Star rating badge](https://reytd.com/docs/widgets/star-rating.md): next to the title, on product, collection and search pages.
- [Reviews widget](https://reytd.com/docs/widgets/reviews.md): the reviews themselves, on the product page.
- [Review carousels](https://reytd.com/docs/widgets/carousel.md): a row of review cards, for a product or for the whole store, on Growth and Pro.

No need to write the snippets by hand. The **Widgets** page in Reytd fills them in for the star badge and the reviews widget of your most-reviewed products, and **All widgets** shows every widget, carousels included, with its snippet.

### Single-page shops

The widgets work in shops that change product without loading a new page, such as ones built with React, Vue, Next.js or Nuxt. When the product changes, pick whichever fits your code:

- **Change the attribute:** keep the widget's element and set its `data-product` (or `data-sku`, `data-group`) to the next product. The widget clears and shows the new product's reviews.
- **Replace the element:** remove the old widget and add a new one for the next product. The script finds it like any widget added later.

There's nothing to call. A widget never shows a product the shopper has left, even when that product's reviews arrive after the switch. The [rating markup for Google](https://reytd.com/docs/widgets/google-stars.md) follows along: the page keeps only the markup of the product it shows.

## Settings

On the **Widgets** page in Reytd, you set these for all your widgets at once:

- **Star colour**, to match your brand.
- **Reviews at a time** in the reviews widget, before "Show more".
- **Show first**: the newest reviews (the default), the lowest ratings, or, with helpful votes on, the most helpful. Shoppers can change the order themselves, to the highest ratings first too, but EU rules on reviews don't allow that as the default.
- **Dates** and **"Verified purchase"** on each review, on or off.
- **Helpful votes**, on Pro: shoppers can mark a review as helpful (off to start with; see [Helpful votes](https://reytd.com/docs/widgets/reviews.md#helpful-votes)).
- **Rating markup** for stars in Google's results: see [Stars in Google results](https://reytd.com/docs/widgets/google-stars.md).

The widgets show "Powered by Reytd" on the Free plan; Growth and Pro remove it. Every review list also links to "How reviews are collected", on every plan, as EU rules require.

## Languages

The widgets speak English, Swedish, Norwegian, Danish, Finnish and German. They follow your page's language (the `lang` of its `<html>` tag) and show English for any other. To choose the language yourself, add `data-locale` to the script:

```html
<script
    src="https://widgets.reytd.com/v1/reytd.js"
    data-store="your-store"
    data-locale="sv"
    async
></script>
```

Reviews are shown in the language they were written in, with those in the page's language first.

### Translated reviews

(Growth and up) On Growth and Pro, the widgets can show every review in the page's language: on a Swedish page, a review written in English is shown in Swedish, marked "Translated from English" with a link to show the original.

Reviews are always translated into your store's language (chosen when you set up the store, and changed under _Store settings_). Choose the others under _Settings_ on the Widgets page: 2 languages in all on Growth, with English to start with, and every language on Pro.

On a page in a language you haven't chosen, reviews are shown as they were written. A page in a language the widgets don't speak gets them in English: translated, when English is one of your languages.

Reviews are translated by AI (Anthropic's Claude) when they're written, not when a shopper opens the page, so the widgets load just as fast. The rating markup for Google keeps each review's own words.

## Speed

Small is the whole idea. The script is about 9 KB and loads with `async`, after your page, so your content doesn't wait for it. In our speed tests, the stars show in less than 50 ms on a good connection, in the line the snippet's `<style>` kept for them. The reviews widget draws itself when a shopper is about to scroll to it.

The files come from a CDN near the shopper. Reytd's own server only answers for what isn't in those files: reviews past a product's latest 100, sorted or filtered lists for products with more reviews than that, the usage counts and helpful votes. [Review widgets and page speed](https://reytd.com/docs/widgets/page-speed.md) explains how it's measured, and how to check any review app on your own store.

## Widget stats

The **Widgets** page in Reytd shows where shoppers have seen your widgets and how they use them:

- **Seen on:** the latest sites (up to five) where a shopper opened a page with a widget, and when that last happened. A handy check that the script is in place.
- **The last 30 days:** how often star badges, reviews and carousels were seen, and how often shoppers clicked a badge or a carousel's product, opened more reviews or filtered by stars, overall and by product.

They're counts only: no shopper's personal data, and no cookies (see [Privacy](#privacy)).

## Privacy

The widgets set no cookies, and unless you turn on helpful votes, they store nothing on your shoppers' devices, so they need no cookie consent. To count how often your reviews are seen and used, and on which site, they send anonymous usage counts. Your privacy policy should still say they're there; with helpful votes off, you can use this sentence:

> Product reviews on this site are shown with Reytd (reytd.com). To count how often they are seen and used, and on which site, the review widgets send anonymous usage counts to Reytd, without cookies and without storing anything about you.

With [helpful votes](https://reytd.com/docs/widgets/reviews.md#helpful-votes) on, a shopper's browser remembers their votes, and Reytd keeps a scrambled form of their internet address for 30 days so that each vote counts once. Neither needs cookie consent, but your privacy policy should mention both; use this sentence instead:

> Product reviews on this site are shown with Reytd (reytd.com). To count how often they are seen and used, and on which site, the review widgets send anonymous usage counts to Reytd, without cookies. If you vote on whether a review was helpful, your browser remembers your vote, and Reytd keeps a scrambled form of your internet address for 30 days so that each vote counts once.

## If a widget shows nothing

- **There are no reviews to show yet.** A product's star badge and carousel show nothing until it has a review (the badge keeps its empty line), and its reviews widget says there are none yet. A store-wide carousel waits for a 4- or 5-star review with a title or text.
- **The product id doesn't match.** It looks just like the item above: the badge stays empty, and the reviews widget says there are no reviews yet. `data-product` must be the same id your store sends for the product through the API, or use `data-sku` with its SKU.
- **The script is missing or has the wrong handle.** Check that the page has the script tag, and that its `data-store` is the handle on the **Widgets** page. Once shoppers start seeing your widgets, that page also lists the sites they were seen on.
- **A carousel on the Free plan.** Carousels come with Growth and Pro.
- **Your site has a Content Security Policy.** Allow:
    - `https://widgets.reytd.com` in `script-src` and `connect-src`;
    - `https://reytd.com` in `connect-src`, for older reviews, sorted lists, the usage counts and helpful votes;
    - `'unsafe-inline'` in `style-src` (or in `style-src-elem` and `style-src-attr`). Don't add a nonce or hash there: browsers then ignore `'unsafe-inline'`. The widgets style themselves inside their own part of the page, so their styles never touch your theme's.
