Add a Structured Data Snippet for Automatic Feedback Service (AFS)

This feature is included in the Free plan

Get started now

Automatic Feedback Service (AFS) makes it easy to automatically send a review invitation when a customer makes a purchase from your business. Using the basic setup is effective on its own, but if you want to further enhance your invitations and add more functionality, you can add a Structured Data Snippet to your email template.

In this article, we’ll show you how you can use a Structured Data Snippet to customize your AFS invitations.

Note: You may need help from a developer to implement the Structured Data Snippet.

Where to add the Structured Data Snippet?

The Structured Data Snippet needs to be included in the source code of the confirmation email that you send to customers when they place an order. You’ll have to add the relevant code into the template of your ecommerce, CRM, or invoicing system’s settings.

What information can I include with a Structured Data Snippet?

A Structured Data Snippet allows you to control and customize many different elements of your invitation settings. We will include sample codes below. It’s important to note that placeholders vary from system to system, so depending on what platform you’re working with, your Structured Data Snippet will look slightly different.

If you use the full code, it should look like this:

<script type="application/json+trustpilot">
    {
      "recipientEmail": "customer@example.com",
      "recipientName": "Name MacNameson",
      "referenceId": "1234abcd",
      "templateId": "xyz123abc",
      "productReviewInvitationTemplateId": "5c17c7ebb565bb0001046fbd",
      "locale": "en-GB",
      "senderEmail": "your@senderemail.com",
      "senderName": "Sender Name",
      "replyTo": "your@replytomail.com",
      "preferredSendTime": "2018-12-15T13:30:00",
      "productReviewInvitationPreferredSendTime": "2018-12-25T13:00:00",
      "tags": ["Tag1","Tag2"],
      "products": [
        {
          "productUrl": "http://www.mycompanystore.com/products/12345.htm",
          "imageUrl": "http://www.mycompanystore.com/products/images/12345.jpg",
          "name": "Metal Toy Car",
          "sku": "ABC-1234",
          "gtin": "01234567890",
          "mpn": "7TX1641",
          "brand": "Acme"
        }
      ]
    }
</script>
Important: The names and reference numbers in the code samples are examples. Don't copy them into your code. Find out what placeholders your system uses and replace the examples with the relevant information.

You don’t have to use the full Structured Data Snippet. You can pick and choose which elements you’d like to include.

Customer name and reference number

Adding a reference number (referenceId) allows you to easily identify each transaction, and allows you to invite the same customer to review every transaction they have with your business, not just the first one.

Code sample:

<script type="application/json+trustpilot">
    {
        "recipientName": "Name MacNameson",
        "recipientEmail": "customer@example.com",
        "referenceId": "1234abcd"
    }
</script>

Customer email

Adding the customer email to the Structured Data Snippet will always take precedence over the email in the To: field. You can send the trigger email directly to your AFS address when you aren’t able to add a BCC to an email.

Code sample:

<script type="application/json+trustpilot">
    {
        "recipientName": "Name MacNameson",
        "referenceId": "1234abcd",
        "recipientEmail": "customer@example.com"
    }
</script>

Template

If you have different templates for specific purposes or audiences, you can specify which template to use by including the template ID. You can find the template ID in the lower right hand corner of the template editor.

Code sample:

<script type="application/json+trustpilot">
    {
        "recipientName": "Name MacNameson",
        "recipientEmail": "customer@example.com",
        "referenceId": "1234abcd",
        "templateId": "xyz123abc"
    }
</script>

Locations

If your business has several locations and you want to specify a particular one, include the location ID.

Code sample:

<script type="application/json+trustpilot">
    {
      "recipientName": "Name MacNameson",
      "recipientEmail": "customer@example.com",
      "referenceId": "1234abcd",
      "locationId": "id1"
    }
</script>

Landing page and localized language

You can specify which landing page the customer will be directed to by setting the locale.

Code sample:

<script type="application/json+trustpilot">
    {
        "recipientName": "Name MacNameson",
        "recipientEmail": "customer@example.com",
        "referenceId": "1234abcd",
        "locale": "en-GB"
      }
</script>

The available locales are:

"locale": "da-DK" / Danish-Denmark

"locale": "de-DE" / German-Germany

"locale": "en-GB" / English-United Kingdom

"locale": "es-ES" / Spanish-Spain

"locale": "fi-FI" / Finnish-Finland

"locale": "fr-FR" / French-France

"locale": "it-IT" / Italian-Italy

"locale": "nb-NO" / Norwegian Bokmål-Norway

