How can we help?

Everything about Merge Tags

Merge Tags

Merge tags are extremely useful snippets of code that you can insert into your email body and subject lines to insert personalization.

For example. you have a custom field called "First Name"  and you would like to insert each customer's first name into the emails as they go out.

Merge tags make this very easy, and can even be expanded out to perform more than just basic personalization. You can also use rules to adjust what is shown on each email depending on the data associated with the subscriber.

For example, if you have a GENDER custom field, you could send Hello MR for all males, and Hello MRS for all females.

You can also insert non-subscriber-specific information, like unsubscribe links, the date, and much more.

You can see a list of available merge tags whenever you are editing content. For example, when editing text in the drag-and-drop editor, there is an INSERT drop-down list that contains all of the available merge tags. When editing a WYSIWYG template there is a big "Merge Tags" button towards the bottom of the page.

 


System Merge Tags

Several Merge Tags are built into the system and can be used by everyone. They are as follows:

The Merge TagWhat it Does
{{{__UPDATE_URL}}}The URL for Subscribers to View and Update their details. Use this in things like link HREF tags. For example <a href="{{{_UPDATE_URL}}}">
{{{__UPDATE_LINK}}}Inserts text that says "Update your Profile" and links to a page where subscribers can update their profiles.
{{{__UNSUBSCRIBE_URL}}}
The URL for Subscribers to Unsubscribe. Use this in things like link HREF tags. For example <a href="{{{__UNSUBSCRIBE_URL}}}">
{{{__UNSUBSCRIBE_LINK}}}Inserts text that says "Unsubscribe" and links to a page where subscribers unsubscribe from future mailings.
{{{__PREVIEW_URL}}}The URL for Subscribers to View the Email in a browser. Use this in things like link HREF tags. For example <a href="{{{__PREVIEW_URL}}}">
{{{__PREVIEW_LINK}}}Inserts text that says "Preview in a Browser" and links to a page where subscribers can view the email in a web browser.
{{{__OPEN_LINK}}}Insert's a hidden image that is used to track campaign opens.
{{{__JUNK_URL}}}The URL for Subscribers to Report an email as junk. Use this in things like link HREF tags. For example <a href="{{{__JUNK_URL}}}">
{{{__JUNK_LINK}}}Inserts text that says "Report as Junk" and links to a page where subscribers can report the email as junk.
{{{__GDPRYES}}}The URL for a GDPR Confirmation. Use this in things like link HREF tags. For example <a href="{{{__GDPRYES}}}">
{{{__GDPRNO}}}The URL for a GDPR Opt Out.  Use this in things like link HREF tags. For example <a href="{{{__GDPRNO}}}">
{{SUBSCRIBER_ID}}The Id of the Subscriber
{{SUB_LAST_UPDATED}}The date the subscriber record was last modified
{{SUB_EMAILADDRESS}}The email address of the subscriber
{{SUB_DATE_JOINED}}The date the subscriber joined
{{SENDING_ID}}The Id of the Email
{{CURRENT_YEAR}}The current year
{{CURRENT_DATE}}The current date
{{CAMPAIGN_ID}}The Id of the Campaign


Custom Field Merge Tags

Any field you create using the platform can also be used as a merge tag. 

When you add a custom field, you will be given the Merge Tag value. Simply insert this into your campaign as follows.

Assuming your custom field is name "Firstname", the merge tag would be: {{FIRSTNAME}}

Conditional Merge Tags

As well as inserting straightforward merge tags, there is also the option to dynamically alter the data that is shown. We call this "Conditional Merge Tags" and they work a bit like a very basic programming language.

Let us say we want to show a "Hello Mr" or "Hello Mrs" at the top of our email, depending on whether the subscriber has a custom field called Gender.

We would write this:

