Details
A personalised message will always perform better than a generic one; which is why we've built our platform with dynamic content in mind. As you'll see from our article on Personalising Message Content, there are several ways to achieve this - including through the use of Advanced Conditional Wildcards, which is what we'll cover in this article.
Advanced Conditional Wildcards are available in both email & SMS messages and allow you to dynamically display different information, but also have conditions attached to it through logic flags such as IF/ELSE, HAS, HASNOT, CONTAINS, NOTCONTAINS and so on.
With the power of Advanced Conditional Wildcards, you can do some pretty amazing personalisation - for example, display a high-value discount code if a contact lives near one of your stores, but only if they have visited X times in the last month and have spent more than $XX - but then display a lesser-value discount code if the contact doesn't meet all of this criteria.
Regular Wildcard vs. Advanced Conditional Wildcard
The only real differences between a regular wildcard and an Advanced Conditional Wildcards are as follows...
- Both can work in SMS and email messages
- A regular wildcard doesn't have logic (other than the fallback - which is where you can 'fall back' to a different word or phrase if the wildcarded field is empty for a particular content)
- An Advanced Conditional Wildcard can only be added by typing or pasting it into your email or SMS message; whereas regular wildcards can be selected from a menu in the SMS or email editor.
- To create a 'fallback' for an Advanced Conditional Wildcard, you would use an IF/ELSE statement.
Inserting Advanced Conditional Wildcards
As touched on above, Advanced Conditional Wildcards are available in email messages, as well as SMS messages (as are regular wildcards). In terms of email messages, there are two ways to insert Advanced Conditional Wildcards into your email;
- You can type / paste them in your HTML code, if importing raw HTML email designs into our platform
- You can type / paste them into your email design (in any design component that supports text; as shown below)
Fallbacks
As touched on above, a fallback is where you can 'fall back' to a different word or phrase if the wildcarded field is empty for a particular content. While regular wildcards support these through adding some special characters to the wildcard, Advanced Conditional Wildcards don't support this method; they will require an IF/ELSE statement instead. One such example is provided below.
Advanced Conditional Wildcard Examples
If copying & pasting these code snippets, please note that you will need to remove the enter / return after each line - otherwise your rendered email may contain unwanted spacing.
Example 1: If, else
In this example, the first line of text will only appear if the contact has something / anything in a list field called "FieldA". If not, some other text will display in the email instead.
%%FieldA:HAS%%
If you can read this, you must have something in "FieldA".
%%FieldA:ELSE%%
If you can read this, you must not have anything in "FieldA", or "FieldA" doesn't exist.
%%FieldA:END%%
Example 2: If exactly
In this example, the text will only appear if the list has a field called "FieldA" and the value of that field for the contact is set to exactly "Business".
%%FieldA:EXACTLY:Business%%
If you can read this, you must have the value "Business" in "FieldA".
%%FieldA:END%%
Example 3: If contains
In this example, the text will only appear if the list has a field called "FieldA" and the value of that field for the contact contains the string "Business".
%%FieldA:CONTAINS:Business%%
If you can read this, you must have a value that contains "Business" somewhere in "FieldA".
%%FieldA:END%%
Example 4: If greater than
In this example, the text will only appear if the list has a field called "FieldA" and the value in that field is greater than 5.
%%FieldA:GREATERTHAN:5%%
If you can read this, your "FieldA" value must be greater than 5.
%%FieldA:END%%
Example 5: If exactly A or B
In this example, the text will only appear if the the exact value "Business" exists in a field called "FieldA", or in a field called "FieldB".
%%FieldA:EXACTLY:Business:OR:FieldB:EXACTLY:Business%%
If you can read this, you must have the value "Business" stored in either "FieldA" or "FieldB".
%%FieldA:end%%
Example 6: If exactly A and B
In this example, the text will only appear if the the exact value "Business" exists in a field called "FieldA" and also exists in a field called "FieldB".
%%FieldA:EXACTLY:Business:AND:FieldB:EXACTLY:Business%%
If you can read this, you must have the value "Business" stored in both "FieldA" and "FieldB".
%%FieldA:end%%
Example 7: If exactly (A or B) and C
In this example, the text will only appear if ("FieldA" OR "FieldB") contains the exact value "Business", and "FieldC" contains the value "Business" as well.
%%FieldA:EXACTLY:Business:OR:FieldB:EXACTLY:Business:AND:FieldC:EXACTLY:Business%%
If you can read this, you must have "Business" in either "FieldA" or "FieldB",
and have "Business" in "FieldC" as well.
%%FieldA:end%%
Example 8: If exactly (A or B or C), else
In this example, the first line of text will only appear if "FieldA" contains the exact value "Business". If it does not, we check the same field to see if it contains the exact value "Commercial" - if so, we display the second line of text. If it does not, we check the same field to see if it contains the exact value "Residential" - if so, we display the third line of text. If not, we display the last line of text - as it has no conditions applied.
%%FieldA:EXACTLY:Business%%
If you can read this, you must have "Business" in "FieldA".
%%FieldA:ELSEIF:EXACTLY:Commercial%%
If you can read this, you must have "Commercial" in "FieldA".
%%FieldA:ELSEIF:EXACTLY:Residential%%
If you can read this, you must have "Residential" in "FieldA".
%%FieldA:ELSE%%
If you can read this, you must not have "Business" or "Commercial" or "Residential" in "FieldA".
%%FieldA:END%%
Supported Operators
Here are the supported operators for wildcards...
- Value exists: HAS
- Value does not exist: HASNOT
- String value contains: CONTAINS
- String value doesn't contain: NOTCONTAINS
- Value is exact match: EXACTLY
- Value is not exact match: NOTEXACTLY
- Value is included in comma delimited string values: INCLUDES
- All comma delimited string values are included in comma delimited string values: INCLUDESALL
- Value is not included in comma delimited string values: NOTINCLUDES
- No comma delimited string values are included in comma delimited string values: NOTINCLUDESALL
- Value is greater than: GREATERTHAN
- Value is greater than or equal: GREATERTHANEQUAL
- Value is less than: LESSTHAN
- Value is less than or equal: LESSTHANEQUAL
- ELSE operations can be used with any conditional statement
Further Reading
Here are some other articles that may interest you...
- Conditional Content in an Email
- Personalise an Email With Wildcards (Mail Merge Fields)
- Personalise an SMS
- Using Personalised Images & Countdown Timers in an Email