Built In Merge Tags
Variables
The merge tag variables available to use in a campaign depend on the fields you have created in the brand. However, there are some merge tag variables that are always available.
| Tag | Description |
|---|---|
*|CAMPAIGN:ID|* | ID of the campaign. |
*|_ID|* | ID of the contact. |
*|UNSUB|* | URL to the contact's unsubscribe page. |
*|VIEW|* | URL to view the campaign in the browser. ("View in Browser" link) |
If
Using the if merge tag you can make the content of your campaigns conditional on the attributes of the contact. The ELSE section is optional.
*|IF:STATUS = 'paid'|*
<p>Thank you for subscribing!</p>
*|ELSE:|*
<p><a href="#">Subscribe now and receive 10% off</a></p>
*|END:IF|*
The if merge tag can also include 1 or more ELSEIF sections:
*|IF:STATUS = 'paid'|*
<p>Thank you for subscribing!</p>
*|ELSEIF:STATUS = 'cancelled'|*
<p><a href="#">We want you back! Join now and receive 10% off</a></p>
*|ELSE:|*
<p><a href="#">Subscribe now and receive 10% off</a></p>
*|END:IF|*
Operators
The following operators may be used with the if merge tag:
Operator | Description |
|---|---|
| Equal |
| Not Equal |
| Greater than |
| Less than |
| Greater than or equal |
| Less than or equal |
IfNot
You can use IFNOT to check if a contact attribute is an empty string, false, 0, or unset.
*|IFNOT:REFERRED_FRIEND|*
<p><a href="#">Please let a friend know about our site!</a></p>
*|END:IF|*
Functions
Default
Use the DEFAULT function to provide a default value for a variable when it is not defined or has an empty value.
| Example | Description |
|---|---|
*|DEFAULT:FIRST_NAME, 'Friend'|* | When contact has a first name available, output their first name. Otherwise, output the word friend. |
Date Format
Use the DATE_FORMAT function to format a date/time into the desired format.
| Example | Description |
|---|---|
*|DATE_FORMAT:'%Y'|* | Output the current four digit year ex. 2020 |
*|DATE_FORMAT:'%Y-%m-%d'|* | Output the current year, month, and day ex. 2020-11-30 |
*|DATE_FORMAT:'%m/%d/%Y'|* | Output the current month, day, and year ex. 11/30/2020 |
*|DATE_FORMAT:'%d/%m/%Y'|* | Output the current day, month, and year ex. 30/11/2020 |
*|DATE_FORMAT:'%B %d, %Y'|* | Output month name, day, and year ex. November 30, 2020 |
*|DATE_FORMAT:'%Y-%m-%d',RSSITEM:PUB_DATE|* | Output the year, month, and day of the current RSS item published date |
Format codes
| Code | Description | Example |
|---|---|---|
| %B | Long month | January |
| %b | Short month | Jan |
| %m | Month number | 01 |
| %A | Long week day | Monday |
| %a | Short week day | Mon |
| %d | Day of month | 02 |
| %H | Hour (24 hr clock) | 15 |
| %I | Hour (12 hr clock) | 03 |
| %M | Minutes | 04 |
| %S | Seconds | 05 |
| %Y | Long year | 2006 |
| %y | Short year | 06 |
| %p | AM/PM | PM |
| %Z | Timezone | MST |
| %z | Numeric Timezone | -0700 |
Format Dollars
Use the FORMAT_US_DOLLARS function to format an integer or string containing a number as US dollars. A string containing 1234.45 is converted to $1,234.45. The first parameter is an integer or string to format. The second optional parameter can be specified as false to omit cents.
| Example | Description |
|---|---|
*|FORMAT_US_DOLLARS:SALARY|* | Outputs the value of the variable SALARY as US dollars. |
*|FORMAT_US_DOLLARS:SALARY,false|* | Outputs the value of the variable SALARY as US dollars. Cents are not included. |
Safe
Use the SAFE function to indicate that a variable should be output as HTML. Safe is helpful when you have a variable containing HTML that needs to be output as is, without any escaping.
| Example | Description |
|---|---|
*|SAFE:MY_HTML|* | Outputs the value of the variable MY_HTML without HTML escaping. |
Slice Words
Use the SLICE_WORDS function to select words from m to n from a string. The first parameter is a string. The second parameter is the zero based index to start extracting words. The third parameter is optional and is the zero based index to end extracting words (up to but not including this word).
| Example | Description |
|---|---|
*|SLICE_WORDS:RSS:TITLE,2,4|* | Output the 2nd and 3rd word from RSS:TITLE. |
*|SLICE_WORDS:RSS:TITLE,2|* | Output all words in RSS:TITLE from the 2nd until the end. |
Url
Use the URL function to url encode a variable.
| Example | Description |
|---|---|
*|URL:FIRST_NAME|* | Outputs the value of FIRST_NAME url encoded. |
Updated 7 days ago
