Replacement Tags are used to swap in metadata you may have from any given contact that you're sending email to. Mostly they're used in the body of an email content, but they can be used in Subject Lines and Custom Headers as well.
In the body of a Custom HTML type email content, simply right-click to bring up a menu of available tags, which is comprised of: Sender Domain, Content Feed, SubId, and all fields and custom fields. If a given contact that you're sending this email to has data for the given field, that data will be swapped in, otherwise it will use any defaulted value you specify.
Here's an example of the above HTML after it has been received by a contact. This contact had a value for “FavoriteHobby”, but not for “First Name”:
You can also add conditional logic with your Substitution Tags, which can output (or not output) text based on the values you have for a given contact. You can easily add a condition by right-clicking on the canvas and selecting “Conditional Attributes” from the dropdown.
If/Else:
<p>
{{#if {FavoriteHobby}}}
Oh you like {FavoriteHobby}?
{{else}}
Soooo...you like stuff?
{{/if}}
</p>
Output:
<!-- Output for a contact that has "Hockey" set as their {FavoriteHobby} -->
Oh you like Hockey?
<!-- Output for a contact that does not have a value set for the {FavoriteHobby} field -->
Soooo...you like stuff?
Unless:
<p>
{{#unless {Name Prefix}}}
Thank you, Valued Customer!
{{else}}
Thank you, {Name Prefix} {Last Name}!
{{/unless}}
</p>
Output:
<!-- Output for a contact with no value set for {Name Prefix} -->
Thank you, Valued Customer!
<!-- Output for Jane Smith with "Mrs." set for {Name Prefix} -->
Thank you, Mrs. Smith!
Greater Than:
<p>
{{#greaterThan {Age} "21"}}
First round is on me...cheers!
{{else}}
How about a milkshake?
{{/greaterThan}}
</p>
Output:
<!-- Output for a contact with {Age} set to 29 -->
First round is on me...cheers!
<!-- Output for a contact with {Age} set to 17 -->
How about a milkshake?
Less Than:
<p>
{{#lessThan {Age} "65" }}
That'll be full price for the breakfast.
{{else}}
Your breakfast is half off with your AARP discount!
{{/lessThan}}
</p>
Output:
<!-- Output for a contact with {Age} set to 25 -->
That'll be full price for the breakfast.
<!-- Output for a contact with {Age} set to 70 -->
Your breakfast is half off with you AARP discount!
Equals:
<p>
{{#equals {City} "Los Angeles"}}
How's that screenplay coming along?
{{/equals}}
</p>
Output:
<!-- Output for a contact with "Los Angeles" set for {City} -->
How's that screenplay coming along?
<!-- No output if the contact has no value or any other city set for {City} -->
Not Equals:
{{#notEquals {Language} "Spanish"}}
Have a great day!
{{else}}
Que tengas un gran día!
{{/notEquals}}
</p>
Output:
<!-- Output for a contact that has "English" set for {Language} -->
Have a great day!
<!-- Output for a contact that has "Spanish" set for {Language} -->
Que tengas un gran día!
And:
<p>
{{#and {Job Title} {FavoriteHobby}}}
Work/life balance?! Nice!
{{/and}}
</p>
Output:
<!-- Output for a contact that has values set for both {Job Title} AND {FavoriteHobby} -->
Work/life balance?! Nice!
<!-- No output for a contact with only a set {Job Title} and no {FavoriteHobby} -->
<!-- No output for a contact with only a set {FavoriteHobby} and no {Job Title} -->
Or:
<p>
{{#or {secondLanguage} {thirdLanguage}}}
Wow, you're so cultured!
{{else}}
How's your Duolingo streak?
{{/or}}
</p>
Output:
<!-- Output for a contact that has either {secondLanguage} OR {thirdLanguage} OR both set -->
Wow, you're so cultured!
<!-- Output for a contact that has neither {secondLanguage} NOR {thirdLanguage} set -->
How's your Duolingo streak!
Each (Transactional Email only):
"htmlBody": "<ol>{{#each user.orderHistory}} <li>You ordered: {{this.item}} on: {{this.date}}</li> {{/each}}</ol>",
"transactionRelayId": 2,
"substitutions": {
"user": {
"orderHistory": [
{
"date": "2/1/2018",
"item": "shoes"
},
{
"date": "1/4/2017",
"item": "hat"
}
]
}
}
Output:
You ordered: shoes on: 2/1/2018
You ordered: hat on: 1/4/2017
Deep Object Replacement (Transactional Email only):
"htmlBody": "<p>Hello {{user.profile.firstName}} {Last Name}</p><div class='entry'>{{#unless user.active}}<p>Warning! Your account is suspended, please call: {{supportPhone}}</p>{{/unless}}</div>",
"transactionRelayId": 2,
"substitutions": {
"user": {
"profile": {
"firstName": "Ben"
},
"active": false
},
"supportPhone": "1-800-555-5555"
}
Output:
<!--User has a Last Name set as "Parker" in the contact list -->
Hello Ben Parker
Warning! Your account is suspended, please call: 1-800-555-5555
If, with objects set as operands (Transactional Email only):
"htmlBody": "<div class='entry'>{{#if user.profile.male}}<p>Dear Sir</p>{{else if user.profile.female}}<p>Dear Madame</p>{{else}}<p>Dear Customer</p>{{/if}}</div>",
"transactionRelayId": 2,
"substitutions": {
"user":{
"profile":{
"male": false,
"female": false
}
}
Output:
Dear Customer
Unless, with objects set as operands (Transactional Email only):
"htmlBody": "<div class='entry'>{{#unless user.active}}<p>Warning! Your account is suspended, please call: {{supportPhone}}</p>{{/unless}}</div>",
"transactionRelayId": 2,
"substitutions": {
"user": {
"active": false
},
"supportPhone": "1-800-555-5555"
}
Output:
Warning! Your account is suspended, please call: 1-800-555-5555
If you're creating an Email Content using the Drag and Drop template, you can Replacement Tags to an HTML element, you just have to know the name of the field/tag and format it correctly so that it's wrapped in curly braces {SampleColumn ## DefaultValue}
Replacement Tag |
Description/Example |
---|---|
Global Attributes |
|
{Spintax} | Allows you to set multiple options to randomize between when sending. |
|
|
{SendIntegrationId} | With this tag you can swap in the ID of the Send Integration you're using to send email. |
{ScheduledEmailName} | The name of a Scheduled Email can be inserted within the body of the email content or a Subject Line using this tag. |
{UniqueRandomNumber} | This tag will generate a different, 6-to-9 digit number for each time it's placed in the template. |
{StaticRandomNumber} | This tag will generate a random 6-to-9 digit number, then reuse the same one for each additional time it's placed in the template. |
{UniqueRandomString} | This tag will generate a different, 6-to-9 character string (alphanumeric) for each time it's placed in the template. |
{StaticRandomString} | This tag will generate a random 6-to-9 character string (alphanumeric), then reuse the same one for each additional time it's placed in the template. |
Brand Attributes *Primarily used for your footer* |
|
{BrandName} | Inserts the Name of the Brand the email is being sent from. |
{BrandAddress1} | Inserts Address Line 1 of the Brand the email is being sent from. |
{BrandAddress2} | Inserts Address Line 2 of the Brand the email is being sent from. |
{BrandCity} | Inserts the City of the Brand the email is being sent from. |
{BrandStateOrProvince} | Inserts the State or Province of the Brand the email is being sent from. |
{BrandCountry} | Inserts the Country of the Brand the email is being sent from. |
{BrandPostalCode} | Inserts the Postal Code of the Brand the email is being sent from. |
Best practice with the following unsubscribe tags is to only use one of them in a given footer: | |
{EEUnsubscribeLink} | Inserts the standard Unsubscribe link that is handled by EmailElement. Recipients who click this link will unsubscribe from the Brand that sent the email. |
{EEUnsubscribeUrl} | Use this tag to handle the Unsubscribe links outside of EmailElement. |
For a full list of available fields/tags, you can go to API Documentation in EmailElement, where you can also add more fields as needed:
{Email}
{MD5}
{MD5U}
{First Name}
{Last Name}
{Middle Name}
{Full Name}
{Name Prefix}
{Name Suffix}
{Date Of Birth}
{Age}
{Gender}
{Ethnicity}
{Formatted Address}
{Address1}
{Address2}
{City}
{Postal Code}
{Zip4}
{County}
{State}
{Country}
{Address Type}
{Phone Number}
{Mobile Number}
{Work Number}
{Phone Number 2}
{Fax Number}
{Job Title}
{Company Name}
{Language}
{Time Zone}
{CustomerId}
{UserId}
{Status}
{Signup URL}
{Signup Date}
{Signup IP}
{Signup Type}
{Category}
When selecting a Subject Line for your Email Content, you can also right-click to add a Replacement Tag with an optional defaulted value:
Same goes for adding Replacement Tags in Custom Headers for your Send Integration, just right-click to add: