Personalization and Templating Syntax

Overview

Personalization Tags are codes that pull information stored in Contact profiles into email and SMS messages, allowing you to personalize your content to each individual Contact. Templating syntax allows you to pull dynamic order and product related data into emails and SMS messages. Read on to learn how to incorporate personalization tags and templating syntax into your marketing!

In This Guide

🚦 Before Getting Started

If you plan to use Custom Fields to personalize email or SMS content, create them in Sendlane and collect data from Contacts


Standard Personalization

Personalization Name Personalization Tag Display Example Notes
First Name {{ contact.first_name }}
John
Last Name {{ contact.last_name}} Doe
Full Name {{ contact.full_name }} John Doe
Email {{ contact.email }} johndoe@sendlane.com
Phone {{ contact.phone }} +1123467895
Custom Field {{ contact.custom('FIELD_ID') }}
or
{{ contact.custom('FIELD_NAME') }}
Custom data Replace FIELD_ID with the custom field's ID or replace FIELD_NAME with the custom field's name

Back to top


Insert Personalization in Email Subject Lines

  1. Click into the subject line where you want the personalization to appear
  2. Click the tag icon
  3. Select a personalization tag

Back to top


Insert Personalization in Email Content

  1. Click into the email wherever you want personalization to appear
  2. Click the three dot menu
  3. Click the personalization icon
  4. Click the Select Personalization dropdown
  5. Select a personalization

If Contacts have data for the selected Custom Field, they'll see their data where the personalization tag was inserted. If Contacts do not have data for the inserted Custom Field, they will see a blank space unless you create a default value for the field.

🙋 How do I change the font styling for an inserted personalization?

When you select a Custom Field or templating syntax personalization from a dropdown, the syntax is inserted into the email as a snippet with protections that help avoid breaking the syntax.

To change the styling of an inserted syntax snippet:

  1. Use your cursor to select the snippet (you may need to select the space just before and after the snippet)
  2. Paste the snippet somewhere else to remove the formatting by pressing CMDCTRL + Shift + V
  3. Copy the snippet from where it was pasted in the previous step
  4. Paste the snippet back into your email
  5. Format the text as normal

Back to top


Insert Personalization in SMS Messages

  1. Click into the SMS message where you want personalization to appear
  2. Click the personalization icon
  3. Select a personalization

🚨 Personalization in SMS must be highlighted pink

Personalization selected from the personalization icon will be highlighted in pink when you insert it into your SMS.

Highlighted pink personalization will pull data from Contact profiles and display it in the message Contacts receive. If personalization is not highlighted pink, it will not pull Contact data and will display as a broken personalization tag in the message Contacts receive.

Back to top


Create a Default Value for Personalization

If Contacts do not have data for the selected personalization tag, they will see a blank space where it was inserted if a default value is not specified.

To create a default value for a personalization tag:

  1. Click the Audience icon
  2. Click the Personalization tab
  3. Click the Custom Field's tag to copy it
  4. Paste the Custom Field where you want it to appear in your email or SMS
  5. Add | default('') before the closing curly brackets
  6. Enter the default value between the quotation marks

In the first name example used above, the final personalization tag would look like  {{ contact.first_name | default('Friend') }}

Back to top


Advanced Templating Triggers and Filters

The following advanced templating syntax requires some knowledge of Twig and a willingness to experiment. Use the following resources to learn more about Twig:

The following syntax will display all available options for either order or checkout data in emails or SMS messages using the specified Automation triggers only:

Syntax Shopify Automation Triggers BigCommerce Automation Triggers
{{ trigger.order | json_encode }}
  • Order Fulfilled
  • Order Cancelled
  • Order Refunded
  • Order Placed (Frequency)
  • Order Fulfilled
  • Order Cancelled
  • Order Refunded
  • Order Placed (Frequency)
{{ trigger.checkout | json_encode }}
  • Checkout Complete
  • Checkout Created
  • Customer Abandoned Checkout
  • Checkout Started

To see all available options:

  1. Create an Automation with at least one of the qualifying triggers noted in the table above
  2. Add an email node to the Automation
  3. Add a text block to the email
  4. Paste the order or checkout syntax in the text box
  5. Click Preview
  6. Review available options (copy to a text file for easy reference)
  7. Remove the syntax from the text block

Shopify or BigCommerce Data Syntax

The following syntax can be used in emails or SMS messages using the specified Automation triggers only:

Syntax Notes Shopify Automation Triggers
BigCommerce Automation Triggers
{{ trigger.order.value }} Replace   value with any available items shown by the json_encode function
  • Order Fulfilled
  • Order Cancelled
  • Order Refunded
  • Order Placed (Frequency)
  • Order Fulfilled
  • Order Cancelled
  • Order Refunded
  • Order Placed (Frequency)
{{ trigger.product.value }} Replace   value with any available items shown by the json_encode function
  • Product Purchase
  • Product Variant Purchase
  • Product Viewed
  • Abandoned Product Viewed
  • Product Purchased
  • Product Variant Purchased
  • Product Viewed
  • Abandoned Product Viewed
{{ trigger.productvariant.value }} Replace   value with any available items shown by the json_encode function
  • Product Purchase
  • Product Variant Purchase
  • Product Viewed
  • Abandoned Product Viewed
  • Product Purchased
  • Product Variant Purchased
  • Product Viewed
  • Abandoned Product Viewed
  1. {{ trigger.productname }}
  2. {{ trigger.productprice }}
  3. {{ trigger.productimageurl }}
  4. {{ trigger.producturl }}
