Skip to content
0 reviews deleted for paymentHow TrustSays works
Help

Add a widget to a page in plain HTML

Put the box where the widget should be shown, and the script once at the bottom of the page. Pages built with JavaScript call scan.

Widgets2 min read
On this page
  1. How to do it
  2. Several widgets on the same page
  3. Pages built with JavaScript
  4. Placement
  5. If it doesn't work

If you have access to the page's HTML yourselves, or you use a system other than the ones we have guides for, here's how to do it.

How to do it

  1. Copy the code in Widget studio with Copy code.
  2. Put the box with the class trustsays-widget where the widget should be shown on the page.
  3. Put the script on the page once, ideally at the bottom just before the closing body tag.
  4. Save, and open the page in the browser.

The script loads with async, so it doesn't wait for or slow down the rest of the page.

Several widgets on the same page

Copy the box for each widget you want. The script only needs to be there once. If it's there several times, nothing goes wrong, but it isn't necessary.

Pages built with JavaScript

If your site uses React, Vue or another framework where content changes without the whole page reloading, the script only finds the boxes that are there when the page opens. If you add a new widget later, call window.TrustSays.scan() afterwards. The new boxes are then drawn.

Placement

  • Floating button, Floating tab and Latest review stay fixed in a corner of the screen, wherever the box is.
  • Mobile bar stays fixed at the bottom and is only shown under 900 px.
  • The other widgets fill the space the box gets on the page.

If it doesn't work

  • Open the page from your real address, not as a file directly from your computer.
  • Check that a Content-Security-Policy on your site allows scripts, data and fonts from api.trustsays.com.
  • See The widget isn't showing.
Was this helpful?
Still need help?Write to us and we'll get back to you. We reply on weekdays between 8 and 18.Contact us

We use cookies

Necessary cookies make the site work. If you accept all, we also use cookies for statistics and to measure our own ads. Read the cookie policy