You will learn
Before you begin
If you choose to manually install Klaviyo.js and previously had it enabled via Klaviyo's app embed, you must first disable the app embed in your Shopify theme settings.
Because pasting this code requires access to your site's HTML and ecommerce platform, our support team is unable to offer hands-on assistance. If you don't have a developer on your team and are not comfortable adding the code yourself, consider reaching out to a Klaviyo partner for assistance.
Install Klaviyo.js on your Shopify store
- Copy the code snippet below:
- In the code snippet, be sure to replace 'PUBLIC_API_KEY' with your six-digit Klaviyo Public API Key.
- If you've enabled Customer Accounts for your store, add an extra script to identify your customers with the email they use to log in to your store. The full script will look like the following:
- From your Shopify Admin click Online Store > Themes. From the dropdown click Edit Code.
- Search for the files you want to add the snippet to and click to open it in the editor. You can add the snippet to any page templates where you want to enable Klaviyo forms and tracking on the corresponding pages.
- Scroll to the bottom of the file and paste your snippet below the other code.
- Click Save.
Test your Active on Site tracking
To test that your Active on Site tracking is set up properly, follow these steps:
- Navigate to your website.
- On your homepage, add the following to the end of the URL, replacing email@example.com with your email address:
- Reload the page.
- Search in Klaviyo for your email address.
You should see that a Klaviyo profile has been created for you (if one didn't exist already) and that this activity has been tracked on your activity feed.
Now that you've installed Klaviyo.js, you'll be able to utilize Active on Site tracking, Klaviyo sign-up forms, and more.
Based on your Customer Privacy settings in Shopify, Klaviyo may not track onsite events (including Active on Site and Viewed Product) for visitors to your Shopify store in the EU, EEA, UK and Switzerland, unless they have provided consent.