Dynamic Tags and Modifiers

Dynamic Tags

Dynamic Tags are pieces of text that are replaced with their corresponding value of what they represent. Use them to personalize your email content, subject line or any other element that support those tags.

For example **|user.firstname|** will be replaced with the user firstname when the email is sent or preview.

Depending on their usage place those can contain information about:

  • campaign: **|campaign.type|** will display campaign type.
    • _id, title, type are available
  • template **|template.title|** will display template title
    • _id, type, title are available
  • user: display user attributes. **|user.country|** will display user country
    • any user attribute
  • shop: display shop attributes:
    • _id, title, domain, url are available
  • event : display attributes from the event. **|event.query|** will display query value for search event
    • for each event a set of distinct attributes are available
    • event attributes are available for emails triggered by an event: transactional or workflow campaigns only
  • voucher (only available in transactional and workflow campaigns) **|voucher_code|**. View Setup -> Coupon codes
  • timestamp: use to display current date. See date format below

Modifiers

Modifiers represent various methods that are applied to the value of those dynamic tags. We support the following modifiers:

  • date: will turn a numeric date into a readable text. It accepts a format parameter and a milisecond
    • date(“%Y-%m-%d”, true) will work with milliseconds values
    • example **|timestamp|date(“%Y”)|** will display current Year
  • truncate(param): truncate the value to maximum length specified in param. Default is 30
  • pretty_price(param): value gets rounded to 2 decimals. If param passed is true then decimals are removed for values that are round. Pass false if you need to display 2 decimals, also .00
    • pretty_price(true)
    • example **|product.price|pretty_price(true)|**
  • md5: convert to md5
  • b64encode: encodes to base64
  • b64decode: decodes from base64
  • urlencode: encodes value as URL

If the attribute is missing, you can set a default value to be displayed.

This can be used for any tag. Add |default(‘default_value_here’) after the tag name:

Examples:

**|product.price|pretty_price|**
**|product.discountPrice|pretty_price(true)|**
**|user.name|default('Dear User')|**
**|user.email|md5|**

Considerations

  • Tags and Modifiers are case sensitive: event.Generic.Name will not match the generic field of an event, and neither attribute if it’s sent as name
  • Event.generic.attribute_name are only available for workflow and transactional campaigns
  • Modifiers are only valid within email campaigns and interaction campaigns that are generated on the server side.
  • Not valid tags are removed (replaced with empty string) if there is no data to be replaced with.

Related Articles