Trustpilot GTM tag template

7 minutes read

The Trustpilot template for Google Tag Manager supports two distinct actions: loading TrustBox review widgets on your pages and sending post-purchase review invitation emails. The widget loader injects the Trustpilot bootstrap script that automatically discovers and renders TrustBox elements in your HTML. The invitation action uses Trustpilot’s JavaScript command queue to register your integration key and submit customer order data for review collection.

Features

  • Two action types in a single template: widget loading and review invitations
  • TrustBox widget loader auto-discovers all trustpilot-widget elements on the page
  • Review invitations support customer name, email, order ID, and product SKUs
  • Uses Trustpilot’s official tp() command queue for reliable invitation delivery
  • Product SKU support for product-level review collection
  • No additional configuration needed for widget rendering beyond placing TrustBox HTML

Installation

Add the template to your GTM container from the Community Template Gallery, then create one or more tags depending on whether you need widgets, invitations, or both.

Field Reference

Field Required Action Type Description
Action Type Yes Both Select Load TrustBox widgets or Send review invitation
Integration Key Yes Invitation Your Trustpilot business-generated integration key for the invitation API
Customer Email Yes Invitation The email address of the customer to invite (e.g. from Data Layer variable)
Customer Name Yes Invitation The customer’s full name
Order ID Yes Invitation The unique order or transaction identifier
Product SKUs No Invitation Comma-separated list of product SKUs included in the order (enables product reviews)

Configuration Guide

Loading TrustBox widgets

The widget action injects the bootstrap script from https://widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js. This script scans the page for elements with the trustpilot-widget class and renders the appropriate TrustBox inside each one.

Steps:

  1. Create a new tag using the Trustpilot template.
  2. Set Action Type to Load TrustBox widgets.
  3. No additional fields need to be configured.
  4. Add TrustBox HTML snippets to your website where you want widgets to appear. Get these from your Trustpilot business dashboard under Integrations > TrustBox library.

A typical TrustBox HTML element looks like this:

<div class="trustpilot-widget" data-locale="en-US" data-template-id="5419b6a8b0d04a076446a9ad" data-businessunit-id="YOUR_BUSINESS_UNIT_ID" data-style-height="24px" data-style-width="100%">
  <a href="https://www.trustpilot.com/review/example.com" target="_blank">Trustpilot</a>
</div>

Sending review invitations

The invitation action loads the invitation script from https://invitejs.trustpilot.com/tp.min.js and uses the tp() command queue to register your key and submit customer data.

Under the hood, the template executes:

tp('register', yourIntegrationKey);
tp('createInvitation', {
  recipientEmail: email,
  recipientName: name,
  referenceId: orderId,
  source: 'InvitationScript',
  productSkus: skuArray
});

Steps:

  1. Create a new tag using the Trustpilot template.
  2. Set Action Type to Send review invitation.
  3. Enter your Integration Key from Trustpilot (found under Integrations > Invitation script setup).
  4. Map Customer Email, Customer Name, and Order ID to Data Layer variables or other GTM variables that capture this data on your order confirmation page.
  5. Optionally enter Product SKUs as a comma-separated string (e.g. SKU-001,SKU-002,SKU-003).

Triggers and Setup

For TrustBox widgets: Use a Page View trigger on all pages where TrustBox HTML elements exist. If TrustBoxes appear on every page (e.g., a footer widget), use the All Pages trigger. For widgets only on specific pages, create a Page View trigger with a URL path condition.

For review invitations: Use an Event trigger that fires on the order confirmation or purchase event. Common configurations:

  • Custom Event trigger matching your Data Layer purchase event (e.g. purchase or order_complete)
  • Page View trigger restricted to the order confirmation URL path

Example Data Layer for invitations:

dataLayer.push({
  event: 'purchase',
  customerEmail: '[email protected]',
  customerName: 'John Doe',
  orderId: 'ORD-12345',
  productSkus: 'SKU-001,SKU-002'
});

Create corresponding Data Layer Variables in GTM for each field and reference them in the tag configuration.

Consent considerations: TrustBox widgets load external scripts and may set cookies. The invitation action transmits personal data (email, name). Configure both tag types to respect your consent management setup.

Troubleshooting

TrustBox widgets do not render:

  • Verify TrustBox HTML elements exist in the DOM with the class trustpilot-widget.
  • Check that the data-businessunit-id attribute matches your Trustpilot business unit.
  • Use GTM Preview mode to confirm the tag fires before checking Trustpilot-specific issues.
  • Look for JavaScript errors in the browser console related to the bootstrap script.

Invitation tag fires but no invitation email arrives:

  • Confirm the Integration Key is correct and active in your Trustpilot dashboard.
  • Verify that Customer Email contains a valid email address at the time the tag fires.
  • Check that Order ID is unique — Trustpilot deduplicates invitations by reference ID.
  • Allow up to 24 hours for invitation delivery; Trustpilot may apply sending delays.

Product reviews not collected:

  • Ensure Product SKUs are passed as a comma-separated string, not an array.
  • Verify the SKUs match products registered in your Trustpilot product catalog.

Widget loads but shows wrong content:

  • Double-check the data-template-id in your TrustBox HTML. Each widget style has a unique template ID from the TrustBox library.
  • Verify data-locale matches your site’s language.

Support

For issues specific to this GTM template (not Trustpilot platform issues), open an issue on the template’s GitHub repository.

Profielfoto Freek Kampen

By Freek Kampen

Data & Analytics consultant and co-owner of New North Digital. With a background in online advertising, I solve tracking and data issues for entrepreneurs and agencies.

Looking for growth? ▸ Set your New North ▸