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 automatically stored in Sailthru. The HTML example below shows how you might call the var in your template.

Variable Description HTML Example
beacon Beacon image used for tracking opens/clicks; required {beacon}
beacon_src If you wish to make the beacon not a link; alternative <img src="{beacon_src}" alt="beacon" />
beacon_url The target URL when the beacon is clicked
blast.id Sailthru numeric ID for the campaign; Will not work in transactional sends {blast.id}
blast.name Free-text name for campaign as displayed in the Sailthru interface or as labeled using the API blast call {blast.name}
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}
forward_url Allows a recipient to forward the email to someone else. You must also create a template “forward”. <p>To forward, <a href="{forward_url}">click here</a>.</p>
optout_confirm_url The URL of your Sailthru-hosted optout 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
signup_confirm_url (for list optin templates only) A URL that will add the recipient to the list and display a confirmation message <p>To subscribe, <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 <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 HTML 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.———–Note: for personalization, you may want to set an additional var. [Not included in template; auto populates in email header]———–<p>Dear {first_name},</p>
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 a true value such as , the user will only receive the text version of emails. This is strongly discouraged, as you will not benefit from most of Sailthru’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:

 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

 

Top