# Personalize with Variables

Source: https://amplitude.com/docs/guides-and-surveys/personalize-with-variables

---

On this page

- [Common examples](#common-examples)
- [Replacing parts of a URL](#replacing-parts-of-a-url)
- [Personalizing guides with a user's name](#personalizing-guides-with-a-users-name)
- [Providing fallback values](#providing-fallback-values)
- [User property requirements](#user-property-requirements)

# Personalize with Variables

The Personalize with variables feature (also called interpolation) dynamically displays user properties to customize content in a guide or survey. Use this feature to customize content for each user, such as displaying their first name or `user_id`. You can add personalized variables to:

- Titles
- Content
- Button labels
- Button Action URLs

## Common examples

### Replacing parts of a URL

Use user property variables in CTA links to personalize URLs. For example, create a link like:

plaintext

```
www.example.com/path?user_id=@{{property.user_id}}&country=@{{property.country}}

When a user clicks the CTA link, Amplitude replaces the user property variables with actual values:

www.example.com/path?user_id=12345&country=US

### Personalizing guides with a user's name

Create a user property that holds the user's first name, such as `firstName`. Place the `firstName` property in any guide or survey field where you want to address users by name.

## Providing fallback values

A user property isn't always available for every user or every session. Use a fallback value to display a default when the property is missing. For example, to display "Hey there" instead of "Hey {firstName}" when a user hasn't provided their name, use a fallback like `{{property.firstName | there}}`.

## User property requirements

Send user properties from the client during the active session, using either the Amplitude SDK or the Engagement SDK. Properties sent in prior sessions, and properties stored only on the server, aren't supported.

To set user properties, use the [`_setUserProperties`](/docs/sdks/guides-and-surveys/sdk#set-user-properties) method in the Engagement SDK, or `amplitude.identify()` in the Amplitude SDK.

Amplitude autopopulates `user_id` and `device_id` for you. These variables are always available without additional setup.

User properties in conditional logic

User properties can also power [conditional logic](/docs/guides-and-surveys/conditional-logic). Use conditional logic to create different button actions or survey paths based on user characteristics. For example, direct premium users to different content than free users.

##### Add personalized variables to a guide or survey

1. Open an existing guide or survey, or create a new one.
2. Select the title, content block, button name, or other text field. The personalize variable icon appears on the right of the selected field.
3. Select the [user property](/docs/sdks/guides-and-surveys/sdk#set-user-properties) icon.
4. In the popup, enter the user property name.
5. (*Optional*) Enter a fallback value for the user property.
6. Select **Insert**.
7. Repeat for every field where you want to add property variables.

Was this helpful?

<!--$-->

<!--/$-->
