You can include the following personalized content in your messages:

  Important

Select the appropriate Preview user for the template to ensure that the relevant attributes are available for selection.

Customer attributes

You can include standard, predictive, and custom customer attributes in your templates using Liquid. 

To view available customer attributes, go to the Data tab of the template and click Show Data.

personalization_user_example.pngpersonalization_usermetrics_example.png

Standard customer attributes

The user object contains the standard attributes.

{{user.<attribute_name>}}


For example,

{{user.firstname}}

{{user.email}}

{{user.lifetime_revenue}}

Custom customer attributes

The extended_attributes object within the user object contains the custom attributes.

{{user.extended_attributes.<attribute_name>}}


For example,

{{user.extended_attributes.language}}

{{user.extended_attributes.favorite_color}}

{{user.extended_attributes.customer_tier}}

Predictive customer attributes

The user_metrics object contains the predictive attributes.

{{user_metrics.<attribute_name>}}


For example,

{{user_metrics.category_affinity[0]}}

 

Numeric attributes

In Push and Cloud App messages, you can use special tags to include calculations or dynamic values within numeric attributes of your message template. For example, instead of a static value, you could set the "badge" attribute to dynamically display a user's badge count:
"badge": "<<bsft_number>>{{bsft_event_context.badge_count}}<<bsft_number>>"

where <<bsft_number>> is a special tag to wrap the liquid expression. This tells the system to treat the enclosed content as a numeric value. Inside the tags, write your calculation or reference the desired data using Liquid syntax {{ ... }}. 

Recommendations

Once you have created your recommendation scheme, you can use it in a messaging template to recommend items from your catalog. 

The method for including recommendations in the template content differs based on the type of messaging template. 

  • Drag and drop an ‘AI + Items’ block if you are using Visual Studio to design an email template or In-app template.
  • Manually add the liquid expression in the template.

Add recommendations manually

Go to the Data tab of the template or to the Template Info tab if you are creating a Live Content template. Select the required Recommendation Scheme and then click Show Data

For more information about recommendation blocks, see Components of a Recommendation Scheme.

template_data_rec.png

Based on the recommendation block and the JSON data, you can form a liquid expression to include a recommended item in the template:

{{recommendations.<block_name>.products[<product_number>].<product_attribute>}}

Consider the above example of the recommendation block abandoned_cart_items

  • To include the title of the first product in that block, the expression would be:
    {{recommendations.abandoned_cart_items.products[0].title}}

  • To include the price of the product, the expression would be:
    {{recommendations.abandoned_cart_items.products[0].price}}

  • To include an image, use an <img> tag.
    <img src=”{{{{recommendations.abandoned_cart_items.products[0].image}}}}” />

You can use a for loop to display multiple recommendations.

Example: Display all recommended items.

{% for product in recommendations.new_books.products %}
  {{ product.title }}<br>
{% endfor %}

Example: Display all recommended items sorted by the title.

{% assign sorted_products = recommendations.new_books.products | sort: "title" %}
{% for product in sorted_products %}
  {{ product.title }}<br>
{% endfor %}

Example: Display only 5 recommended items.

{% for product in recommendations.new_books.products limit:5 %}
  {{ product.title }}<br>
{% endfor %}

Example: Display recommended items in a tabular format

<table>
  {% for product in recommendations.new_books.products %}
    <tr>
      <td>
        <img src="{{ product.image }}" width="100">
      </td>
      <td>
        <strong>{{ product.title }}</strong><br>
        {{ product.price }}
      </td>
    </tr>
  {% endfor %}
</table>

Access catalogs without recommendations

Use the Catalog Liquid function to include item information in your templates without using a recommendation scheme. The Catalog function provides direct access for pulling data from user input, events, related catalogs, and more for specific item ids. 

Example use cases:

  • Fetch and filter details for items in event, transaction or user data objects.
  • Fetch and filters details on specific item id(s) or article(s)

Catalog function

catalog_items Catalog function to access catalog items.
product_list Variable to access a catalog item and its attributes.
catalog_item_id

