You will learn
Learn how to redirect existing sign-up forms to Klaviyo, or otherwise ensure that your future subscribers are successfully added to your Klaviyo account.
If you're using one of our pre-built ecommerce integrations, like Shopify or BigCommerce, ecommerce platform-specific forms are synced automatically through the integration. Review the integration settings for your ecommerce platform to confirm these subscribers are automatically synced.
Additionally, if your ecommerce platform does not natively integrate with Klaviyo, you can still publish a custom-built sign-up form on your website and track site activity by installing Klaviyo.js to publish a sign-up form.
As you consider importing contacts and connecting sign-up forms to Klaviyo, keep in mind that maintaining 1 primary newsletter list will make it easy to later manage and communicate with your contacts efficiently. The segment builder allows you to create dynamic segments of your lists that don’t require any maintenance.
Redirect existing sign-up forms
If you already have different sign-up forms on your website, you'll need to make sure that subscribers using these forms end up in Klaviyo. To start, consider the following:
Redirecting a custom form to Klaviyo
If you're migrating over from Mailchimp, you will not be able to redirect existing forms to Klaviyo. Instead, take advantage of Klaviyo's native sign-up form builder to create and customize your forms.
- Navigate to the Lists & Segments tab.
- Choose which list you want subscribers to be added to.
- In the menu bar, select Sign-up forms.
- Here, you'll see all of your sign-up forms that are tied to that list. Scroll past these to find the list's subscribe page.
- Hover over the page name and click Copy URL.
- Go to your custom form.
- Change the Form Action URL to the subscribe page URL you copied.
- Save your changes.
Generally speaking, the form should have the following properties:
<form id="email_signup" action="//manage.kmail-lists.com/subscriptions/subscribe" method="POST">
<input type="hidden" name="g" value="LIST_ID_HERE">
<input type="email" value="" name="email" id="k_id_email" placeholder="Your email" />
OTHER_FORM_CONTENT_HERE
<button type="submit">Subscribe</button>
</form>
<script type="text/javascript" src="//www.klaviyo.com/media/js/public/klaviyo_subscribe.js"></script>
Using a third-party tool
Klaviyo integrates with a number of third-party list growth and landing page tools. Scan our list of available integrations to find yours. If you don't see your tool of choice on our list, we encourage you to reach out to ask them to integrate with us.
Using a Klaviyo subscribe URL for a third-party sign-up form
You can also add users to a list using a POST request from a third-party sign-up form. This method requires prior knowledge of using APIs.
API requests are made to the Klaviyo Subscribe URL endpoint: https://manage.kmail-lists.com/ajax/subscriptions/subscribe
POST requests to the above endpoint add a user's email and additional user properties to any list in Klaviyo that you choose. This endpoint is unique from the standard subscribe endpoint used in Klaviyo's native sign-up forms.
The POST body requires you to pass 5 distinct properties:
- g (required) - The desired LIST_ID
- email (required) - The user's email address
- $fields (optional) - This tells the Klaviyo backend which keys (additional users properties) to expect in the POST request. All properties (other than email) need to be passed as a value under $fields and as its own key.
- $list_fields (optional) - This inherits from the data from $fields and transposes it as a custom property in list format
- other properties (optional) - For each property in $fields, you want to pass a key/value pair like below:
- $first_name: John
- $last_name: Smith
- Custom Property 1: Custom Value 1
- Custom Property 2: Custom Value 2
Code snippet
var settings = {
"async": true,
"crossDomain": true,
"url": "https://manage.kmail-lists.com/ajax/subscriptions/subscribe",
"method": "POST",
"headers": {
"content-type": "application/x-www-form-urlencoded",
"cache-control": "no-cache"
},
"data": {
"g": "{{LIST_ID}}",
"$fields": "$first_name,$last_name,Favorite Color,Favorite Book,$source",
"email": "{{email}}",
"$first_name": "{{first_name}}",
"$last_name": "{{last_name}}",
"Favorite Color": "{{favorite_color}}",
"Favorite Book": "{{favorite_book}}",
"$source": "Custom Form"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
Response
200 Success: Request was successful.
400 BAD REQUEST: The email address used already exists in Klaviyo.
405 METHOD NOT ALLOWED: Required fields are missing from the POST request.
Special Properties
$first_name, $last_name, and $source are special Klaviyo properties. You can choose to include any of these special properties for users:
- $id - Your unique identifier for a person
- $email - Email address
- $first_name - First name
- $last_name - Last name
- $phone_number - Phone number
- $title -Job title at their business or organization
- $organization - Business or organization a user belongs to
- $city - The city a user lives in
- $region - The region or state a user lives in
- $country - The country a user lives in
- $zip - The postal code where the user lives
- $image - URL to a photo of the user
- $source - The form the user signed up with