Squarespace + Trustpilot's JavaScript integration Setup

**NOTE: Only for Service reviews.

Squarespace + Trustpilot's JavaScript integration automatically sends email invitations to your customers after they have service experience or make a purchase. When a customer purchases something from your business, you send them an order confirmation via email.

If you want to use Trustpilot with Squarespace, you’ll need to use Trustpilot's JavaScript integration. This needs to be done via Code Injection in Squarespace. Code block is not possible because you’re not allowed to edit the Order Confirmation Page in Squarespace.

1. Insert the first <script> in the header section.

a. Go to Squarespace Admin (home) > Settings > Advanced > Code Injection.

b. There will be a “header” section. Paste the first script. 

You'll find the script, incl. your key, here.

2. Insert the second <script> in the Order Confirmation Page section.

**NOTE: These are the only variables you could use in Order Confirmation Page.

{orderId}: The unique ID of the confirmed order
{orderSubtotal}: The subtotal of the confirmed order
{orderSubtotalCents}: The subtotal of the confirmed order, in cents
{orderGrandTotal}: The grand total of the confirmed order
{orderGrandTotalCents}: The grand total of the confirmed order, in cents
{customerEmailAddress}:The customer's email address, as it was entered in the "Billing Info" section

Under Code Injection, scroll down to Order Confirmation Page section and paste the second script:

<script>
function sendTpInvitation () {
var trustpilot_invitation = {
recipientEmail: '{customerEmailAddress}',
recipientName: 'Customer',
referenceId: '{orderId}',
source: 'InvitationScript',
};
tp("createInvitation", trustpilot_invitation);
}
if (tp) {
sendTpInvitation ();
} else {
document.addEventListener ("DOMContentLoaded", function () {
});
}
</script>

If you’d like more information on how to use Trustpilot's JavaScript integration, check out this article.

Was this post helpful?

0 comments

Sort by
Please sign in to leave a comment.