Personalization String tags verified

Quick reference about how to use personalization String tags in Salesforce Marketing Cloud (SFMC).

Table of contents

Field

Renders subscriber attribute values, system attribute values, and sendable data extension field values.

<ctrl:field name="AttributeName" />

<ctrl:field name="SendableDataExtensionField" />

<ctrl:field name="AttributeName" default="Default Value" />

Variable

Renders variables created in AMPscript or server-side JavaScript script blocks.

<ctrl:var name="JSvar" />

<ctrl:var name="@AMPvar" />

<ctrl:var name="JSvar" default="Default Value" format="g" />
<script runat="server">

    var name = "Mr Blue";

    var status = "OK";

</script>  

%%[

    SET @Today = NOW()

]%%

Hello <ctrl:var name="name" />

Today is: <ctrl:var name="@Today" />

<script>

    const status = '<ctrl:var name="status" />';

    console.log(status);

</script> 

Expression

Renders JavaScript expressions as content substitutions.

<ctrl:eval>myvar.toUpperCase()</ctrl:eval>

<ctrl:eval language="javascript" default="none" format="G">myDateVar</ctrl:eval>
<script runat="server">

    Platform.Load("Core","1");

    var basket = [
        "Soupe du jour",
        "Camembert",
        "Baguette"
    ];

    var greet = "Hello World";

    var today = DateTime.SystemDateToLocalDate(Now());

</script>   

<ctrl:eval>greet.toUpperCase()</ctrl:eval>

<ctrl:eval format="D">today</ctrl:eval>

<script>

    const basket = <ctrl:eval>Stringify(basket)</ctrl:eval>;

    console.log(basket);

</script>

Last Updated: