Yahoo eCommerce + Trustpilot's JavaScript Integration
Yahoo eCommerce + Trustpilot's JavaScript integration automatically sends email invitations to your customers after they make a purchase or have a service experience. You can read more about Trustpilot's JavaScript integration here.
If you want to use JavaScript with Yahoo eCommerce, you’ll need to use a structured data snippet.
Here’s a sample of what the code snippet should look like:
<script>
var orderProd = [];
for(u=0; u < items.length; u++){
var pUrl = "https://www.EXAMPLE-WEBSITE.com/"+ids[u]
orderProd.push({sku: codes[u], productUrl:pUrl,imageUrl:"", name:items[u] });
}
document.addEventListener('DOMContentLoaded', function() {
const trustpilot_invitation = {
recipientEmail:
document.querySelector('#gts-o-email').textContent,
recipientName:
document.querySelectorAll('.ys_name')[1].textContent,
referenceId: orderNum,
source: 'InvitationScript',
productSkus: codes,
products:orderProd,
};
tp('createInvitation', trustpilot_invitation);
});
</script>
1. Log into your store.
2. Under Order Settings, go to Checkout & Registration Manager.
3. Select Page Configuration.
4. Go to Order Confirmation and add head script and confirmation page script under Page Message.
*NOTE: if the Head Script doesn’t work here, you’ll need to place the head script under Head-tags in the Variables section that loads the script across the entire website.
5. Go back to Store manager and select Publish.
0 comments
Sort by