Escape from html
All Dynamic Content is inserted into emails by adding code in [square brackets] . Your dynamic content can be formatted with HTML, but all of the instructions for Dynamic Content must be contained within square brackets like these in order to work properly: [ ] This quick sample will give you an idea:
<p>This is going to stay here just like it’s written.
<b> [Dynamic Content Goes Here] </b>
<br/> This is going to stay here just like it’s written, too.
A basic dynamic content expression is generally set up as follows:
[IF variable operator constant]
<HTML code to display result>
[ELSEIF variable operator constant]
<HTML code to display alternative result>
[ELSE]
<HTML code to display when no result matches>
[ENDIF]
This quick documentation will outline the rules for variables, operators, constants, and expressions, which will help you get started writing your own.
Type of data supported
Dynamic content supports a number of different data types, meaning that there are a few ways in which you can create expressions for variables that decide which content gets displayed.
Supported data types are:
- boolean – TRUE or FALSE
- integer – Any whole number ranging from -8388608 to 8388608
- string – An alphanumeric string up to a maximum of 255 characters
- date – Date with the format “YYYY-MM-DD HH-MM-SS”
Hours must be written in 24-hour clock (so 18:30 instead of 6:30 PM)<h2" id="toc-anchor-">Variables</h2">
Variables are the criteria that you’re basing your content on. This can include list fields like firstname, lastname, or any other data field your subscribers have submitted content to. It can also include campaign activity, allowing you to send specific content to just those who clicked on a link or opened a previous email campaign.
List fields
List fields can be used as criteria. The value of these fields generally changes with every list subscriber. The variables are enclosed by the apostrophe character ( ` )
List fields can be any of the integer, string or date/time data types.
Previous campaign activity
We can also refer to action a subscriber has taken for a previous email campaign including opening the message, or clicking on any links in the email itself. To refer to a specific campaign, you’ll need to find the mailing ID and refer to it using MAILING(id), where id is a reference to the campaign number. To refer to a specific link, you’ll need to find the link ID and refer to it using LINK(id), where id is a reference to the link number.
Example: MAILING(43243) LINK(3245364)
An email campaign has two different statuses: CLICKED and OPENED A link can be: CLICKED
How to find an email campaign id in your branded site
- Select the Campaigns tab.
- Find the specific campaign you wish to refer to.
- View stats for this campaign.
- The Mailing ID will be included in the URL that displays in the address bar of your browser. Use only the 6 or 7-digit number that appears at the end of the URL: http://mail.youraccountname.com/ui/mailings/stats/
How to find a link id in your branded site
- Select the Campaigns tab.
- Find the specific campaign you wish to refer to.
- View stats for this campaign.
- Access the clicks report for the campaign.
- View the detailed stats for the link you wish to use as your variable. The Link ID will be included in the URL that displays in the address bar of your browser. Use only the 7 or 8-digit number that appears after the text “link=”: http://mail.youraccount.com/ui/mailings/stats/560416?page=logs&link=
Operators
The following operators are supported: For list fields that are text strings
- LIKE – Matches
- NOT LIKE – Does not match
For list fields that are integers or datetime
- =
- ! =
- <
- < =
- >
- > =
For campaign activity (links or mailings)
- IS
- IS NOT
For expressions
- AND
- OR
Constants
Contants must be enclosed in double quotes ‘ “ ‘ if they are of text strings, datetime or integer data types.
Examples:
- "NY"
- "2010-08-02 10:00:00"
- "5"
Expressions
Dynamic content supports boolean expressions (TRUE / FALSE). Expressions can be created by combining a variable, an operator and a constant.
Example:
`email` LIKE “%hotmail%”
(their email address contains the text “hotmail”)
Example:
`id` > “1000”
(list ID is greater than 1000)
Example:
MAILING(34342) IS OPENED
(subscriber opened campaign #34342)
The variable and the constant must be the same data type.
Expression can be combined together to become a larger and more complex expressions by using parentheses.
Example:
(`email` LIKE “%hotmail%”) AND (MAILING(34342) IS OPENED)
(their email address contains the text “hotmail” AND they opened campaign #34342)
Control structures
A control structure gives the starting statement for the expression, and can be nested for more complex expressions.
IF
[IF expression]
HTML code to display
Displays HTML code if expression is TRUE
ELSEIF
[ELSEIF expression]
HTML code to display
Follows an [IF]
statement. Displays HTML code indicated if the previous [IF]
expression is FALSE but the expression from [ELSEIF]
is TRUE. There can be multiple [ELSESIF]
statements.
ELSE
[ELSE]
HTML code to display
Displays HTML code if the expressions from previous [IF]
and [ELSEIF]
(if any) are FALSE.
ENDIF
[ENDIF]
Closes an [IF]
statement.
Functions
The following functions are supported: MOD
MOD(N,M)
This is a Modulo operation. Returns the remainder of N divided by M.
Example:
[IF MOD(`id`,10) = 5]
<p>You are a winner!</p>
[ELSE]
<p>Sorry! Try again!</p>
[ENDIF]