Zephyr Template Variables
For personalization of emails, you can include dynamic content as replacement variables (often called vars for short).
Template HTML may contain replacement variables as syntax enclosed in{curly braces}
or {{double curly braces}}
. For example:
Your email address is: {email}!
Note that Zephyr variables are case sensitive. For more info on the use of braces, see Single vs Double Braces. To set variables on your users that you can pull using Zephyr variables, please see Setting Variables.
Standard
The following replacement variables do not need to be "set"; they are stored automatically. The HTML example below shows how you might call the var in your template.
Variable | Description | Example |
---|---|---|
beacon | Beacon image used for tracking opens/clicks; required | {beacon} |
beacon_src | If you wish to insert the beacon URL in your own custom code | <img src="{beacon_src}" alt="beacon" /> |
beacon_ssl | An HTTPS version of your beacon image | {beacon_ssl} |
beacon_src_ssl | The image path of your HTTPS beacon image | https://media.sailthru.com/0a1/2b2/3/c/45d678e9f.png |
beacon_url | The target URL when the beacon is clicked | https://www.sailthru.com/ |
email | The email address of the recipient | <p>You are subscribed to this email as:{email}</p> |
emailnum | The order the recipient was mailed in a mass campaign (1 for the first user, 2 for the second user, etc.). Click here for more information. | {if emailnum <= 5000} Special offer here {/if} |
optout_confirm_url | The URL of your hosted opt-out page; required. | <p>To unsubscribe, <a href="{optout_confirm_url}">click here</a>.</p> |
profile | A data structure containing all of the profile data of the recipient. See also profile object | {profile} |
profile.id | The profile identifier | {profile.id} |
public_url | The URL of a public version of the email appropriate for sharing -- - contains no user-specific information or links. See also public_share and social_share | <p>Want to share this email? <a href="{public_url}">Click here</a>.</p> |
signup_confirm_url | A URL that will revalidate any previously opted-out users upon click. | <p>To resubscribe, <a href="{signup_confirm_url}">click here</a>.</p> |
text_url | The URL of a page to view the plain text version of the email | <p>To view as plain text, <a href="{text_url}">click here</a>.</p> |
view_url | The URL of a page to view the email online. This will show a personalized view for a specific user that may contain user-specific information or links. | <p>To view in your browser, <a href="{view_url}">click here</a>.</p> |
Special User Variables
Some variables are not automatically set, but will have special behavior if you do set them on a user's profile.
Variable | Description | Example |
---|---|---|
name | The full name of the user. This name will be used in the To: field of the email. You will get better delivery performance if you are able to collect users' real names and set the name field. | |
source | The short name of a source that the user came from. For example, email addresses that you got from a special contest promotion could have a source of contest . The user's signup will be recorded in the Source Report. | <input type="hidden" name="vars[source]" value="contest"> The above example would be added to the existing signup on your website |
text_only | If set to true value, the user will only receive the text version of emails. This is strongly discouraged, as you will not benefit from most of the system's advanced tracking features. |
JSON Variables
Normally, variables are simple strings. However, you are allowed to set JSON-style arrays and objects and reference them using Javascript syntax. For example, you could pass an array of objects called products to a template:
And then reference the products in your template:
vars={"products":[{"name":"Widget A","qty":3},{"name":"Widget B","qty":1}]}
And then reference the products in your template:
<table><tr><td>{products[0].qty}</td><td>{products[0].name}</td></tr></table>
Reserved Words
You should avoid using any of the Standard variables listed above when creating custom variables. In addition, avoid using the following names for replacement variables:
true
false
null
if
else
case
switch
select
for
foreach
lambda