The item_id for the catalog item. 

This can be a single item, multiple items, or a dynamic variable that represents an array of items.

catalog_liquid_item.png

Syntax

Accessing a single item:

{% catalog_items product_list 'item_id1' %}
  <p><b>Title:</b> {{product_list[0].title}}</p>
  <p><b>Price:</b> {{product_list[0].price}}</p>
  <p><b>Description:</b> {{product_list[0].extended_attributes.description}}</p>

catalog_liquid_singleItem.png

Accessing multiple items:

In this example, we are accessing three items. They are assigned to the product_list variable in the form of an array. The first item ‘item_id1’, is referenced as product_list[0], the second item ‘item_id2’ as product_list[1], and so on.

{% catalog_items product_list 'item_id1' ‘item_id2’ ‘item_id3’ %}
  <p><b>Title1:</b> {{product_list[0].title}}</p>
  <p><b>Price1:</b> {{product_list[0].price}}</p>
  <p><b>Description1:</b> {{product_list[0].extended_attributes.description}}</p>

<p><b>Title2:</b> {{product_list[1].title}}</p> <p><b>Price2:</b> {{product_list[1].price}}</p> <p><b>Description2:</b> {{product_list[1].extended_attributes.description}}</p> <p><b>Title3:</b> {{product_list[2].title}}</p> <p><b>Price3:</b> {{product_list[2].price}}</p> <p><b>Description3:</b> {{product_list[2].extended_attributes.description}}</p>

You can also use a for loop to access catalog items:

{% catalog_items product_list 'item_id1' ‘item_id2’ ‘item_id3’ %}
{% for item in product_list %}
<p><b>Title: {{ item.title }}</b></p> <p>Price: ${{ item.price }}</p> <p>Description: {{ item.extended_attributes.description }}</p> {% endfor %}

catalog_liquid_multipleItems.png

Accessing multiple items in a JSON array with a dynamic variable:

Customer attribute or event attribute:
user.wishlist = [“item_id1”,”item_id2”,”item_id3”]
{% assign wish_list = user.wishlist %} {% catalog_items product_list wish_list %} {% for item in product_list %} <p><b>Title: {{ item.title }}</b></p> <p>Price: ${{ item.price }}</p> <p>Description: {{ item.extended_attributes.description }}</p> {% endfor %}

catalog_liquid_JSON.png

Accessing multiple items in a comma separated list with a dynamic variable:

If your list of items is in the form of a comma-separated variable list or a user attribute, that is, a list of comma-eliminated items, you must first convert the comma-separated items from a string into an array.

The split Liquid function is commonly used to convert comma-separated items from a string to an array.

For a comma-separated list:

{% assign wish_list = ‘item_id1,item_id2,item_id3’ | split: ',' %}

For a custom user attribute:

{% assign wish_list = user.extended_attributes.wishlist | split: ',' %} 

catalog_liquid_csl.png

Additional filters to shuffle items:

{% assign wish_list = "46273602552117,47509806612789,47511668359477,47509632778549" | split: ',' | shuffle %}

{% assign wish_list = wishlist | split: ',' | shuffle %} (where wishlist is a comma-separated array)

Additional filters to sort items in a random order:

{% assign wish_list = "46273602552117,47509806612789,47511668359477" | split: ',' | sort: 'random' %}

{% assign wish_list = wishlist | split: ',' | sort: 'random' %} (where wishlist is a comma-separated array)

Event data

When you design a template, you can include attributes that are sent to Blueshift in an event. You can then use this in an event triggered campaign. 

For example, if you are sending an order confirmation message, you could mention the order ID, the name of the item purchased, and so on, in the template.

  Important

  • In your event triggered campaign, ensure that you select the same event that you used as the Sample Event when adding personalizations.
  • Ensure that you include all the required information in the event data that you send to Blueshift.

