How to Integrate with Shopify

Last updated at:


Learn how to enable Klaviyo’s Shopify integration, sync your Shopify newsletter subscribers to a Klaviyo list, and add web tracking to your Shopify store. After integrating you can optionally sync any of your existing signup forms to your Klaviyo account.

Although Klaviyo maintains a native integration with Shopify, your Klaviyo account is a separate entity from your Shopify account. Changes made to your Shopify account, such as billing updates or cancellation, will not apply to your Klaviyo account.

Step by step walkthrough showing the Klaviyo integration with Shopify

Enable the Shopify Integration

There are two ways to get started with Klaviyo’s Shopify integration:

  • Add the Shopify integration from the Klaviyo getting started wizard (if you’re a brand new customer)
  • Add the Shopify integration from the Integrations tab in your Klaviyo account

The following instructions cover adding the Shopify integration from the Integrations tab in your Klaviyo account.

  1. In your Klaviyo account click the Integrations tab and click on the Shopify integration. This takes you to your Shopify Integration settings page.
    Shopify’s listing on Klaviyo’s integrations page, with Add Integration
  2. Paste in the URL of your Shopify store and click Connect to Shopify. There are three additional settings:
    • Collect email subscribers
      Checking this box automatically adds all customers who accept email marketing at your checkout, or sign up to your default Shopify signup form, to the list you select from the dropdown. Read more about syncing your newsletter subscribers below.
    • Automatically add Klaviyo On Site javascript (recommended)
      Checking this box automatically adds Klaviyo's Active on Site tracking snippet. If you do not check this box you can manually install Klaviyo's on site javascript, see the Add Web Tracking to Your Shopify Store section below for more information.
    • Update Shopify customer profiles with Klaviyo data
      This option will sync certain fields like first name, last name, email marketing, and more from Klaviyo to Shopify. Only select this option if you would like the Klaviyo values to overwrite the corresponding Shopify values. Read more about syncing Klaviyo data to Shopify.
      Note: for existing profiles in Klaviyo, we will start syncing those fields to Shopify the next time Shopify syncs any data about them to us. This is because, for existing profiles, we need their Shopify ID in order to update their information in Shopify. Profiles that don't exist in Shopify but do exist in Klaviyo will not be synced back as a net-new profile. They will still need to perform an activity in your Shopify store that add them to your Shopify account before Klaviyo will start syncing data.
    Klaviyo’s Shopify settings page showing Connect your Shopify Store, onsite javascript (recommended), and Advanced Options
  3. After configuring your settings, click Connect to Shopify. This takes you to your Shopify account.
  4. Click Install App. This begins syncing your Shopify data with Klaviyo and takes you back to your Klaviyo account.
    Shopify’s Klaviyo app permissions page, with the data that Klaviyo will see, Install app, and Cancel
  5. A green success callout will indicate that your data is syncing with Klaviyo.

If you're syncing a large amount of data a green progress bar will indicate the status of your sync. See the section below on Monitoring the Historical Data Sync for more detailed information.

Your Shopify integration is now enabled.

Sync Your Shopify Newsletter Subscribers to a Klaviyo List

It's important to add your Shopify subscribers automatically to your Klaviyo newsletter list. Shopify customers can accept email marketing at checkout or they can signup through default Shopify signup forms.

In addition to signup options that Shopify offers, your customers can subscribe through Klaviyo signup forms or through signup forms created by popup or list-growth apps.  See the section below on syncing your signup forms to Klaviyo, or learn more about integrating with popup or list-growth apps.

New newsletter subscribers are synced in real time through your Shopify integration. 

If you are using a Shopify 3rd party theme, your theme's default signup forms must also apply the Newsletter tag to new subscribers in order for Klaviyo to automatically sync these subscribers to a Klaviyo list. Contact your theme developer, or if you're comfortable editing your theme's source code, add the following hidden input tag to your form's input group:
<input type="hidden" name="contact[tags]" value="newsletter">

Configure the Integration

We're going to walk through configuring your Shopify integration settings so that Shopify subscribers will automatically be added to a Klaviyo list. 

Navigate to your Shopify integration page by checking the box to Collect email subscribers, and selecting a list from the dropdown. After you select the list you want to sync, click Update Shopify settings.

