0

I'm trying to add data as a tag property in a piece of JSON so that review site Trustpilot knows more details about the order confirmation we sent out.

I made the following setup but apparently this doesn't work. Trustpilot is giving me the feedback that the comment tags <!-- need to be removed.

<!--

%%[

VAR @productJSON

SET @productJSON = ATTRIBUTEVALUE("SFMC_Transactional_Order_Journeys__c:Product_JSON_Object__c")

]%%

{{.dataobject JsonVar type=variable source=@productJSON maxrows=20}}
     {{.data}}
          {"target":"@productJSON"}
     {{/data}}
{{/dataobject}}


-->

<script type="application/json+trustpilot">
    {
        "tags": [<!-- {{#each JsonVar}} -->"{{Sku}}",<!-- {{/each}} -->]
    }
</script>

I'm surprised the comments even show up as they do not in the Email builder preview or my tests.

To fix this though I'm looking for a way to pass this dataobject data as a variable in ampscript that I can then add to the snippet. My idea was something like below but this obviously doesn't work. Any ideas on how else this could be done?

<!--

%%[

VAR @productJSON

SET @productJSON = ATTRIBUTEVALUE("SFMC_Transactional_Order_Journeys__c:Product_JSON_Object__c")


]%%

{{.dataobject JsonVar type=variable source=@productJSON maxrows=20}}
     {{.data}}
          {"target":"@productJSON"}
     {{/data}}
{{/dataobject}}


%%[

VAR @tags

SET @tags = ]%% {{#each JsonVar}} "{{Sku}}", {{/each}} 

-->



<script type="application/json+trustpilot">
    {
        "tags": [%%=v(@tags)=%%]
    }
</script>

Trustpilot docs: https://support.trustpilot.com/hc/en-us/articles/221618467-Add-a-structured-data-snippet-for-Automatic-Feedback-Service-#full-structured-data-snippet-12

joren
  • 89
  • 1
  • 9

0 Answers0