Add a TrustBox to a website using Google Tag Manager

This feature is included in the Free plan

Get started now

If you want to add a TrustBox to your website but have limited access to the source code, you can use Google Tag Manager (GTM) to add the widget as a custom script. This guide shows you how to do it.

GTM allows you to add a TrustBox to your website as a custom script. You'll use GTM to create a new Custom HTML tag, add the TrustBox code, then position it on the web page.

Check that you've set up GTM correctly on all the web pages where you’d like to display TrustBoxes. If you need help, refer to Google’s GTM support article.

Note: You should have basic knowledge of HTML to use Google Tag Manager.

How to do it 

  1. Log in to your Trustpilot Business account, then navigate to Showcase > Website widgetsSelect your TrustBox, then click Get code
  2. Log in to your Google Tag Manager account and create a new Custom HTML tag.
    Image_0__1_.png
  3. Your TrustBox appears at the bottom of the page by default. There are two ways to change its placement: 
    • If you have access to the HTML of your page, add a TrustBox placeholder container, for example, <div id="trustbox"/>. Use GTM to insert the TrustBox in the placeholder container.
    • Find an existing container in your HTML source and refer to its ID or class property in GTM to insert the TrustBox. In the example below, you'd refer to the "customer-experience" element as your widget's container in GTM. Image_1__1_.png
  4. In the Tag Configuration panel, paste the TrustBox code and wrap it inside a JavaScript function.
    • Replace the HTML_ID placeholder with the ID of the container you chose in step 3.
    • Replace the TRUSTBOX_HTML placeholder with the TrustBox's HTML code. It's the code with the <div> element.
    <script>
     (function () {
      var containerId = 'HTML_ID';
      var trustboxContainer =
       document.getElementById(containerId) ||
       document.getElementsByClassName(containerId)[0];
      if (trustboxContainer) {
       var trustbox = document.createElement("div");
       trustbox.innerHTML = 'TRUSTBOX_HTML';
       trustboxContainer.appendChild(trustbox);
      }
     })();
    </script>
    <!-- TrustBox script -->
    <script type="text/javascript" 
    src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js" async></script>
    <!-- End Trustbox script -->
    	
    Important: Always add the bootstrap script right after the HTML code.
  5. Under Triggering > Firing Triggers, add a DOM Ready trigger as a firing trigger. Image_2.jpg
  6. Create a new version in GTM and publish your changes.