Zephyr Assignment Operator For Variables

Welcome to our newly overhauled Zephyr pages! See our new Overview, Examples, and Index.
Feedback is welcome at bottom of each page.

Please see Setting Variables to set variables on a user.

You can use the = operator to make assignments to local variables within a template or campaign.

 {variable = value} {variable.attribute = value}

This is especially useful if you are calculating content that you want to loop through. It’s usually more convenient to assign these to a temporary variable that you can use later:

 {personalized_headlines = horizon_select(content,10)}

When you make an assignment, it only applies to the particular message you are sending and will not cause any kind of permanent update to your data.

So if you do something like this:

 {if !name} {name = 'Friend'} {/if} Dear {name},

Your assignment will only last the duration of the message scope. You are not permanently setting the user’s name to “Friend”.

You can also use Zephyr to create arrays and objects. For instance, if you need an array of your Natural Lists (perhaps to compare against lists users are currently subscribed to):

{allLists = ["Books", "Politics", "Tech"]}

A single object, like so:

{"booksList" = {"tags":["books"],"list":"Books","var":"books"}}

Or even an array of objects:

{allLists = [{"tags":["books"],"list":"Books","var":"books"},{"tags":["tech"],"list":"Tech","var":"tech"},{"tags":["politics"],"list":"Politics","var":"politics"}

Top