How to add reviews to a React site
In this article we'll show you an alternative method of embedding our review widget to your site, if the regular script isn't working for some reason. The instructions can be used with, for example, sites built with React, Node.js, etc. and also with other types of websites, if you're running into issues with the regular embedding process.
Start by navigating to the Widgets section in Trustmary. In there, select a widget or create a new one.

Once in the widget editor, click the Add to website button. Here you'll find the first code snippet needed to embed the widget.

Click the Copy button next to the code on the darker background to copy it.

Then take the widget ID (the string of characters in the URL) from the code you just copied...

...and paste it in place of the asterisks on this div-element:
The code can then be installed on your site on the spot where you would like the widget to appear.
Next you'll need to get the script that loads the widgets on your site, and is installed in the head element of your website. Start by navigating to your account Settings.

Under the Developers tab, you'll find the Trustmary tag script, which you can copy by clicking the Copy button on the right.
You can also get to this view by clicking the API & Webhooks in the navigation bar while on the Dashboard.

Once you've copied the script from the settings, install it to the head element (between <head> and </head>) on your website. Some editors might refer to this as "Code injection" or "Adding custom code".
When both of the code snippets are installed correctly in their respective places, the widget should be displayed, and your reviews should be online.
How to find the code snippets
Generating the embed code
Start by navigating to the Widgets section in Trustmary. In there, select a widget or create a new one.

Once in the widget editor, click the Add to website button. Here you'll find the first code snippet needed to embed the widget.

Click the Copy button next to the code on the darker background to copy it.

Then take the widget ID (the string of characters in the URL) from the code you just copied...

...and paste it in place of the asterisks on this div-element:
<div data-trustmary-widget="********"></div>
The code can then be installed on your site on the spot where you would like the widget to appear.
Getting the head element script
Next you'll need to get the script that loads the widgets on your site, and is installed in the head element of your website. Start by navigating to your account Settings.

Under the Developers tab, you'll find the Trustmary tag script, which you can copy by clicking the Copy button on the right.
You can also get to this view by clicking the API & Webhooks in the navigation bar while on the Dashboard.

Once you've copied the script from the settings, install it to the head element (between <head> and </head>) on your website. Some editors might refer to this as "Code injection" or "Adding custom code".
When both of the code snippets are installed correctly in their respective places, the widget should be displayed, and your reviews should be online.
Updated on: 27/02/2025
Thank you!