"locale": "nl-NL" / Dutch-Netherlands

"locale": "pl-PL" / Polish-Poland

"locale": "pt-PT" / Portuguese-Portugal

"locale": "ru-RU" / Russian-Russia

"locale": "sv-SE" / Swedish-Sweden

"locale": "en-AU" / English-Australia

"locale": "en-IE" / English-Ireland

"locale": "de-AT" / German-Austria

"locale": "de-CH" / German-Switzerland

"locale": "fr-BE" / French-Belgium

"locale": "nl-BE" / Dutch-Belgium

"locale": "ja-JP" / Japanese-Japan

"locale": "pt-BR" / Brazilian Portuguese-Brazil

"locale": "en-US" / English-United States

"locale": "en-CA" / English-Canada

"locale": "en-NZ" / English-New Zealand

Invitations to customers in different countries

To invite customers in different countries, set the landing page and specify a template ID. The template can be our optimized template or your own custom template. Just make sure the languages for the landing page and the template match.

Code sample:

<script type="application/json+trustpilot">
      {
        "recipientName": "Name MacNameson",
        "recipientEmail": "customer@example.com",
        "referenceId": "1234abcd",
        "locale": "en-GB",
        "templateId": "xyz123abc"
    }
</script>

Tagging

Automate tagging by including the tags you want applied to a review once it has been submitted. You may use as many tags as you like, but make sure you don’t include spaces - this will cause the invitation to fail.

Code sample:

<script type="application/json+trustpilot">
    {
       "recipientName": "Name MacNameson",
       "recipientEmail": "customer@example.com",
       "referenceId": "1234abcd",
       "tags": ["London","Sales"]
    }
</script>

Product reviews

An effective way to collect product reviews is to include data from your purchased products in your invitations. The easiest way to do this is to upload your product catalog to Trustpilot, then add the Product SKU for each purchased product.

Code sample:

<script type="application/json+trustpilot">
   { 
      "recipientName": "Name MacNameson", 
      "recipientEmail": "customer@example.com", 
      "referenceId": "1234abcd", 
      "productSkus": ["ABC-1234","ABC-4321"]
   }
</script>

Another way to do this is to add all transaction and product data to the Structured Data Snippet. This includes a URL, an image of the product, the name of the product, the SKU, and more.

Code sample:

<script type="application/json+trustpilot">
   {
        "recipientName": "Name MacNameson",
        "recipientEmail": "customer@example.com",
        "referenceId": "1234abcd",
        "productReviewInvitationPreferredSendTime": "2018-12-25T13:00:00",
        "productReviewInvitationTemplateId": "5c17c7ebb565bb0001046fbd",
        "products": [
      {
        "productUrl": "http://www.companystore.com/.../12345.htm",
        "imageUrl": "http://www.companystore.com/.../.../12345.jpg",
        "name": "Metal Toy Car",
        "sku": "ABC-1234",
        "gtin": "1234567890",
        "mpn": "7TX1641",
        "brand": "Acme"
      },
      {
        "productUrl": "http://www.companystore.com/.../4321.htm",
        "imageUrl":"http://www.companystore.com/.../.../4321.jpg",
        "name": "Metal Toy Car Garage",
        "sku": "CBA-4321",
        "gtin": "9876543210",
        "mpn": "5TX1649",
        "brand": "Acme"
      }
    ]
    }
</script> 

Note: There are some mandatory fields which you should be aware of when setting up a Structured Data Snippet for Product Reviews. These are ProductURL, Name and SKU.

Invitation delivery time

If you want to specify a date and time for invitation delivery, add a preferred Send Time. All times are in UTC.

Code sample:

<script type="application/json+trustpilot">
    {
        "recipientName": "Name MacNameson",
        "recipientEmail": "customer@example.com",
        "referenceId": "1234abcd",
        "preferredSendTime": "2018-12-15T13:37:00"
    }
</script>
Note: The preferred SendTime parameter is only valid for some of our pricing plans.

Do all systems support the Structured Data Snippet?

Most do, but some eCommerce systems may not allow inclusion of the Structured Data Snippet in the source code. If this is the case for you, a possible solution would be to encapsulate the Structured Data Snippet with HTML comments as demonstrated in the example below.

Code sample:

<!-- <script type="application/json+trustpilot">
    {
        "recipientName": "Name MacNameson",
        "recipientEmail": "customer@example.com",
        "referenceId": "1234abcd",
        "templateId": "xyz123abc"
    }
</script> -->