Klaviyo’s Shopify Collect Subscribers settings, with Collect email subscribers checked and Add subscribers to list Newsletter selected

When you integrate your Klaviyo account with Shopify, one of the properties synced from your store is whether each customer accepts email marketing or not. The property can be either true or false. Below is an example of how the property appears on a customer's profile in your Klaviyo account.

Klaviyo’s profile property information, with First Active, Last Active, Custom Properties, Accepts Marketing, Profile Created, and Profile Updated

To learn more about how the Accepts Marketing property is managed in Shopify, view their documentation. This property is always synced to your Klaviyo whether you subscribe customers who accept email marketing to a list or not.

Shopify syncs an Accepts Marketing property into Klaviyo.  It's important to note that Shopify's Accepts Marketing property does not reflect whether someone is or isn't subscribed to a Klaviyo Newsletter list. As such, there are a few situations which can cause someone to have Accepts Marketing set to false, but they're still subscribed to your newsletter:

  • If a customer checks out and decides not to accept email marketing at that time, but later subscribes through a signup form, they'll still be added to your newsletter list.  
  • If a customer checks out and does accept email marketing, they'll be added to your newsletter list. If they check out again, they'll probably decide to not subscribe again since they're already subscribed. Depending on your checkout configuration, Shopify might see this as not accepting marketing (Accepts Marketing = false.) You probably don't want to treat this customer as an unsubscribe. Rather, you'll want to keep this customer on your newsletter list.  
Klaviyo will not automatically sync historical subscribers to a list when a customer checks "Subscribe new customers to a Klaviyo list." If you need to add historical subscribers to your newsletter list, you can do so with property and flow editing utilizing the steps outlined in How to Add or Combine Lists Without Triggering a Flow. You can also add subscribers to a list manually by following How to Add Subscribers to an Existing List
Additionally, it's important to note that a customer having Accepts Marketing set to false won't automatically suppress that customer. To learn more about profile suppression, check out our article About Suppressed Profiles in Klaviyo

Add Web Tracking to Your Shopify Store

Web Tracking Snippets

Klaviyo provides two web tracking snippets to help you collect valuable information about your customers:

  • Active on site
    This snippet tracks when your customers visit your site. This snippet is installed with Klaviyo's on site JavaScript. We recommend installing this snippet by checking the box on your Shopify Integration settings page in your Klaviyo account. If you would like to manually install this snippet, follow the instructions in our guide to manually installing klaviyo.js.
  • Viewed Product
    This snippet tracks when your customers view specific products. Instructions for installing this snippet manually are described below.

The Viewed Product snippet is:

