Blueshift uses an open source templating language called Liquid to reference and create personalized content. The Liquid template language provides logical operators to control how you want to include user and recommendation content in your templates. You can use Liquid template language to personalize the content of the templates. For emails, you can also personalize the subject line and preheader of the email. 

Blueshift also provides additional custom filters that you can use in your templates.


Liquid is case-sensitive. You can use the upcase or downcase function in Liquid to make it case-insensitive.

Messages can be personalized using the following content:


Insert user specific attributes such as firstname, lastname, email, and other custom attributes that you have sent through the Identify event or by uploading customer attributes through the dashboard. You can also include Predictive scores in personalizations.

To preview data for a specific user, ensure that you select a Preview user for the template.


Reference catalog variables such as product name, image, url, and so on, in your triggered and recurring campaigns.

To include recommendations in your template, see Activate recommendations.

Event Specific

Refer to event specific variables in your messages.


Refer to transaction specific variables in your messages.

For more information about using transaction data for personalization, see Transaction data in event triggered campaigns and Transaction data in segment triggered campaigns.

Template data and recommendations

Based on the selected recommendation algorithm, you can view the suggested products personalized for a customer. You can also see predictive scores and affinities that are associated with a customer's profile. You can use such values to include or exclude recommendations from the message that your customers receive. Predictive attributes are available under user_metrics.

Depending on the type of messaging template, you can go to the Data tab or the Recommendation tab to review the JSON of all the data that is available to include in the template. For more information, refer to the documentation for the specific messaging template.


Including personalization in messages

You can include personalizations by using the arrays for the objects that you want to add to the messages.

You can either include the HTML code for the objects or use the tools in the Visual Editor and HTML editor for the templates.

Important: Ensure that the content of your Liquid expression does not include HTML tags enclosed in angular brackets, such as <a>, <p>, <ul>, and so on. If you use an HTML tag in your liquid expression, Blueshift’s template rendering engine fails to differentiate between the HTML tag and a string variable. This might result in an incorrect rendering of the template.



User_metrics (Predictive scores)






Personalizations in Email subject line

To include personalizations in the subject and preheader, code, add curly brackets to the code {{}} and click between the brackets.


Personalizations in the Visual Editor

To add user specific attributes while using the Visual Editor, use the Merge tags menu in the Text Editor.

To include any other personalizations, you must include the personalizations between curly brackets  {{}}. For example, {{user_transaction.hotel_brand}} or {{recommendations.block1.products[0].title}}.


Personalizations in the HTML Editor

To add personalizations to the HTML code for any messaging template, add curly brackets to the code {{}} and click between the brackets. Select the required attribute to add to the template.

Example 1:

  • In this example, the curly brackets are added after “Hello”.


  • When you click between the brackets, the list of available attribute categories is displayed. In this example, the “user” category is selected.


  • All the standard and extended/custom “user” attributes that are available for the user are displayed. In this example, ”user.firstname” is added to the template.


  • The preview for the selected user shows the first name for the user.


Example 2:

Personalization in the content of an in-app banner message.


Event Attributes

You can also personalize your templates by inserting event variables in the template. To preview these personalization variables in the template, paste a sample event JSON payload in the Preview Data section of the Data tab or select an event from the list.

Here are some of the personalization options:

User attributes

These are included in the same way as the other user attributes.

For example, {{user.firstname}}{{user.extended_attributes_city}}

Product Data If the event contains product_ids you can include the product in the template. The variable is included as {{}}
Event Properties

Use the {{attribute_name}} syntax to reference any event variables.

For example, {{email}}, {{sku}}, {{bsft_event_context.first_name}}, and so on.

Sample event JSON

 "_browser_platform": "Linux",
 "_browser_type": "Chrome",
 "_browser_version": "37.0.2062.117",
 "cookie": "06a99b5f-er4da-8cec-e98d-c0b707757c11",
 "customer_id": "558490",
 "email": "",
 "event": "purchase",
 "ip": "",
 "referrer": "
 "revenue": "0",
 "session_uuid": "4bdbd6874-9f36-404b-a174-8a545d7fa4e0",
 "sku": "t-shirt",
 "url": "",
 "user_agent": "Ruby",
 "order_id": "mjo654961905",
 "timestamp": "2017-02-09T14:55:41Z",
 "site": "",
 "product_ids": [
 "event_uuid": "53ed44ee-eef9-11e6-890c-0242ac110008",
 "timestamp_epoch": 1486652141,
 "account_uuid": "03b11234d7-7d3a-434a-96a0-cb790c8dd91e"

Attributes from External fetch data

You can fetch dynamic content from an external source that you specify in the Data tab. You can use Liquid variables to use the content that you fetch from an external source in your email templates. For more information, see External fetch.


Variables can be categorized as standard or extended (non-standard). To reference extended variables, simply add extended_variables syntax in your liquid expression.

Preview Email

Use the variable {{email_preview_link}} to create an online version of your email template. 

<a href="{{email_preview_link}}">Click here to preview</a>


Use the variable {{unsubscribe_link}} in your HTML templates. When the email is sent out, the variable link expands to a hyperlink that includes a hash of the user's ID. When the user clicks on it, Blueshift can track the click and unsubscribe the user.


You may want to send a confirmation email when a user unsubscribes from your mailing list. However, you could also include an option to resubscribe by inserting the variable {{resubscribe_link}} in your HTML templates.

Open Tracking Pixel

An open tracking pixel is added to the end of each email body by default. However, accounts can opt-in to position this pixel manually. If this snippet is missing from your template, then the open tracking pixel will be added to the end of the email body automatically.

If manual positioning is enabled, the pixel is inserted into the email markup by adding the following snippet. 

<img src="{{bsft_open_pixel}}"/>

Note: Contact to enable Open tracking pixels for your account.

Skipping Link Tracking

The "bsft-no-track" attribute is specifically used for this purpose You can add this attribute to the relevant links. Adding the attribute removes all blueshift tracking from the specified link.

<a href=""  bsft-no-track>email link</a>

Use logic

You can include loops in your HTML template as required.

If statement

An if statement could be used to greet a user by the user.firstname attribute. However, if the firstname is not available for a user, you can fallback to including "Friend".

For example:

Hi {% if user.firstname == blank %}Friend
{% else %}{{user.firstname | capitalize}}
{% endif %}

For loop

Here is an example of how a liquid logic for loop can be used for recommended products. You can add a limit for 5 recommendations in the Recommendation studio and use the for loop to iterate through them.

{% for product in recommendations.block1.products %}

<a style="text-decoration: none;" href=''>  (HTML code for rendering products)

{% endfor %}

Personalization in email triggers

When you configure email triggers in your campaigns, you can specify a liquid variable with appropriate attributes to dynamically populate in the From Name, From Address, and Reply To Address fields.

For example, if you want the email to have your customer success manager's email address in the From Address field, you can specify the appropriate liquid variable in the trigger. When the email is sent, Blueshift uses the value of the variable in the From Address field of the email.


Was this article helpful?
1 out of 1 found this helpful



Please sign in to leave a comment.