Using personalisation in your templates

Handlebars code can be used directly in Taxi templates but there is a possibility of conflicts in some cases between html syntax and handlebars.  The authors of Handlebars recommend using <script> tags around handlebars code to help with this.

As it’s not recommended to have script tags in the final delivered emails we recommend using a remove_outer rule as follows:
<script rule=”{% remove_outer %}”>

{{#if some_handlebars_var }} {{some_more_handlebars_code}} {{/if}}


This results in the script being completely invisible in the editor in Taxi.  Sometimes this can be confusing for users, so it is good practice to include a preview only placeholder to help give a good editor experience:


Membership-Number: Example1234


Personalisation fields for rich text

Personalisation fields can be set up in Taxi to help users add snippets of Handlebars code to their emails in the rich editor:

These appear in a dropdown in the rich editor, like this:

These show as placeholder text in the editor and preview (e.g. First Name), but as the relevant code at export.


Taxi has 2 constructs used for dynamic content called Segments and Segment sets. They are fully integrated with the SES connector.  To associate Handlebars code with a segment or segment set first go to ‘segmentation’ in the data menu:

Next, navigate to the relevant segment set page and find your connector on the ‘connectors’ tab:

If you have multiple connectors it is important to understand that the handlebars code is associated with the segment separately for each connector.  This means your marketers can use the same audience categories but the underlying data mappings used can be adjusted for each platform you’re sending with.

To add handlebars code click ‘edit settings’

The first thing to do is drag your preferred default segment to the last position, that’s because segments use an if /else if/ else structure.  The ‘else’ content is used if none of the data matches, so this is the default.

Then add the conditions for each of your segments.  Remember that unlike similar languages handlebars does not support tests like == or < or >. Therefore you can only test for the presence/truthiness of a variable.  This part of the design philosophy of Handlebars. The intention is that these tests to be done in pre-processing and passed into the payload.

Did this answer your question?