Personalization

90df106-Blueshift_Templates.png

Blueshift offers various controls for personalizing your messages, as well as tools to make it easier to edit images and text blocks within the templates. We use open source version of Liquid templating language to reference and create personalized content. Messages can be personalized using the following content:

1) User - 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
2) Catalog - Reference catalog variables (such as product name, image, url, etc.) in your triggered and recurring campaigns
3) Event Specific - Refer event specific variables in your messages

The Liquid template language provides logical operators to control how you want to output user and recommendation content in your template.

Liquid Basics

Certain Liquid filters that are custom to the Blueshift platform are listed below.

 

Shuffle Filter

This filter shuffles the items in an array.

{% assign shuffled_products = products | shuffle %}
 
 

Time Zone Filter

This filter formats ISO 8601 compliant dates into a given timezone.
Here are some examples:

{% assign sign_up_date = "Thu Nov 29 2001 14:33:20 UTC" %}
{{ sign_up_date | time_zone: 'Hong Kong' }} => 2001-11-29 22:33:20 +0800
{% assign sign_up_date = "29/11/2001 00:00:00 -0900" %}
{{ sign_up_date | time_zone: 'Hong Kong' }} => 2001-11-29 17:00:00 +0800

Since this filter returns a date, the output can be chained with a date filter to format the value:

{% assign sign_up_date = "Thu Nov 29 2001 14:33:20 UTC" %}
{{ sign_up_date | time_zone: 'Hong Kong' | date: '%d/%m/%Y %H:%M:%S %Z' }} => 29/11/2001 22:33:20 HKT

You can also pass in an hour offset instead of a timezone:

{% assign sign_up_date = "2015-12-01 10:00" %}
{{ sign_up_date | time_zone: -7 | date: '%d-%m-%Y %H:%M' }} => 01-12-2015 03:00

Here's a list of Time Zones this filter supports.

 

Power Math Filter

This filter returns the input to the exponent power

{{ 2 | pow: 3 }} // 8
{{ 2 | pow: -3 }} // 1/8
{{ -2 | pow: 3 }} // -8
 

AES 256 Encrypt/Decrypt Filter

This filter returns a hex encoded AES 256 ciphertext of the input based on a given key, initialization vector and cipher name.

{{ 'testuser@getblueshift.com' | aes256_encrypt: '9cc25c7879fc94d5a19eeb8e47573b8423becb608a9a4e9d3c25c20aa7e04357','7bdc922b354cc8fa8d3f2910ba7cc411' }}

This outputs the following cypher text:

e8420a7c166353e5a5c5b0aa21b4360b60e5ea357e8c0f36fac272c45cb20c6b

Cipher text can also be decrypted like so:

{{ 'e8420a7c166353e5a5c5b0aa21b4360b60e5ea357e8c0f36fac272c45cb20c6b' | aes256_decrypt: '9cc25c7879fc94d5a19eeb8e47573b8423becb608a9a4e9d3c25c20aa7e04357','7bdc922b354cc8fa8d3f2910ba7cc411' }} // testuser@getblueshift.com

The default cipher used is aes-256-cbc, but aes-256-ecb is also available, by passing the cipher name as the 3rd option. Note the initialization vector is null for ecb mode.

{{ 'hamburger' | aes256_encrypt: '9cc25c7879fc94d5a19eeb8e47573b8423becb608a9a4e9d3c25c20aa7e04357', null, 'aes-256-ecb' }} //14d60bd236617adc84e23587f46addd1
 

Money Filter

This filter formats numbers as currency. By default it uses the currency configured in your Account Profile

  • Sample Usage
{{ 19.99 | money }} // $ 19.99
{{ '19.99' | money }} // $ 19.99

The money filter accepts the following options:

Option Default Value Sample Values
use symbol true true, false
use space true  true, false
currency type The currency is configurable in the Account Profile "USD"
"EUR"
"GBP"
"INR"
"SGD"
"AED"
"SEK"
"CHF
 

 

Here's a money filter that overrides the default account currency with Indian Rupees and eliminates the space between the currency symbol and number:

  • Sample Usage with currency and spacing options
 {{ 19.99 | money: true,false,'INR' }} // ₹19.99
  • Use the following variation of the money filter to output without decimals
{{ 1000000 | money_without_trailing_zeros : false }} // 1,000,000
{{ 1000000 | money_without_trailing_zeros }} // $ 1,000,000
Was this article helpful?
0 out of 0 found this helpful