Skip to main content

Template Values

When you identify users, you can use dynamic template values on all features.

Basically you can define variables and paths for the feature's title, and context that will then be dynamically replaced based on the currently identified user.

To use the template values, you have to first identify the user with the identifyUser method

Example of template values

Format

Enclose template values in double curly braces {{}}.

The base value is always user and then you can add a path to the value you want to use.

For example, if you have defined the user's email and name with those fields. And want to use the user's email, you would use {{user.email}}. If you want to use the user's name, you would use {{user.name}}.

Paths

Paths are separated by dots .. You can use as many paths as you want. Note that currently only objects are supported.

For example, if you have defined the user's company for example as {company: {name: "Example Company"}} and want to use the user's company's name, then you would use {{user.company.name}} as the template value.

Default values

You can also define default values for the template values. If the path does not exist, the default value will be used. You can define the default value by using the || operator.

For example, if you want to use the user's company's name, you can define {{user.company.name || "No company"}} as the template value, which will then default to showing "No company" if the user doesn't have company.name available.