To use attributes from an event in the content, complete the following steps:

  1. Go to the Data tab > Preview Data section. 
  2. Select Event as the option and then select the event from which you want to use attributes to update the customer profile.
    The following example shows the purchase event.
  3. In the Show Data section, go to the bsft_event_context object. This contains the event specific data that you can use in your template.
  4. Include the event data in the format {{bsft_event_context.<attribute_name>}}.

liquid_event_context.png

Example:

Order amount = {{bsft_event_context.revenue}}

Order number/ID = {{bsft_event_context.order_id}}

External fetch data

You can use data that you fetch from an external source in your messaging templates.

Note: You must first set up the External Fetch template and test it.

To use attributes from an external fetch in the content, complete the following steps:

  1. Go to the Data tab > External Fetches section. 
  2. Click in the section and select the required external fetch template.
    The following example shows the news_entertainment_fetch template.
  3. Click Test External Fetches to fetch data from the external location.
      external_fetch_add_personalization.png
  4. In the Show Data section, go to the external_fetch object. This contains the data that is fetched.
      external_fetch_personalization.png
  5. Include the data in the format {{external_fetch.<external_fetch_template>.<attribute>}}.

The following attributes are used in this example:

{{external_fetch.news_entertainment_fetch.hotTopics.hotTopic_details[0].item}}

{{external_fetch.news_entertainment_fetch.hotTopics.hotTopic_details[0].url}}

external_fetch_message.png

Transaction data

You can include information from related events in personalized messages that you send to customers.

Messages in event triggered campaigns

You can include information from related events in messages that you send in an event triggered campaign. For example, when a message is sent after a user checks out of a hotel, you can include booking or payment details which are included in the booking_confirmation event but are not available in the check_out event (i.e. the event triggering for your campaign).

Note:

  • The related events must be part of a transaction model.
  • You must have at least one transaction record for the transaction model. You can send a few test events to create a sample record.
  • In your event triggered campaign, ensure that you select the same event that you used as the Sample Event when adding personalizations.

To include transaction data for personalization in your template, complete the following steps:

  1. Go to the Data tab > Preview Data section of the template.
  2. For the Sample Event, select the event that is the triggering event for the campaign.
     

    transaction_event_select_0722.png

  3. Select a preview user who has an event that is linked to the transaction record. You can select the same user as in the selected event record to ensure that the selected user has an event linked to the transaction record.
     

    template_select_user.png

  4. Event transactions for this preview user are displayed in the Preview Data section below the selected Sample Event.
     

    transaction_event_usereevent_0722.png

  5. Click Show Data to view the template data.
  6. Go to the event_transaction section. You can use this data to personalize your message content using Liquid.

    For example, {{event_transaction.hotel_booking.hotel_name}}

    Note: If the transaction model has a space in the name, for example “Hotel Booking”, then you must use the following syntax: {{event_transaction.[“Hotel Booking”].hotel_name}}

    transactions_event_data.png

Messages in segment triggered campaigns

You can use the content from the transaction record in a message to your customers. In order to do this, you must first set up a transaction segment

Note: In your segment based campaign, ensure that you select the same transaction segment that you use to select the preview user for the template.

To include transaction data for personalization in your template, complete the following steps:

  1. On the Data tab of the template, select a preview user that belongs to the transaction segment for the required transaction record.

    The following example shows a messaging template with the search for users that belong to the transaction segment "Monthly Promotion". The "Monthly promotion" segment targets users who have booked their hotel stay in the past 6 months. 

    transactions_template_user.png

  2. The related transaction record for the selected user is displayed in the Preview Data.
     

    transaction_selected_segment.png

  3. Click Show Data to view the template data.

    In this example, when you select a preview user that belongs to the transaction segment "Monthly Promotion", the template data includes details of the related transaction record.

    transactions_template_data.png

  4. Go to the user_transaction section. You can use this data to personalize your message content using Liquid.

    In this example, the transaction data includes the hotel booking details for the selected preview user.  For example, {{user_transaction.hotel_booking_id}} or {{user_transaction.hotel_brand}}.

    transactions_userpreview_data.png

 

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

Comments

0 comments

Please sign in to leave a comment.