Personalization and dynamic content in templatesBack to list of guides
What is personalization and dynamic content?
Freshmail allows you to dynamically personalise the content of your message and its subject line. Thanks to this functionality, your subscribers can receive emails with content which is automatically tailored to set criteria. We’re not just talking about the usual kind of personalisation, but something far more advanced.
How do tags work?
With special tags, you can create a campaign that is carefully aimed at the needs of your clients. Depending on the type of information about your clients that you have access to, you can use tags that will generate different content (text or graphics), after being added to a template.
All tags can be embedded in the text content, HTML content and subject line. For example:
- $$if:name_of_the_field$$ $$endif$$
You can read more about tags in this article.
How to use custom fields
Custom fields are special characters that are located between two sets of double dollar signs ($$). Every recipient is assigned at least two additional custom fields:
- $$email$$ - here, the email address of your subscriber will be inserted
- $$name$$ - a custom field assigned to the recipient, it can include any given value
In addition to these, you can create an unlimited number of additional custom fields to correspond to any parameter that you choose (up to 255 characters).
Every custom field must have a default value, which is displayed if a custom field is left empty.
It can be added like this:
|Personalisation tag||Field value||Result|
|Hello $$name, default=subscriber$$||John||Hello John|
|Hello $$name, default=subscriber$$||-||Hello subscriber|
|$$telephone, default=not given$$||5xx-xxx-xxx||5xx-xxx-xxx|
|$$telephone, default=not given$$||-||-|
How to use filters
You can add a filter to every custom field and change how the field is displayed.
- upper – every letter will be written in capitals
- fupper –the first letter will be in capitals
- title – the first letter of each word will be written in capitals
- lower –every letter will be written in lowercase
Filters should be inserted inside the $$ characters, right in front of the custom field’s name. The filter and the custom field should be separated by a colon, i.e: $$filter:custom field$$
Examples of how to use filters:
|Personalisation tags||Field value||Outcome|
|HELLO $$upper:name$$||John||HELLO JOHN|
|$$title:company, default=not given$$||MY company||My Company|
|$$fupper:company, default=not given$$||MY company||My company|
|$$upper:comapny, default=not given$$||MY company||MY COMPANY|
|$$lower:company, default=not given$$||MY company||my company|
|$$upper:company, default=not given$$||-||-|
Conditional and comparative expressions
Conditional expressions are special characters which allow you to display additional content in your emails on the basis of custom fields assigned to a given subscriber. The available conditional expressions are:
- if – indicator which begins a conditional expression
- endif – indicator which ends a conditional expression
Conditional expressions should be placed inbetween $$ signs, as a value after a colon you should insert a custom field whose value you want to check, so: if: custom_field$$ or $$if:custom_field=value$$.
Every $$if:custom field$$ expression has to have one $$endif$$ expression.
Methods for comparing values:
There are three methods, which you can use to compare values:
- no sign indicates that you are checking whether a given field has any value
- = indicates that you are checking whether a custom filed equals a certain value
- != indicates that you are checking whether a field doesn’t equal a given value
Embedding comparative expressions
Every expression can be embedded any way you like. Any depth of embedding is permitted and any use of other additional fields inside conditional expressions (conditions). When embedding expressions, you should maintain the accuracy of all the personalization tags and close all open conditional tags.
Examples of use:
Below are examples of how to use personalization tags and conditional expressions.
Today is Thursday, May 20, 2014. You recently bought “Romeo and Juliet”, so please leave a review of your purchase! Since you are our regular customer, as a reward we would like to give you a 15% discount on your next purchase!
We have a promotional voucher for you, you can use until 05/27/2014 to get a 10% discount!
We have a promotional voucher for you, you can use it until 05/27/2014 to get a 10% discount!