Shows a product's:
  1. Name
  2. Price
  3. Image URL
  4. URL
  • Product Purchase
  • Product Variant Purchase
  • Product Viewed
  • Abandoned Product Viewed
  • Order Fulfilled
  • Order Cancelled
  • Order Refunded
  • Order Placed (Frequency)
  • Product Purchased
  • Product Variant Purchased
  • Product Viewed
  • Abandoned Product Viewed
  • Order Fulfilled
  • Order Cancelled
  • Order Refunded
  • Order Placed (Frequency)

Filters

Personalization tags can be modified by the filters below. In templating syntax filters are separated from personalization tags by a pipe symbol ( |). Multiple filters can be used on the same personalization tag. When multiple filters are present, they cascade from left to right.

Function Tag Display Example Notes Email SMS
Capitalize {{'text'|capitalize}}
{{contact.first_name|capitalize}}
Text
Jimmy
Will capitalize the first letter in a string
Date {{"now"|date("m/d/y")}} 01/01/2023 Inserts the date the message was sent in the specified format. Month, day, and year can be rearranged or removed. - can be used instead of /
Date Modify {{"now"|date_modify("+1 day")|date("m/d/Y")}} 01/01/2023 The date_modify function allows you to add or subtract a specified number of days, months, or years to a date.
First first in a tag like {{trigger.getOrder().name|first}} Displays the first item in the specified list or array 🚫
Last
last in a tag like {{trigger.getOrder().name|first}} Displays the last item in the specified list or array 🚫
Lower lower in a tag like {{contact.first_name|lower}} jimmy Returns a string in all lowercase
Upper upper in a tag like {{contact.first_name|upper}} JIMMY Returns a string in all uppercase
Title Case title in a tag like {{'here is some text'|title}} Here Is Some Text Returns a string in title case
Number Format {{ |number_format(0, '.', ',') }}
Set the number of decimal places (0), decimal point(s) '.', and thousands separators ',' in any number 🚫
Random {{ random(['value1','value2','value3']) }} value2 Returns a random value from the list
Raw raw in a tag like {{product.name|raw}} Returns the raw information for the specified value rather than adjusting special characters 🚫

Back to top


VAR Personalization Tags

VAR personalization tags are still functional but no longer being updated. We recommend you use personalization tags whenever possible.

Tag Name Tag Code Display Example
Site name VAR_SITE_NAME Sendlane
Site URL VAR_SITE_URL https://www.sendlane.com
Unsubscribe VAR_SITE_UNSUBSCRIBE To update or remove your contact information please   Manage Your Subscription
Contact first name VAR_FIRST_NAME John
Contact last name VAR_LAST_NAME Doe
Contact full name VAR_FULL_NAME John Doe
Contact email VAR_EMAIL john@sendlane.com
Contact phone number VAR_SUBSCRIBER_PHONE 888-927-2664
Contact mailing address  VAR_MAILING_ADDRESS Sendlane, 10620 Treena Street Suite 250, San Diego, CA, US 92131
Contact country  VAR_COUNTRY United States
Contact state VAR_STATE California
Contact city VAR_CITY San Diego
Contact opt-in date VAR_SUBSCRIBE_DATE 2020-05-01
Contact IP address VAR_SIGNUP_IP 172.16.174.1
Formatted date VAR_FORMATTED_DATE May 1, 2020
Date VAR_DATE 2020-05-01
Time VAR_TIME 16:32:41
Year VAR_YEAR 2020
Month VAR_MONTH May
Day VAR_DAY Tuesday
Time sent VAR_TIME_SENT 18:39:29
Date & time VAR_DATE_TIME 2020-05-01 16:32:41
Day, date & time VAR_DAY_DATE_TIME Fri, May 1, 2020 4:32 PM
Day, date & time VAR_DAY_DATE_TIME Fri, May 1, 2020 4:32 PM
Campaign ID VAR_CAMPAIGN_ID 1
Automation ID VAR_AUTOMATION_ID 2

Back to top


Troubleshooting

My Contact's Personalization Tag isn't populating with their data!

You may not see populated personalization tags for two common reasons:

  1. The Contact's Profile doesn't have data in the specified field. Contact Profiles without data in Personalization Tag fields will see a blank space where that Personalization Tag is inserted in any email they receive unless you set a default value.
  2. There is a typo in the personalization tag. Copy and paste personalization tags from the personalization tab of the audience page or this help doc to avoid typos.
How can I see available syntax options in an SMS message?

The json_encode function can only be viewed with an email. If you are creating an SMS only Automation, add an email node to view available options, then delete the email node when you are finished building your Automation.


Additional Resources

Did this answer your question? Thanks for your feedback! There was a problem submitting your feedback. Please try again!