<script type="text/javascript">
  var _learnq = _learnq || [];
  var item = {
    Name: {{ product.title|json }},
    ProductID: {{|json }},
    Categories: {{ product.collections|map:'title'|json }},
    ImageURL: "https:{{ product.featured_image.src|img_url:'grande' }}",
    URL: "{{ shop.secure_url }}{{ product.url }}",
    Brand: {{ product.vendor|json }},
    Price: {{ product.price|money|json }},
    CompareAtPrice: {{ product.compare_at_price_max|money|json }}
  _learnq.push(['track', 'Viewed Product', item]);
  _learnq.push(['trackViewedItem', {
    Title: item.Name,
    ItemId: item.ProductID,
    Categories: item.Categories,
    ImageUrl: item.ImageURL,
    Url: item.URL,
    Metadata: {
      Brand: item.Brand,
      Price: item.Price,
      CompareAtPrice: item.CompareAtPrice

The Viewed Product snippet will need to be pasted at the bottom of your product.liquid file. If you are unsure of how to do so, follow the instructions in the following section. If you've already added the snippet and want to check that it is working properly, skip ahead to step 6 in the following section. 

Adding the Viewed Product Snippet to Your Shopify Theme

If your Shopify store uses the Shopify 2.0 Dawn theme, you’ll need to add the Viewed Product code snippet in a different way. First, find your main product template by navigating to your Shopify admin and going to Online Store > Edit Code. Select product.json from the Templates folder. Confirm “type”, which by default is main-product for new stores using Dawn, and product-template for stores converted to Dawn from a vintage theme. Navigate to the Sections folder and find the associated type.liquid file, such as main-product.liquid, or product-template.liquid. Then, search for the {% schema %} tag in the code and insert the snippet directly above it. 

  1. From your Klaviyo account click the Account dropdown and select Setup Web Tracking. This takes you to a page with Klaviyo's web tracking snippets.
    Klaviyo’s Shopify integration settings page, with account dropdown and Setup Web Tracking selected
  2. Beneath step 2, copy the code snippet.
    Klaviyo’s web tracking page with three steps including adding the web tracking JavaScript snippet and entering the URL of your Shopify store
  3. From your Shopify Admin click Online Store > Themes. From the dropdown click Edit Code.
    Shopify themes page showing espresso shot glasses on right bottom corner with Actions dropdown open and Edit Code selected
  4. Search for the product.liquid file. Click the file to open it in the editor.
    Shopify’s Edit Theme page grayed out with the product.liquid file selected and highlighted
  5. Paste the second code snippet at the bottom of the file, after all the existing code. Click Save.
    For this snippet to work correctly it should be added to all of your product pages. If you are using custom product pages, you may need to add this snippet to a different theme file, or to your individual custom product pages.
    Shopify’s edit code page with the product.liquid file open, showing Klaviyo’s Viewed Product snippet amended to the bottom of the file
  6. Switch back to your Klaviyo account. Enter the URL for your Shopify store into the box. Click Next.
    Klaviyo’s web tracking page with box to test your URL, Next, and Waiting for data in a gray box
  7. Click the link that is generated where you previously input your URL. This triggers an Active on Site event in your Klaviyo account.
    Klaviyo’s web tracking page with test store URL and Data Received. Continue in a green box with an arrow

A green Data Received button confirms that your web tracking is set up correctly.

Sync Your Shopify Signup Forms or Add Klaviyo Forms

Enabling the Shopify integration provides three options for syncing your signup forms to Klaviyo:

If you checked the box to Automatically add Klaviyo onsite javascript (recommended) on your Shopify Integration settings page, or followed the guide to do so manually, then you have already installed klaviyo.js and your Klaviyo form are enabled. You can jump right the signup form editor, found in the Signup Forms tab, and start building out a form.

Shopify Plus Only: Enable SMS Consent at Checkout

For Shopify Plus stores, you can collect SMS from customers during checkout. This allows you to drastically increase the number of your SMS subscribers. It is also a straightforward, nonintrusive way to gain consent. Also, you will only be able to collect SMS consent from recipients in countries where Klaviyo SMS is available.

For more details, read How to Collect SMS Consent at Checkout on Shopify Plus

Monitoring the Historical Data Sync

When you first integrate with Shopify, Klaviyo will sync the last 90 days of your Shopify 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 in real time. To check the progress of the initial sync, click on the Analytics tab in the sidebar.

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 Shopify integration in the Integrations tab will be marked complete. If you want to verify for yourself that all data from Shopify 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 Shopify.

To check or update your account's timezone, go to the Account Settings page (found by clicking your account name, then clicking Account in the dropdown) and check the Contact Information > Organization section.

Klaviyo limits the number of unique metrics you can create to 200. When you approach this threshold, you will be alerted via a warning in your account, along with an email to the account owner.


Here are some quick troubleshooting tips for common issues.

My Shopify Integration is Not Syncing

If you think your Shopify integration is not syncing data properly, you can update the sync by completing the following steps.

  1. From your Klaviyo account, click into your Integrations tab.
  2. Find your Shopify integration and click View Settings.
  3. Click the blue Update Shopify Settings button. If you're not logged into your Shopify store you will be redirected to Shopify and prompted to log in.

    When you click to update your integration settings, we will re-authenticate with Shopify and then you will be brought back into Klaviyo. If you click to update, and then click the back button or navigate elsewhere before this authentication process completes, this will cause your integration to get disabled.

  4. A green Settings Updated callout at the top of the page confirms your integration has been updated and is resyncing. This can take up to 1 minute to appear.

Additional Resources

Reviewing Your Shopify Data

How to Disable Emails Sent by Shopify

How to Add a Link That Applies a Coupon Code to a Shopify Cart


Was this article helpful?
1619 out of 2513 found this helpful