{{#if (eq [GENDER] 'Male') }}Hello Mr{{else}}Hello Mrs{{/if}}

We can use any merge tag or custom field here instead of GENDER.

Let us take it a little further...

If we wanted to say hi to the Ladies, and then Gentleman, but we also have some subscribers that do not have a gender marked against them, we could do this:

{{#if (eq [GENDER] Male) }}Hello Mr{{else if (eq [GENDER] 'Female') }}Hello Mrs{{else}}Hello There{{/if}} 

The above example would show "Hello Mr" to a Males, "Hello Mrs" to any Females, and finally "Hello There" to anyone who hasn't got a gender set.

Nesting

As well as straightforward conditions, you can also nest statements. For example, if you want to show a different greeting to men and women, but also want to show a different message to men who like shoes we could do this.

{{#if (eq [GENDER] 'Male') }}

      {{#if (eq [LIKESSHOES] 'YES') }}

           Hello Shoe Lover!

      {{else}}

            Hello Mr Non-Shoe Lover

      {{/if}}

{{else if (eq [GENDER] 'Female']}}

      Hello Mrs

{{else}}

      Hello There

{{/if}} 

And Or?

The example above details what we call an IF statements, which is going to work for a lot of situations. But what about if we want to add some slightly more in-depth rules. What if we want to include everyone who is male OR everyone who is exactly 30 years of age. For this, we can use an OR statement. 

{{#if (or (eq [GENDER] 'Male') (eq [AGE] '30') ) }}Hello Mr{{/if}}

And now taking it a little further, what about if we want everyone who is female or OVER the age of 40...

{{#if (or (eq [GENDER] 'Female') (gte [AGE] 40) ) }}
            Hello Mr
{{/if}}

You can see we have used a tag called gte above, which stands for "Greater than or Equal To". So in the example above we are saying the gender must be female, OR AGE must be greater than or equal to 40.

There are multiple "Operators" you can use here, instead of gte. They are as follows:

gte: Greater than or equal to
lte: Less than or equal to
lt: Less than
gt: Greater than
eq: Equals
ne: Doesn't equal

And finally, you can also use the word AND instead of OR if you require multiple details to match. For example, in this example, we need gender to be "Male" and age to be 40

{{#if (and (eq [GENDER] 'Female') (eq [AGE] 40) ) }}
            Hello Mr
{{/if}}

 

Misc Functions

Date Formatting 

You can change the format of any date field by using the following...

{{formatDate CUSTOMFIELD "YYYY-MM-DD"}}

Available values are:

ValueUnitExample
MMonth1 2 ... 11 12
Mo 1st 2nd ... 11th 12th
MM 01 02 ... 11 12
MMM Jan Feb ... Nov Dec
MMMM January February ... November December
QQuarter1 2 3 4
Qo 1st 2nd 3rd 4th
DDay of Month1 2 ... 30 31
Do 1st 2nd ... 30th 31st
DD 01 02 ... 30 31
DDDDay of Year1 2 ... 364 365
DDDo 1st 2nd ... 364th 365th
DDDD 001 002 ... 364 365
dDay of Week0 1 ... 5 6
do 0th 1st ... 5th 6th
dd Su Mo ... Fr Sa
ddd Sun Mon ... Fri Sat
dddd Sunday Monday ... Friday Saturday
eDay of Week (Locale)0 1 ... 5 6
EDay of Week (ISO)1 2 ... 6 7
wWeek of Year1 2 ... 52 53
wo 1st 2nd ... 52nd 53rd
ww 01 02 ... 52 53
WWeek of Year (ISO)1 2 ... 52 53
Wo 1st 2nd ... 52nd 53rd
WW 01 02 ... 52 53
YYYear70 71 ... 29 30
YYYY 1970 1971 ... 2029 2030
Y 1970 1971 ... 9999 +10000 +10001
Note: This complies with the ISO 8601 standard for dates past the year 9999
yEra Year1 2 ... 2020 ...
NEraBC AD
Note: Abbr era name
NN BC AD
Note: Narrow era name
NNN Before Christ, Anno Domini
Note: Full era name
ggWeek Year70 71 ... 29 30
gggg 1970 1971 ... 2029 2030
GGWeek Year (ISO)70 71 ... 29 30
GGGG 1970 1971 ... 2029 2030
AAM/PMAM PM
a am pm
HHour0 1 ... 22 23
HH 00 01 ... 22 23
h 1 2 ... 11 12
hh 01 02 ... 11 12
k 1 2 ... 23 24
kk 01 02 ... 23 24
mMinute0 1 ... 58 59
mm 00 01 ... 58 59
sSecond0 1 ... 58 59
ss 00 01 ... 58 59
SFractional Second0 1 ... 8 9
SS 00 01 ... 98 99
SSS 000 001 ... 998 999
SSSS ... SSSSSSSSS 000[0..] 001[0..] ... 998[0..] 999[0..]

Happy Merge Tagging!