How to Use Merge Fields
How to use merge fields
Merge fields can be used to personalise a mailing by including address data in the mail, for example a name. This page describes how you can use merge fields, shortened links and system links in your mailings.
Use custom merge fields
You can use several different mergefields. In this example we'll show you how to use the "City" merge field.
-
Go to the address book app and add a new custom fields named "City"
-
Create or upload a new address book with the City field filled in.
-
Use the merge field tag in the htmlbody or textbody of the template, or in the subject of the mailing. Examples of the tags in this case.
Merge field name Tag used City {{ Recipient.City }} -
Add the mergefield as a mergetag object to the mergetags collection of the mergefields object of the template. The mergefield object consists of a Name, Value and a mapping. The Name should be the name of the mergefield, the Value should be the tag used in your template or subject, and the mapping should be the mapping to the field in the address.
{
"Name": "Recipient.City",
"Value": "{{ Recipient.City }}",
"Mapping": "Recipient.MergeFieldValue2"
}
Default merge tags
The following default mergetags can be used in your mail.
Description | Placeholder in body | Merge tag object |
---|---|---|
Sender email address | {{ Sender.EmailAddress }} | {
"Name": "Sender.EmailAddress",
"Value": "{{ Sender.EmailAddress }}",
"Mapping": "Sender.EmailAddress"
}
|
Recipient email address | {{ Recipient.EmailAddress }} | {
"Name": "Recipient.EmailAddress",
"Value": "{{ Recipient.EmailAddress }}",
"Mapping": "Recipient.EmailAddress"
}
|
Use shortened links
You need to create links as special link in the mergefields object in order to be able to see the number of clicks of your link later on. Links provided as special link will automatically be shortened. In this example we will use https://www.cm.com as the url that we want to trak in our mailing.
- Create a tag to use in the htmlbody or textbody of the template, or in the subject of the mailing. For example: [[ SpecialLink.link1 ]]
- Add the link to the speciallinks collection of the mergefields object of the template. The special link consists of a Type, Label, Link, Mapping and Tag. The Type should be link, the Label you want to give this link, the Link should be the tag used in your template or subject and the Mapping should be the real url.
{
System links
We have some default system links that you can use in your mailings.
Description | Placeholder in body | Special link object |
---|---|---|
Unsubscribe link, this will allow users to unsubscribe for your mailings. They won't get mails when you try to send to them again. |
[[ SpecialLink.Unsubscribe ]] | {
"Type": "system",
"Label": "Unsubscribe",
"Link": "[[ SpecialLink.Unsubscribe ]]",
"Mapping": "SpecialLink.Unsubscribe",
"Tag": null
}
|
View in browser, this will allow users to view your mailing in the browser. | [[ SpecialLink.ViewInBrowser ]] | {
"Type": "system",
"Label": "View in browser",
"Link": "[[ SpecialLink.ViewInBrowser ]]",
"Mapping": "SpecialLink.ViewInBrowser",
"Tag": null
}
|
Pixel, this will allow you to track if a user has opened your mail. This one should only be included in the html body and not in the text body. |
[[ SpecialLink.Pixel ]] | {
"Type": "system",
"Label": "Viewed",
"Link": "[[ SpecialLink.Pixel ]]",
"Mapping": "SpecialLink.Pixel",
"Tag": null
}
|
Complete example merge tags and special links
Address list:
Contains a field called City
Address:
Has the following values
{
"EmailAddress": "[email protected]",
"City": "Breda"
}
Mailing template textbody
Hello {{ Recipient.Name }}
According to our data your email address is {{ Recipient.EmailAddress }} and you live in {{ Recipient.City }}.
You can see our new and improved website on [[ SpecialLink.link1 ]]
Kind regards,
Team CM
If you don't want to receive our mails anymore you can unsubscribe here: [[ SpecialLink.Unsubscribe ]]
If your mail isn't looking correctly, you can view it in the browser here: [[ SpecialLink.ViewInBrowser ]]
Mailing template mergefields:
{
"MergeTags": [
{
"Name": "Recipient.Name",
"Value": "{{ Recipient.Name }}",
"Mapping": "Recipient.MergeFieldValue1"
},
{
"Name": "Recipient.City",
"Value": "{{ Recipient.City }}",
"Mapping": "Recipient.MergeFieldValue2"
},
{
"Name": "Recipient.EmailAddress",
"Value": "{{ Recipient.EmailAddress }}",
"Mapping": "Recipient.EmailAddress"
}
],
"SpecialLinks": [
{
"Type": "system",
"Label": "Unsubscribe",
"Link": "[[ SpecialLink.Unsubscribe ]]",
"Mapping": "SpecialLink.Unsubscribe",
"Tag": null
},
{
"Type": "system",
"Label": "View in browser",
"Link": "[[ SpecialLink.ViewInBrowser ]]",
"Mapping": "SpecialLink.ViewInBrowser",
"Tag": null
},
{
"Type": "link",
"Label": "CM",
"Link": "[[ SpecialLink.link1 ]]",
"Mapping": "https://www.cm.com",
"Tag": "Website"
}
]
}
Updated about 2 years ago