Skip to main content

 I would like to setup a flow so Klaviyo triggers when Trustpilot should send out a service or product invitation to our customers. I have tried to go trough Trustpilots guide but I’m not so sure on how to test it and if its setup correctly. https://help.trustpilot.com/s/article/Use-Automatic-Feedback-Service-with-Klaviyo?language=en_US

Do any of you have experiences setting the Automatic Feedback Service with Klaviyo (AFS) up? 

This should be the code to insert customers information and the product SKUs the customer bought.

<!-- <script type="application/json+trustpilot"> { 
"recipientEmail": "{{ email|default:"" }}",
"referenceId": "{% today "%Y-%m-%d" as today %} {{ today }}",
"recipientName": "{{ first_name|default:"" }}",
"productSkus": ["{{ event.extra.line_items.0.product.variant.sku|default:'' }}"] }
</script> -->

 

Hi ​@Legeakademiet,

Good question! One issue I notice with the code is that it uses <script> tags inside email templates. Our email templates don’t support script tags, because Javascript in emails can often get flagged as suspicious in inboxes. Since Trustpilot created this integration, I’d recommend reaching out to Trustpilot to ask if they have an alternate way of accomplishing this, or if they accounted for the fact that Klaviyo strips script tags from emails.

Let me know if I can answer any other questions about this.


  • Yes, this is a known behavior in Magento where system URLs get passed to Klaviyo instead of the proper SEO-friendly URLs.

  • Magento by default generates both system paths and rewritten SEO URLs, but sometimes integrations only pull the system path.

  • The support is partly correct—many Magento users do face this, especially when using email marketing tools like Klaviyo.

  • The SEO issue here is that system URLs (e.g., /catalog/category/id/6) are not optimized for search engines or user experience.

  • Manually editing the URL in the Klaviyo email template is one workaround, but it’s not scalable for large catalogs.

  • A common solution is customizing the integration so Klaviyo pulls the URL rewrite table (which stores Tow URLs).

  • You can check Magento’s URL Rewrite Management in admin to confirm the correct SEO-optimized links exist.

  • Developers often use Magento’s getProductUrl() function instead of system paths to ensure SEO links are retrieved.

  • This matters because emails with poor URLs can reduce click-through rates and negatively impact SEO performance when shared.

  • If you’re serious about SEO optimization, ensuring that all marketing channels use clean, human-readable URLs is essential.

  • Some Magento-Klaviyo users add middleware or extensions to automatically replace system URLs with SEO-friendly product links.

  • In short: yes, others have encountered this, but with the right SEO customization, you can make Klaviyo pull the proper rewritten URLs instead of editing them manually.


That is a very good question and it highlights a common issue with integrating services using email content snippets.

The best answer you received is correct - Klaviyo's email templates do not support script tags because they can often be flagged as suspicious by email inboxes, which would hurt your deliverability.

Klaviyo strips those tags out to protect your sender reputation, which is why the Trustpilot code snippet doesn't work as written inside a Klaviyo email template.

However, since you need a reliable, server-side way to trigger the review invitations with the correct customer and product data, an API-to-API approach is the most robust and scalable solution, which avoids email issues entirely.

The optimal setup would be to use a combination of Klaviyo's API, Trustpilot's API, Google Tag Manager, and a server-side solution like Stape or Google Cloud Platform.

Here is the breakdown:

First, your ecommerce platform will track a purchase and send a Placed Order Standard Event to Klaviyo.

This event contains all the necessary customer data like email, name, and the product SKUs.

Second, you would create a Klaviyo flow triggered by the Placed Order event.

Instead of sending an email, this flow would use a webhook action.

This webhook is what enables the flow to send the specific customer and order data out of Klaviyo.

Third, the webhook would be configured to send its data to a server-side environment, which is where a tool like Stape or a custom script on Google Cloud Platform comes in.

This intermediate server is essential because it acts as a secure, reliable intermediary between Klaviyo and Trustpilot.

It's often called a "data plumber."

Fourth, the server-side solution (Stape or Google Cloud Platform) receives the data from the Klaviyo webhook and is responsible for reformatting and securely forwarding that information to Trustpilot's API.

Specifically, you would use Trustpilot's API for creating invitations.

This method is superior because it uses a direct, server-to-server connection, ensuring the data is sent instantly, accurately, and without being subject to the limitations or security concerns of email clients.

It’s also completely server-side, which prevents data loss from ad-blockers or browser settings, an issue common with client-side tracking using the browser.

Finally, Google Tag Manager isn't strictly necessary for the review invitation trigger itself in this API-to-API method, but it is a best-practice component for managing and verifying data across your site.

It is extremely useful for confirming that the initial Placed Order event is being tracked correctly and can also be used to deploy the script for the Trustpilot widgets on your website, separating the tracking logic from the on-site display logic for better maintenance.

In summary, the API-to-API integration (Klaviyo webhook to Stape/Google Cloud Platform to Trustpilot API) is the professional and robust way to achieve this automation, providing better reliability, security, and scalability than attempting to inject script tags into an email, which is destined to fail due to email client restrictions.