New? Start Here
Navigation Tour
Step 1: Finish Setting Up Your Account
Step 2: Bring in your contacts
Step 3: Create Customer Lists
Step 4: Set up Email Marketing
Step 5: Set up SMS Marketing
Step 6: Send your first campaign
Your DailyStory Settings
Company Settings
Personal Settings
Personal Settings
Report Subscriptions
Changing Your Password
Personal Settings Frequently Asked Questions
Account Setup
Setting up Email Marketing
Setting up Text Message Marketing
Integrating With Your Website
Using Subscriber Topics
Install DailyStory WordPress Plugin
Install DailyStory Beacon in SquareSpace
Install DailyStory Beacon in WiX
Beacon Frequently Asked Questions
Licensing and Usage
Choosing your Plan
Understanding Plan Usage
Free Plan (Freemium) Account Verification
Free Plan (Freemium) Limitations
Upgrading Your Subscription
Purchase Managed Services
Canceling your DailyStory Service
Credit Card Declined
Advanced Settings
Customer Support
Build Popular Campaigns
Work with Contacts
Managing contacts
Contacts Guide
Editing contact records
Adding contacts manually using the Create Contact option
Importing contacts
Adding contacts using automation
Exporting contacts
Arranging order of custom contact record fields
Deleting Contacts
Merge duplicate contacts
Making Contacts Inactive
Creating Contact Lists
DailyStory Segments Guide
Viewing the Contacts in a Segment
Disabling and Enabling Segments
Deleting and Restoring Deleted Segments
Archiving and Restoring Archived Segments
FAQs: Segments
Add Contacts to a Static Segment
Building Exclude Segments
Create a Static Segment
Create a Dynamic Segment
Advanced Contact Searches
Using direct free text search
Using advanced search
Changing order of custom contact search fields
Filtering your search
Common searches used for segments
Managing custom contact fields
Accessing the custom contact fields
Creating custom contact fields
Sample custom field configuration
Enabling a custom field in search
Editing and arranging custom contact fields
Managing tags
FAQs: Contacts
Test Lead
Work with Campaigns
DailyStory Campaigns Guide
Creating a campaign
Managing a Campaign
Add Contacts to a Campaign
Editing a campaign
Pausing or Unpausing a campaign
Deleting a campaign
Removing a Campaign from Archived Status
Cloning a campaign
FAQs: Campaigns
Archiving a Campaign
Inbound Marketing Tools
Landing Pages
Landing Page Guide
Creating or Editing a Landing Page
Using the Page Designer
Adding a Form to a Landing Page
Editing a Landing Page's HTML and CSS
Landing Page Frequently Asked Questions
Popups
Creating Popups
Creating a Popup Using a Canva Image
Configuring a Popup's Basic Settings
Configuring a Popup's Display Options
Configuring a Popup's Layout Options
Popup Frequently Asked Questions
QR Codes
Tracking Links
URL Shorteners Guide
Create or Edit a URL Shortener
Test a URL Shortener
URL Shortener Advanced Options
URL Shortener Metrics and Reporting
Measure click performance and track link conversions
URL Shorteners Frequently Asked Questions
Web Forms
Web Forms Guide
Setting up or Editing a Web Form
Design a Web Form
Styling your Web Form
Publishing your Web Form
Web Forms Frequently Asked Questions
Cloning a web form
Google Ads Conversion Tracking
Magic Forms
Outbound Marketing Tools
Email Marketing
Email Designer Widgets
Email Designer Widgets
Text / HTML widget
Image widget
Video widget
Social Icons widget
RSS widget
Personalization widget
Countdown Timer widget
Driving Directions widget
Weather Forecast widget
Header widget
Two Column Container
Footer widget
Email Marketing Guide
Create an Email from a Template
Using the Email Designer
Create or Edit an Email
Preview an Email
Send a Test Email
Manage Senders
Sending and Scheduling Emails
Mocking a forwarded or replied to email
Scheduling an Email
Send an Email to a Single Contact
Built-in Email Guardrails
Create an Email Template
Edit an Email Template
Manage Email Revisions
Email Designer Advanced Topics
Email Merge Tags
Edit Email HTML, CSS and AMP
Import and Export Emails
Email Technical Details
Troubleshoot Email Delivery
Bounced Email Guide
Send AMP Emails
Email Frequently Asked Questions
Email Designer Frequently Asked Questions
Cloning an email
Configuring SPF, DKIM and DMARC
Editing HTML in the Email Designer
Transactional Email Guide
Resending an Email
Managing auto-reply emails
SMS Marketing
Send a Text Message Quick Start
DailyStory SMS Marketing Guide
Creating or Editing a Text Message
Sending and Scheduling Text Messages
Sending a Test Text Message
Text Message Replies Report
Understanding Text Messaging Costs
Text Message Sending Guardrails
Text Message Deliverability Recommendations
Sending Individual Text Messages
Replies to Text Messages
Understanding Text Message Delivery Codes
Setting up Keywords for Text Message Replies
Opting out of Text Messages
Text Message Frequently Asked Questions
Copying a Text Message
Purchase Text Message Credits
SMS Links with Restricted Content
Opting into Text Messages
10DLC Registration
Cloning a text message
Randomized or Batched Sending
Text Message Conversations
Custom SMS URL Shortener
A/B Testing
Personalization
Personalization Guide
Built in Personalization Tokens
Custom Personalization Tokens
Using Conditional Logic with Personalization
Personalization Frequently Asked Questions
Push Notifications
Web Push Notifications
Using Integrations
Automation
Content Managment
CMS
CRM
Ecommerce
Flowhub Integration
Instamojo Integration
BigCommerce Integration
Konnektive Integration
Lightspeed Integration
Magento Integration
Shopify Integration
Weave Integration
WooCommerce Integration
Square Integration
Stripe Integration
Graphics
Point of Sale
Productivity
Reviews
Text Messaging
Utlity
Zapier
Zapier Integration
GoToWebinar integration using Zapier
Save SMS Replies to Google Sheets using Zapier
DailyStory app for Slack
Calendly Integration
Google Analytics Integration
Google reCAPTCHA Integration
Zoom Integration
Google Lead Form Ads
Verification
Integration Guide
Using Automation
Automation Guide
Design an Automation
Automation Triggers
Automation Actions
Automation Conditions
Automations Dashboard
Exporting and Importing Automations
Automation Frequently Asked Questions
Reporting Tools
Reports and Dashboards Guide
Dashboards
Sent Emails Report
Sent Text Messages Report
Push Notifications Report
Web Activity Report
URL Shortener Report
Popups Report
Who is Visiting Report
Paid Search Summary Report
Email OptOut Report
FAQs: Reports
Other Tools
File Manager
File Manager Guide
Manage files and folders in File Manager
File Manager Frequently Asked Questions
File Manager Picker
Tasks
ChatGPT Writing Assistant
Campaign Calendar
Retargeting Pixel
Help & Support
- All Categories
- Outbound Marketing Tools
- Personalization
- Using Conditional Logic with Personalization
Using Conditional Logic with Personalization
Updated by Rob Howard
The DailyStory Personalization engine automatically replaces the personalization token with the content associated with it.
For example, for a contact whose first name is 'Anna' the personalization token {{user.firstname}}
is replaced with Anna
.
But what happens when the firstname is is not set, e.g. blank? Such as when you write an email and start with a salutation, such as:
Hi {{user.firstname}},
If the contact's first name is not set, this becomes:
Hi ,
Instead, this should be replaced with a conditional statement: if the contact has a first name, use it. If they don't have a first name, replace it.
Setting a default replacement value
Below you will learn more about if / else statements. While powerful, these can be complex. For most uses, replacing a value, such as first name, can use the simplified replacement default:
Hi {{@ user.firstname default="friend"}},
When using the default replacement you must use the @
symbol and you must specify a default value.
Now, when the first name is blank, this is what the Personalization Engine outputs:
Hi friend,
This is the same as the following conditional logic using if / else:
Hi {{#if user.firstname}}{{user.firstname}}{{else}}friend{{/if}},
However, as you can see, using and #if
makes this simple example more complex.
If / else
The most basic conditional statement is #if
. This simply checks if a profile field exists.
This can be as simple as:
{{#if account.url_facebook}}Visit our page on Facebook{{/if}}
Or, using the {{else}}
statement, show an alternative if the field was empty:
Hi {{#if user.firstname}}{{user.firstname}}{{else}}friend{{/if}},
An #if
condition is used to check if a value exists, but what if you want to check if the value, such as Country, matches a specific country? That is solved with #ifEqual
.
If equal / else
The basic #if
condition checks if a value is empty. The if equal check evaluates whether the value of the token matches a specific value. For example, checking if a contact's country is 'Canada':
{{#ifEqual profile.country 'Canada'}}Hey there Canada!{{/ifEqual}}
An else condition is also supported for {{#ifEqual}}
:
{{#ifEqual profile.country 'Canada'}}Hey there Canada!{{else}}You aren't Canadian - neither am I!{{/ifEqual}}
The #ifEqual
condition is designed for exact matching. It's a shortcut for a more complex evaluation such as those possible with #ifCond
.
If condition / else
The basic #if
checks if a value is empty. While useful, sometimes you need more complex evaluations. For example, checking if a contact's membership is about to expire:
{{#ifCond profile.membership_expiration_date '>' '2019-06-01'}}Your membership has expired.{{/ifCond}}
The #ifCond
syntax requires that a evaluation symbol is provided in single quotes and that the value to evaluate is also provided in single quotes.
The #ifCond
evaluates:
==
- equals<
- less than>
- greater than<>
or!=
- not equal<=
- less than or equal to>=
- greater than or equal tocontains
- only supported with strings and string arrays. Allows comparison of a semi-colon separated list of strings.notcontains
- only supported with strings and string arrays. Allows comparison of a semi-colon separated list of strings.
<=
and >=
are only valid when evaluating numbers and dates. And, double ==
is used for testing equality.Example using contains
The contains operator is special and only is supported when comparing a single string value. For example:
{{#ifCond profile.membership_type 'contains' 'Gold,Silver,Bronze'}}Your membership is valid!{{/ifCond}}
This comparison evaluates if the membership_type
is either Gold, Silver or Bronze.
Performing date comparisons
In addition to providing a specific date for evaluation, you can also use:
- today - the current date
- tomorrow - day after today
- yesterday - day before today
- past-N-days/weeks/months/years - for example, past-1-years would be a year ago today.
- next-N-days/weeks/months/years - for example,
next-3-days
would be 3 days from today.
An else condition is also supported for {{#ifCond}}
:
{{#ifCond profile.membership_expiration_date '>' '2019-06-01'}}Your membership has expired.{{else}}Your membership is in good standing.{{/ifCond}}
The #ifCond
gives you the flexibility to evaluate if tokens are greater than, less than, and so on. However, #ifCond
is limited to a true / false outcome. Use #switch
to support multiple evaluations.
Multiple conditions
In the examples referenced above, all of the conditions evaluates to either true or false. This limits your personalization options because it requires to you match a condition. But what about when you can match for multiple conditions?
While slightly more complex, the #switch
statement supports multiple matching options:
{{#switch user.country}}
{{#case 'Canada'}}Hello Canada!{{/case}}
{{#case 'United States'}}Hello United States!{{/case}}
{{/switch}}
#switch
personalization condition is currently only available for string evaluations.The syntax for #switch
requires one or more #case
statements. Each #case
statement performs a case-insensitive string comparison to the value specified in the #switch
.
The #switch
does not support a default.