Klaviyo integrates with both Magento 2 CE and Magento 2 EE. There are two steps to integrating Magento 2 with Klaviyo:
- Install the Klaviyo Extension in Magento.
- Enable the Magento 2 Integration in Klaviyo.
This guide covers both steps for Magento 2 stores.
Install the Klaviyo Extension in Magento 2
The Klaviyo Extension/Plugin adds web tracking and viewed product tracking to your Magento store. You need to prepare two things before installing the Klaviyo Extension:
- Log in to the Magento Marketplace and add the free Klaviyo Extension to your account.
- Log in to your Klaviyo account and write down your Public API Key / Site ID. For more information, check out How to Manage Your Account's API Keys.
With this information prepared you can begin to install the Klaviyo extension.
- From your Magento store admin click System and then click Web Setup Wizard.
- In the Web Setup Wizard click Extension Manager.
- If you haven't already, sign in and sync to your Magento Marketplace account.
- Find the klaviyo/magento2-extension and install it.
- After the installation is complete, navigate back to your Magento store admin, click Stores and then click Configuration under Settings.
- From the Klaviyo dropdown click General. Set Enable Klaviyo Extension to Yes and enter your six-digit Public Klaviyo API Key.
- Click Save Config.
Your installation of the Klaviyo extension is now complete. Leave this screen open to capture your Magento API Credentials in the next step.
Setup your Magento API Credentials
You'll need Magento API credentials to integrate your Magento 2 store with Klaviyo.
In the Configuration section, below Klaviyo click on Setup Klaviyo User.
Take note of these fields:
- Username: klaviyo
You'll notice that this field is pre-populated with the "klaviyo" username. You can feel free to change this username to whatever you like. Make note of this username, as it will serve as part of the Magento API credentials which will be needed in the next step
- Password: myStrongPassword
Enter a strong password. Take note of this password, as it will serve as part of your Magento API credentials which will be needed in the next step.
- Email: MyEmail
Enter your email address
When you're finished, click Save Config.
Enable Consent at Checkout
Next, you can choose to enable consent at checkout for email and SMS. On the Configuration page, navigate to Consent at Checkout under Klaviyo.
There, you’ll see a section for collecting email consent and SMS consent. The two are treated separately, so that you can collect just email, just SMS, or both. If you gather both SMS and email subscribers, choose a different list for SMS than for email. This makes sure that consent will always be properly attributed to the correct channel.
Under Email, select Yes for Subscribe contacts to email marketing at checkout. Then, select an email list to sync, such as a newsletter. Enter the email opt-in checkbox text you wish to use.
Under SMS, select Yes for Subscribe contacts to SMS marketing at checkout. Next, choose the list you want your SMS contacts to sync to. For additional detail regarding these settings, check out our guide to collecting SMS consent at checkout.
Sort order allows you to change the placement of the email and SMS consent boxes. By default, these boxes appear under the first email input and shipping phone number field, respectively. Thus, if you haven’t rearranged the checkout page, you do not need to change the sort order. If you have changed the layout, adjust the sort order accordingly.
When you are finished, click Save Config in the upper right.
Enable Klaviyo Webhooks in Magento 2
Next, you'll enable the Klaviyo webhooks in your Magento 2 account. To enable Klaviyo webhooks, navigate to Stores > Configuration from the admin dashboard. Click on Klaviyo and select the Webhooks tab.
Next, create a webhook secret and enter it into the corresponding Webhook Secret field. The webhook secret is a key that Klaviyo will use for validation. This secret can be anything you choose, but we recommend creating a secure string of letters and numbers. Magento will hide your webhook secret with asterisks for security purposes, so be careful to enter it correctly.
Next to the webhooks you wish to enable, select Yes from the dropdown options. To read more about the webhooks supported by Klaviyo, check out the guide to webhooks for Magento 2.
Click Save Config.
Enable the Magento 2 Integration in Klaviyo
Now you'll use the Magento API credentials you created to enable the Magento 2 integration in Klaviyo.
In a new browser tab, log into your Klaviyo account and navigate to the Integrations tab. Find and select the Magento 2 integration.
Enter the following information:
- Site URL: The site URL is the address of your Magento instance.
- API Username: by default, this value is "klaviyo." If you changed the API username in the previous step, enter it here.
- Password / API key: The password you created for your new user.
You have the option of subscribing new customers to a Klaviyo list by enabling Subscribe new customers to a Klaviyo list and selecting a list from the dropdown. You can read more about this setting in the next section.
Click to expand Advanced Options.
Enable these settings as needed:
- Stores: all Magento 2 stores are synced to Klaviyo by default. This setting allows you to be selective about which stores you integrate with. Head over to Supporting Multiple Magento Stores to learn more.
- Special Price Settings: we highly recommend enabling Special Price Settings if you're planning to use this feature. It is more difficult to enable this feature later. You can read more about this setting in the Special Price section below.
- Custom Media Root URL: this setting allows you to change the default path for your site images. Enable this setting if you host your product images on a URL that is different than your website.
Click Connect to Magento 2.
Your data will begin to sync into Klaviyo in minutes. You've successfully enabled the Magento 2 integration.
After the initial historical data sync is complete, the Magento 2 integration syncs with Klaviyo every 30 minutes.
Sync a Magento Signup Form to a Klaviyo List
New signups can be subscribed to a Klaviyo list if they have a subscribed status of 1 in Magento. To configure this, go to the Magento 2 integration settings page in Klaviyo. Then, select the checkbox to Subscribe new customers to a Klaviyo list and select the list you would like to sync subscribers to.
You can install the newest version of the Klaviyo/Magento2-extension via composer. The package can be found here.
If you are using an older version of the Magento 2 plugin, you can sync a Magento signup form so that users are added to a Klaviyo list using the following method:
- Create a list in Klaviyo that you want to sync with your Magento sign up form.
- Create a private API key.
- From your Magento store admin, click Stores and then click Configuration under Settings.
- From the Klaviyo dropdown click General.
- Fill in your Private Klaviyo API Key and click Save Config.
You may be prompted to flush your cache at this point. This is expected whenever updating configuration files in Magento 2.
- From the Klaviyo dropdown click Newsletter.
- From the dropdown select the Klaviyo list you want to sync your Magento signup form.
- Click Save Config and flush your cache again.
Your Magento signup form is now synced with your Klaviyo list.
Monitoring the Historical Data Sync
When you first integrate with Magento 2, Klaviyo will sync the last 90 days of your Magento 2 data so you can get started right away with engaging your most recent customers. After the sync of your most recent 90 days of data, Klaviyo will begin your complete historical data sync. Depending on how many orders, customers and products your store has, it can take anywhere from a few minutes to several days to sync all of your data.
Once this historical sync is complete, new data will sync to Klaviyo every 30 minutes. To check the progress of the initial sync, click on the Analytics tab in the sidebar and click into Metrics.
Find the Placed Order metric and change the date range of the graph to see which dates have been fully synced. When the sync is complete, the Magento 2 integration in the Integrations tab will be marked complete. If you want to verify for yourself that all data from Magento 2 is synced, you can cross-check the total orders for a few days or a week. Before you start validating, make sure your account's timezone matches the settings in Magento 2.
Data Synced with the Magento 2 Integration
Klaviyo's Magento 2 integration and complementary extension pull key customer information from your Magento platform.
Klaviyo syncs all customers that subscribe to your Magento 2 newsletter list moving forward. It is important to ensure that any customer that makes it to your Magento 2 newsletter list has consented to receive marketing emails.
Here's some of the data we sync from Magento:
- Customer information including first name, last name, and location.
- Sales and order data including which items were purchased, item images, item categories and any discounts applied.
- Fulfillment, refunded and canceled order data.
- When people visit your website and which items they view; you won't have to add the Klaviyo tracking snippet to your site as this web tracking is already handled by our extension for Magento.
To learn more, head over to Review and Understand your Magento 2 Data.
When configuring your integration settings, you will have the option to pull in "Special Price," which refers to a special sale price for items that can optionally take effect in a certain date range. For each product, there are 4 metadata fields that we will sync:
price(Required float): The standard price of the item
special_price(Optional float): This is a special sale price for the item. When this price is in effect, you will see this
special_pricenext to a strikethrough of the
special_from_date(Optional date): This specifies a start date for
special_priceto take effect
special_to_date(Optional date): This specifies an end date for
special_pricebeing in effect
You can find the Special Price option on the Magento 2 integration page, in the Advanced Options. When you enable Use special price for product prices when applicable, the product block will display the special price when applicable. When using a dynamic product feed, the special price will populate at send time. When manually selecting items from your catalog, the special price will populate once you select the product(s).
Convert Magento Order Values into a Single Currency
Klaviyo supports the conversion of all foreign currencies in Magento into one primary currency in Klaviyo. When this feature is enabled, the conversion happens when Magento syncs order data into Klaviyo. This is especially helpful if you have multiple stores with transactions in different currencies.
Klaviyo will check if the order_currency_code is the same as the set global_currency_code. If not, Klaviyo will convert the order total from the order currency to the global currency specified in your integration settings. This ensures that your financial analytics are accurate.
Contact customer support if you are interested in enabling this feature in your Klaviyo account.