Google Tag Manager + Trustpilot's JavaScript Integration

To use JavaScript Integration with Google Tag Manager, then Google Tag Manager should be implemented on your website.

If it is not implemented, but you wish to use it, please follow the instruction on
https://developers.google.com/tag-manager/quickstart

Step-by-step instructions

1. Head over to Google Tag Manager and log in to your account. Once you’re in, select New Tag.

2. Choose Tag Configuration

3. Select Custom HTML and paste code snippet.

Get your script to copy and paste from here.

4. Select Triggering and add new one (+).

5. Select DOM Ready.

6. Save everything.

7. Now let’s create another tag. Repeat 1st & 2nd steps, then select Custom HTML

8. Paste the snippet and map necessary fields (VARIABLE_$*)

Here's a script that you can adapt to your own needs (if you want to know more about the parameters to send invitations in different templates, or collect product reviews, check out this guide):

<script>
function sendTPInvitation() {
var trustpilot_invitation_data = {
recipientEmail: 'VARIABLE_$EMAIL',
recipientName: 'VARIABLE_$NAME',
referenceId: 'VARIABLE_$ORDERID',
source: ‘InvitationScript’,
};
tp(’createInvitation’, trustpilot_invitation_data);
}
if (tp) {
sendTPInvitation();
} else {
document.addEventListener(’DOMContentLoaded’, function () {
sendTPInvitation();
});
}
</script>

9. Add the trigger. Script code should be trigger when confirmation page is loaded. As an example could be:

10. Save & Publish everything.

If you don't see invitations in the queue after completing the setup, reach out to support@trustpilot.com.

Was this post helpful?

0 comments

Sort by
Please sign in to leave a comment.