Skip to content

Embed review widgets

Add the review widget to any website with two lines of HTML, every attribute it reads, how to style it, and how it behaves in single-page apps and with a content security policy.

How-to guide3 min read

The widget shows your reviews on any website: a list, a carousel or a badge with the average. It is a small script with no iframe and no cookies, and it reads the public reviews API. Someone on your team can build it under Widgets and give you the snippet; this page is for when you add it yourself. For what the widget shows and why, read Show reviews on your website.

Websites built with CMS Orbit use their own review blocks instead. See Your reviews on websites built with CMS Orbit.

1Add the snippet

Put the div where the reviews should show, and the script once anywhere on the page:

HTML
<div data-presence-reviews data-business="northwilds" data-location="northwilds-oslo" data-layout="list" data-theme="auto" data-limit="6"></div><script src="https://app.bifrostorbit.com/presence/embed.js" async></script>

One script fills every div with data-presence-reviews on the page, so the Oslo, Bergen and Tromsø shops can sit side by side.

2Choose what it shows

data-presence-reviews
What it does
Marks the element. Required
data-business
What it does
Your Short name under Settings, such as northwilds. Required
data-location
What it does
One location's slug, such as northwilds-oslo
data-group
What it does
A location group's id, for all its locations
data-sources
What it does
Review sites, comma separated, such as google,trustpilot
data-min
What it does
Only ratings from this number up, 2 to 5. Widgets offers 4 and 5
data-limit
What it does
How many reviews, 1 to 30. The default is 10
data-layout
What it does
list (the default), carousel or badge, which shows the average and the number of reviews only
data-theme
What it does
auto (the default) follows the visitor's light or dark setting; or light or dark

Leave out data-location and data-group for every location. These are the same as the API's location, group, sources, min and limit.

3Style it

The widget takes the font of your page. It draws inside a section with the class pw, and its colours are CSS variables you can override:

css
.pw {  --pw-bg: #fbfaf7;  --pw-fg: #1f2a24;  --pw-muted: #5d6b63;  --pw-line: #dfe4df;  --pw-star: #c98a2b;  border-radius: 4px;}

Other classes are pw-head, pw-avg, pw-stars, pw-list, pw-item, pw-reply and pw-foot. The layout and theme are on the section as data-layout and data-theme, so .pw[data-theme=dark] sets your dark colours. Keep the footer visible: it holds the disclosure and the How we collect reviews link, which EU and UK rules ask for.

Stars have role="img" and a label such as '5 out of 5 stars', so screen readers read the rating, not the star characters.

Single-page apps

The script fills the elements on the page when it loads, and each element only once. If your app adds a widget later, such as after a route change in React, Vue or Next.js, the new element stays empty. Either load the script again after the element is in the page, or call the API and render the reviews in your own components.

Before the reviews arrive, and if they can't be loaded, the element keeps whatever you put inside it. Put a short fallback there, such as a link to your Google reviews.

Content security policy

If your website sends a content security policy, allow Presence Orbit for scripts and for requests, and allow inline styles, as the widget adds one style element:

Text
script-src https://app.bifrostorbit.com;connect-src https://app.bifrostorbit.com;style-src 'unsafe-inline';

Add these to the sources you already allow.

Allowed websites

If an Admin lists websites under Settings, Your website, only those can load the reviews. Add every address the widget runs on, including staging, such as https://staging.northwilds.com. https://www.northwilds.com and https://northwilds.com count as different websites.

Caching

The script is cached for an hour and the reviews for a few minutes, so a new review shows within about 5 minutes. See Public reviews API for the details.

The widget adds no review structured data. Google doesn't show stars for reviews a business shows about itself, even through a widget. See Review stars and structured data.

Was this page helpful?

Read next