You will learn
Learn how to build email templates that include buttons to collect information about your subscribers and then redirect them to another URL.
Use cases for collecting information via links
In Klaviyo, you can use links or buttons to collect information automatically from email recipients. For example:
- In your newsletter campaigns, add buttons that let users specify how many times a week they want to receive emails from you
- In a thank you email to a new customer, prompt the recipient to update profile details such as gender
- In a winback email, prompt a customer to choose the category of products they are most interested in learning more about
Add buttons or links that update profile properties
Note that when you add a button or link that can update a profile property, recipients can only select one value. If they already have a value for the property set, their selection will overwrite the existing value.
When using the code snippets provided below, make sure to use straight quotes (') rather than curly quotes (‘) to ensure the code renders correctly. This can be achieved by copying the code below and pasting it directly into your template using the "Paste as Plain Text" function (Ctrl+Shift+V or Cmd+Shift+V).
Buttons
- Head to the email template you want to use.
- Add a button to the email template.
- Click on the button where you want to add this feature.
- Enter the following into the URL field
{% update_property_link 'profile_property' 'property_value' 'redirect_link' %}
- Change each section of the code to reflect:
-
'profile_property': the profile property that you'd like to update or create; for example, favorite_color
-
'property_value': the value that the particular button corresponds to; for example, blue
-
'redirect_link': the URL that you want them to redirect them to after they click the button
-
Only standard URLs (i.e., formatted as https://www.klaviyo.com) are supported. This code will work anywhere you'd normally add a link. The property value should be text or a number for best results. Note that if this property is already set for a particular recipient, it will be overwritten when they click the button.
Linked text
- Navigate to the email template you want to use
- Highlight the text you'd like to link
- Click the hyperlink icon in the text editor
- Enter the following into the URL field
{% update_property_link 'profile_property' 'property_value' 'redirect_link' %}
- Change each section of the code to reflect:
-
'profile_property': the profile property that you'd like to update or create; for example, favorite_color
-
'property_value': the value that the particular button corresponds to; for example, blue
-
'redirect_link': the URL that you want them to redirect them to after they click the button
-
Example of using links to collect information
Let's say that we want to collect dessert preference information from our subscribers by asking them if they prefer cake or pie.
To create this survey:
- Set the 'profile_property' to dessertsurvey
- Change the 'property_value' to pie
- Make the link redirect to a thank you page
In this case, our code would look like the following.
{% update_property_link 'dessertsurvey' 'pie' 'http://janes-test-store.myshopify.com/survey' %}
Whenever someone clicks the 'pie' button, it will update the 'dessertsurvey' profile property to 'pie,' and then go to a thank you landing page you create.
Now that we've collected data from our customers, we can use it in emails. This data is stored just like a regular customer property, and can be used to create segments that use these properties as conditions in the definition, split flows by different properties, and personalize messages using this data.
Review your results
Once someone clicks an update property link, their response is stored on their profile. You can navigate to a profile to see an individual’s response, or you can create a segment to identify everyone that clicked a specific option.
View individual results
To see which option someone selected on their profile:
- Search for a profile in Klaviyo using an email address or name
- Click a profile from the results to view all details
- Scroll down to the Information section of the profile
- Under Custom Properties, find the profile property set in the update property link (“dessertsurvey” in the example above)
- Note the property’s value (e.g., “cake”)
Create a segment based on answers
To create a segment of all profiles who clicked an update profile property link or button:
- Navigate to the Lists & Segments page
- Click Create List / Segment, then click Segment
- In the Dimension field, select your profile property, and in the Dimension value field, add your property value
- Finally, click Create Segment to generate a segment of everyone who clicked your update property link/button