Add a structured data snippet for Automatic Feedback Service

This feature is included in the Free, Plus, Premium, Advanced, and Enterprise plans.

The basic setup of AFS 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.

You’ll also need to use a structured data snippet if you want to use AFS but don’t have a BCC field.

What is a structured data snippet?

Structured data is a standardized format for providing information about a page and classifying its contents.

By adding a structured data snippet to the code of your trigger emails, Trustpilot will be able to read the structured data and dynamically pull the relevant information and include that information in your review invitations.

Where should I add it?

The structured data snippet needs to be included in the source code of the transactional email that you’re using to trigger AFS.

It’s very important to note that the snippet must be implemented with the dynamic placeholders used by your specific platform. These placeholders vary from platform to platform, so be sure to find the right ones for your system and replace the examples with the relevant information.

To ensure the snippet works correctly, do not modify its format - All the commas, quotations marks, and colons are necessary.

What structured data snippets can I use for AFS?

You can pick and choose what information you’d like to use structured data snippets for, depending on your needs. We’ve included the code samples for the different snippets you can use below. Again, don’t forget to update placeholders and examples (seen below in bold) with your system's relevant placeholders and your preferred settings.

You may need help from a developer to implement the structured data snippet.

Customer name and reference number

As a default, AFS will automatically pull names and reference IDs from email subject lines to personalize invitations if they're not present in the structured data snippet. Customer names will be pulled from the To: field, while the reference number will be pulled from the subject line. However, you can still use a structured data snippet if needed.

Code sample:

<script type="application/json+trustpilot">
    {
        "recipientName": "dynamic placeholder",
        "recipientEmail": "dynamic placeholder",
        "referenceId": "dynamic placeholder"
    }
</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": "dynamic placeholder",
        "referenceId": "dynamic placeholder",
        "recipientEmail": "dynamic placeholder"
    }
</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 template editor.

Code sample:

<script type="application/json+trustpilot">
    {
        "recipientName": "dynamic placeholder",
        "recipientEmail": "dynamic placeholder",
        "referenceId": "dynamic placeholder",
        "templateId": "insert template ID"
    }
</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": "dynamic placeholder",
      "recipientEmail": "dynamic placeholder",
      "referenceId": "dynamic placeholder",
      "locationId": "insert your location ID"
    }
</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": "dynamic placeholder",
        "recipientEmail": "dynamic placeholder",
        "referenceId": "dynamic placeholder",
        "locale": "insert your locale"
      }
</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": "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": "dynamic placeholder",
        "recipientEmail": "dynamic placeholder",
        "referenceId": "dynamic placeholder",
        "locale": "insert your locale",
        "templateId": "insert your template ID"
    }
</script>

Tagging

Automate tagging by including the tags you want applied to a review once it has been submitted. You can 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": "dynamic placeholder",
       "recipientEmail": "dynamic placeholder",
       "referenceId": "dynamic placeholder",
       "tags": ["London","Sales"]
    }
</script>

London and Sales are sample tags. Replace them with the tags you’d like to include.

Product reviews

An effective way to collect product reviews is to include data from your products in your invitations. The easiest way to do this is to upload your product catalog, then add the SKU for each product. It's important that you upload your catalog before using the structured data snippet, to ensure SKUs load properly.

Code sample:

<script type="application/json+trustpilot">
   { 
      "recipientName": "dynamic placeholder", 
      "recipientEmail": "dynamic placeholder", 
      "referenceId": "dynamic placeholder", 
      "productSkus": ["ABC-1234","ABC-4321"]
   }
</script>

ABC-1234 and ABC-4321 are sample SKUs. Replace them with the SKUs you'd like to include.

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.

If the productCategoryGoogleId field is included, the product category will automatically be updated in the product catalog.

productURL, name and sku are mandatory fields when setting up a structured data snippet for product reviews.

Code sample:

<script type="application/json+trustpilot">
   {
        "recipientName": "dynamic placeholder",
        "recipientEmail": "dynamic placeholder",
        "referenceId": "dynamic placeholder",
        "productReviewInvitationPreferredSendTime": "2018-12-25T13:00:00",
        "productReviewInvitationTemplateId": "insert your product review template ID",
        "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",
"productCategoryGoogleId": "1253" }, { "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",
"productCategoryGoogleId": "1253" } ] } </script>

All text in bold are sample placeholders. Replace them with your own information that you’d like to include.

Invitation delivery time

This feature is included in the Premium, Advanced, and Enterprise plans.

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": "dynamic placeholder",
        "recipientEmail": "dynamic placeholder",
        "referenceId": "dynamic placeholder",
        "preferredSendTime": "2018-12-15T13:37:00"
    }
</script>

The time listed is only a sample preferred send time. Replace it with your own preferred time.

Full structured data snippet

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

<script type="application/json+trustpilot">
    {
      "recipientEmail": "dynamic placeholder",
      "recipientName": "dynamic placeholder",
      "referenceId": "dynamic placeholder",
      "templateId": "insert your template ID",
      "productReviewInvitationTemplateId": "insert your product review template ID",
      "locale": "insert your locale",
      "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",
"productCategoryGoogleId": "1253" } ] } </script>

Don’t forget! All text in bold are sample placeholders. Replace them with your own information that you’d like to include.

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 seen in the example below.

Code sample:

<!-- <script type="application/json+trustpilot">
    {
        "recipientName": "dynamic placeholder",
        "recipientEmail": "dynamic placeholder",
        "referenceId": "dynamic placeholder",
        "templateId": "insert your template ID"
    }
</script>-->

Up next Automatic Feedback Service (AFS) - FAQ

Related articles