Insert Variable Logic Statements For Easy Template Personalization 

Variable Logic uses your data, together with  Variable Data Personalization to help you create highly personalized postcards, letters & self mailers for your prospects and customers. It uses simple IF/THEN statements to display (and print) different text and images to the segments of your audience that you define. The ability to create targeted messaging and segmentation is only limited by your imagination and your data!

Variable Logic Setup

Variable logic uses a simple point and click interface to empower marketers to target different content (text and images) to different segments of a campaign. Smart marketers are looking for easy to implement systems that enable the personalization that research has shown to be incredibly effective in direct mail campaigns.

Check out the below template that uses Variable Logic statements such as {{IF CA=MA}}Tom Brady Is The …{{ENDIF}} to create different versions of the same template to the different audiences that the team has segmented.

Once you have uploaded and mapped data to a Contact List (Excel/CSV, HubSpot, Salesforce), you’re ready to create templates that leverage your data to create unique, personalized direct mail.

How To Build Variable Logic Blocks 

It’s easy to build Variable Logic blocks and insert them into your direct mail templates. After you’ve opened the variable logic editor (see above image), you’ll see there are 3 simple steps to creating text and/or image based variable logic.

Variable Logic 123

Step 1 – Create The IF/THEN Logic

You can use any of the data fields (First Name – Variable Data 35) from a Postalytics list to drive the logic that will display your variable content. You can add multiple “If” statements per block. In this example, we are using “State” and using the EQUALS and DOES NOT EQUAL operators to generate the logic. Operator choices include:


To create the logical expression:

  • Select the data element for your IF statement from the first drop down menu.
  • Select the Operator (Equals, Does not Equal, etc.) for your IF statement from the second drop down menu.
  • Enter the data element value that your IF statement is checking for in the box.
  • Enter the content you want to display when the IF statement is true in the THEN box.
  • Click the Insert button.

Your IF/THEN statement will be inserted into your template, and you can edit the conditions and output if you’d like.  You can modify the statement easily in the template by inserting the cursor in the statement and adding/changing any text, fonts, sizes, images, links or anything else that can appear in a web page or email. You have an amazingly powerful tool at your fingertips – go ahead and give it a try!

For example, if you entered the following:


THEN Welcome to Massachusetts!

Your template will display “Welcome to Massachusetts” for all viewer’s with CA = MA.

You can also enter your variable logic directly into the text area of your template.

Step 2 – Style The Copy And/Or Add Images

You’ve got a lot of choices in how you use or display images in the Variable Logic blocks you create. You can use any image that is loaded into the Asset Manager, by selecting “Browse” after you click the Image Insert button. You can also use images from the free online library by choosing “Search”.

variable logic image insert

When you select an image, a copy of it will be inserted into the variable logic editor. 

Note: Images pulled into the variable logic editor will be shown as 100 px width x 100 px height. They will be shown (and printed) at their original dimensions when you insert them into the full direct mail editor.

Can I Use Variable Logic For Full Template Background Images? 

The answer to this common question is YES! Simply use the Postalytics Style Guide to build a background image of the proper dimension, upload it to the Asset Manager, and then use those images in a Variable Logic Block (that will fill the side of the postcard you are working on). These will work like any other image in the Variable Logic editor. You can layer more content, pURLs, QR Codes, etc on these images like any other image.

Step 3 – Insert And Test In The Direct Mail Editor

After you’ve created and styled your variable logic expression, you insert it into the direct mail editor by choosing “Update”. You can then drag the Variable Logic Block to the appropriate location on the canvas where you want the content to be printed.

Using the tools on the right side “Properties” panel, you can:

  • Toggle between each content variable you have an expression for to test the results
  • Continue styling the copy with color, alignment, and many more tools
  • Delete, Duplicate r Edit the Variable Logic

variable logic drag toggle style

There are many Variable Logic Statement Types:

You may reference the notes below when constructing your IF/THEN statements:


Use the Equals operator to conditionally output content when a variable data element equals an integer or string.


{{IF %First Name%=Jon}} Content to Display {{ENDIF}}

Does Not Equal

Use the Does Not Equal operator to conditionally output content when a variable data element does not equal an integer or string.


{{IF %First Name%!=Jon}} Content to Display {{ENDIF}}

Is Less Than

Use the Less Than operator to conditionally output content when a variable data element is less than an integer value.


{{IF %Variable Data 1%<18}} Content to Display {{ENDIF}}

Is Equal to or Less Than

Use the is Equal to or Less Than operator to conditionally output content when a variable data element is equal to or less than an integer value.


{{IF %Variable Data 1%<=18}} Content to Display {{ENDIF}}

Is Greater Than

Use the Greater Than operator to conditionally output content when a variable data element is greater than an integer value.


{{IF %Variable Data 1%>18}} Content to Display {{ENDIF}}

Is Equal to or Greater Than

Use the is Equal to or Greater Than operator to conditionally output content when a variable data element is equal to or greater than an integer value.


{{IF %Variable Data 1%>=18}} Content to Display {{ENDIF}}

Thus, you can make your templates display much more personalized messages by inserting variable logic and using variable data.  Visit our page Variable Data Personalization to learn more about adding variable data fields to your templates.