@@ -339,14 +339,19 @@ Below are two examples demonstrating how to use Liquid templates in Segment mapp
339339##### Example 1: Standardize email addresses
340340This example converts an email address to lowercase and removes extra whitespace, ensuring consistency for a destination.
341341
342- ``` json
343- {% if event.properties.email % }
344- {{ event.properties.email | downcase | strip }}
345- {% else % }
346- {{ event.properties.email | default: "unknown@example.com" }}
347- {% endif % }
342+
343+ ```
344+ {% raw %}
345+ {% if event.properties.email %}
346+ {{ event.properties.email | downcase | strip }}
347+ {% else %}
348+ {{ event.properties.email | default: "unknown@example.com" }}
349+ {% endif %}
350+ {% endraw %}
348351```
352+
349353Input: ` event.properties.email ` = "user@example.com "
354+
350355Output: user@example.com
351356
352357Explanation:
@@ -358,18 +363,23 @@ Explanation:
358363##### Example 2: Transform phone number with conditional logic
359364This example formats a phone number by removing non-digit characters, adding a country code, and prepending a plus sign.
360365
361- ``` json
362- {% if event.properties.phone % }
363- {% assign phone = event.properties.phone | strip | remove: "-" | remove: "(" | remove: ")" | remove: " " % }
364- {% if phone | slice: 0, 1 != "1" % }
365- {% assign phone = phone | prepend: "1" % }
366+
367+ ```
368+ {% raw %}
369+ {% if event.properties.phone %}
370+ {% assign phone = event.properties.phone | strip | remove: "-" | remove: "(" | remove: ")" | remove: " " %}
371+ {% if phone | slice: 0, 1 != "1" %}
372+ {% assign phone = phone | prepend: "1" %}
373+ {% endif %}
374+ {{ phone | prepend: "+" }}
375+ {% else %}
376+ {{ event.properties.phone | default: "" }}
366377 {% endif %}
367- {{ phone | prepend: "+" }}
368- {% else % }
369- {{ event.properties.phone | default: "" }}
370- {% endif % }
378+ {% endraw %}
371379```
380+
372381Input: ` event.properties.phone ` = "(123) 456-7890"
382+
373383Output: +11234567890
374384
375385Explanation:
0 commit comments