Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 25 additions & 15 deletions src/connections/destinations/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,19 @@ Below are two examples demonstrating how to use Liquid templates in Segment mapp
##### Example 1: Standardize email addresses
This example converts an email address to lowercase and removes extra whitespace, ensuring consistency for a destination.

```json
{% if event.properties.email %}
{{ event.properties.email | downcase | strip }}
{% else %}
{{ event.properties.email | default: "[email protected]" }}
{% endif %}

```
{% raw %}
{% if event.properties.email %}
{{ event.properties.email | downcase | strip }}
{% else %}
{{ event.properties.email | default: "[email protected]" }}
{% endif %}
{% endraw %}
```

Input: `event.properties.email` = "[email protected]"

Output: [email protected]

Explanation:
Expand All @@ -358,18 +363,23 @@ Explanation:
##### Example 2: Transform phone number with conditional logic
This example formats a phone number by removing non-digit characters, adding a country code, and prepending a plus sign.

```json
{% if event.properties.phone %}
{% assign phone = event.properties.phone | strip | remove: "-" | remove: "(" | remove: ")" | remove: " " %}
{% if phone | slice: 0, 1 != "1" %}
{% assign phone = phone | prepend: "1" %}

```
{% raw %}
{% if event.properties.phone %}
{% assign phone = event.properties.phone | strip | remove: "-" | remove: "(" | remove: ")" | remove: " " %}
{% if phone | slice: 0, 1 != "1" %}
{% assign phone = phone | prepend: "1" %}
{% endif %}
{{ phone | prepend: "+" }}
{% else %}
{{ event.properties.phone | default: "" }}
{% endif %}
{{ phone | prepend: "+" }}
{% else %}
{{ event.properties.phone | default: "" }}
{% endif %}
{% endraw %}
```

Input: `event.properties.phone` = "(123) 456-7890"

Output: +11234567890

Explanation:
Expand Down
Loading