I want to implement the Trustpilot javascript extension to my own webshop, to make it possible to get automated productreviews based on the people that visit my checkout page.
I managed in Google Tag Manager to set get a trigger, when someone is visiting my /checkout/thankyou page and send a invitation to Trustpilot. They gave me an example JS code to send the inventation to Trustpilot. I'm now only stuck on the actual code to send... I added the sample code below.
Question: They say... that I have to replace the 'VARIABLE_$EMAIL* with my own 'true variables'? But how on earth do I find my true variable names?
Thank you in advance,
Greetings, Jitske
<script>
document.addEventListener('DOMContentLoaded', function() {
const trustpilot_invitation = {
recipientEmail: 'VARIABLE_$EMAIL',
recipientName: 'VARIABLE_$NAME',
referenceId: 'VARIABLE_$ORDERID',
source: 'InvitationScript',
productSkus: 'VARIABLE_$SKU',
products: [{
sku: 'VARIABLE_$SKU',
productUrl: 'VARIABLE_$PRODUCTURL',
imageUrl: 'VARIABLE_$IMAGEURL',
name: 'VARIABLE_$PRODUCTNAME',
}],
};
tp('createInvitation', trustpilot_invitation);
});
</script>
From their support site I found this, which explains a bit more what is needed.
So you actually need to parse the email and other info from your page, and add it to this javascript snippet.