Single Vs. Double Braces
Most of the time, you can use single and double braces interchangeably when creating templates. This:
<p>Dear {name},</p>
usually means the same thing as this:
<p>Dear {{name}},</p>
The difference is if you are building a campaign in static mode vs. dynamic mode. While single and double braces will act the same way in dynamic mode, in static mode, behavior is as follows:
- expressions in
{single braces}
are evaluated at campaign creation time, just once overall - expressions in
{{double braces}}
are evaluated at campaign send time, once for each individual user
For example, let’s suppose you wanted your email to contain the current date. If this is what’s in your template:
generated on {date()} sent on {{date()}}
If you generate a campaign from this template on July 27, the following will appear in your campaign’s HTML source:
generated on July 27, 2012 sent on {date()}
Then let’s say you don’t send it out until the next day. Users will see this:
generated on July 27, 2012 sent on July 28, 2012
Why Does This Matter?
If you are reading a s and want to turn it into static HTML that you can edit before it goes out, you want to use
{single braces}
around the content that you want to be able to edit as static HTML.
You should use
{{double braces}}
around dynamic content like ads or sharing links that should render differently for every user.
Another instance is if you want to pull in a custom variable, such as each individual user’s first name. If you were to use something like this in static mode:
Hello, {profile.vars.first_name}.
It would output as: “Hello, .”
To pull in a custom user variable while building a campaign in static mode, double braces would be necessary:
Hello, {{profile.vars.first_name}}.
Which would output as: Hello, (User’s First Name).