How to configure OneTrust with Klaviyo's cookies
You will learn
Learn how to configure OneTrust cookie management tools, including Auto-Blocking and CookiePro, to work with Klaviyo’s tracking and onsite functionality.
Klaviyo.js is Klaviyo's JavaScript snippet that enables Active on Site tracking and sign-up forms. You have the option to enable this tracking through your ecommerce integration or by pasting the code in your site's theme. When tracking is allowed, Klaviyo.js uses the first-party __kla_id cookie on your website to recognize visitors. This cookie can temporarily hold personally identifiable information. After Klaviyo identifies a visitor (e.g., when they click a tracking link in a Klaviyo-sent email), it stores an encrypted identifier that connects onsite activity with their profile. OneTrust controls whether Klaviyo’s tracking scripts can load based on your cookie consent settings.
Complete the cookie setup steps below in order to configure consent-based tracking while allowing forms that do not require tracking to work.
Prerequisites
We suggest visiting our Guide to Klaviyo Web Tracking for more information on how our cookies capture known visitor information in different ways.
Additionally, it is important that you have already enabled Klaviyo.js, either directly through your ecommerce integration or manually.
Configuring Klaviyo and OneTrust’s tools
Use OneTrust to block Klaviyo’s tracking scripts until visitors give the consent required by your site’s configuration. Blocking all Klaviyo scripts can also stop sign-up forms from working, including forms that do not require tracking.
Klaviyo serves tracking scripts from static-tracking.klaviyo.com and sign-up form scripts from static.klaviyo.com. Configure blocking for the tracking scripts so forms that do not depend on visitor tracking can still load. Klaviyo’s tracking includes:
- if a visitor is active on site, the site referrer URL
- if a visitor views a product or adds a product to their cart (if you’ve enabled this separately)
To configure consent-based tracking in OneTrust’s CookiePro tool while allowing forms that do not require tracking to work, follow the steps below.
Add your website to CookiePro
If you haven’t already, you will need to add your website to your CookiePro account.
1. Log into your CookiePro account and click the Cookie Compliance section under My Apps.

2. Click Add Website in the upper right-hand corner.

3. From here, you will see a section to set up and add your website and scanning details. Fill in your website URL and name of your organization in the first two fields.

Note that if you already have an organization associated with your CookiePro account, it will appear in the dropdown as an option.
4. Under the Advanced Options section, you can choose to adjust or add your scanning settings.
5. You can adjust the number of website pages that CookiePro will scan by changing the number in the Limit scan to field. By default, CookiePro will recommend scanning the first 1,000 pages.

6. You can also limit the CookiePro scan to one area of your site. To do this, toggle on the option next to Limit to this path within site. Make sure that your Website URL above reflects this URL path (e.g., retail.com/signups).

7. Finally, if there are certain pages or types of pages that you want CookiePro to scan, you can add these in the next few fields. Add page IDs separated by commas to the Scan Pages with Query Parameters field to scan pages by ID number.
You can also scan pages by URL by adding these URLs in the Target Pages to Scan field.
If you have a longer list of URLs or a sitemap, you can copy and paste those into the Sitemap URLs field. These URLs will be scanned first in the scan queue.

8. Once you have all settings completed, click Scan & Configure in the lower right corner.
Configure the static-tracking.klaviyo.com entry
Configure the __kla_id entry that OneTrust associates with static-tracking.klaviyo.com, the source of Klaviyo’s tracking scripts. The __kla_id cookie itself is a first-party cookie stored on your website; these steps configure its entry in OneTrust.
1. Once your website has been added, navigate to Cookiepedia > Categorizations in the left hand navigation.
2. Look for the Klaviyo static-tracking __kla_id cookie either by searching for it in the field above or by scrolling through the list below. It should be the option labeled as “Persistent” with the static-tracking.klaviyo.com hostname.
3. Click the __kla_id cookie option.

4. Once on the Cookie Details page, navigate to the Categorization tab.
5. If you have not run a scan with Klaviyo and OneTrust yet, make sure to choose Targeting Cookies from the Select a category dropdown. Make sure that Third-Party Cookie is already populated in the Select a party dropdown.

6. Once you have made these updates, click Save in the lower right corner.
7. In this same area, navigate to the Source tab. You should see your website URL appear in the list, as shown in the example below.

8. Click on your website URL.
9. A dropdown will appear with a new URL; click on the pencil icon to the right.

10. In the modal, remove your current URL and replace it with: https://static-tracking.klaviyo.com.
11. Click Confirm once you have updated the URL.

12. To confirm that the Klaviyo cookie has been updated, navigate to Cookiepedia > Categorizations in the left-hand navigation.
13. Click on the Cookies tab.
14. From here, your __kla_id cookie should show a “1” listed under both the Domain Category Overrides and Domains columns.

Configure the static.klaviyo.com entry
Configure the __kla_id entry that OneTrust associates with static.klaviyo.com, which serves Klaviyo’s sign-up form scripts. As with the previous entry, this configures OneTrust’s record of the cookie; it does not collect third-party cookies for Klaviyo.
1. Navigate to Cookiepedia > Categorizations in the left hand navigation.
2. Look for the static.Klaviyo __kla_id cookie either by searching for it in the field above or by scrolling through the list below. It should be the option labeled as “Persistent” with the static.klaviyo.com hostname.
3. Click this __kla_id cookie option.

4. Once on the Cookie Details page, navigate to the Categorization tab.
5. Choose Targeting Cookies from the Select a Category dropdown. Make sure that Third-Party Cookie is already populated in the Select a party dropdown.

6. Once you have made these updates, click Save in the lower right corner.
7. In this same area, navigate to the Source tab. You should see your website URL appear in the list below.

8. Click on your website URL.
9. A dropdown will appear with a new URL; click on the pencil icon that appears to the right of this.

10. In the modal remove your current URL and replace with: https://static-tracking.klaviyo.com.
11. Click Confirm once you have updated the URL.

12. To confirm that the Klaviyo cookie has been updated, navigate to Cookiepedia > Categorizations in the left hand navigation.
13. From here, your __kla_id cookie should show a “1” listed under both the Domain Category Overrides and Domains columns.

Configuring your website’s first-party cookie
Configure the first-party __kla_id cookie associated with your website to capture events on your ecommerce site.
1. Navigate to Cookiepedia > Categorizations in the left hand navigation.
2. Look for your website specific __kla_id cookie either by searching for it in the field above or by scrolling through the list below. It should be the option labeled as “Persistent” with your website URL as the hostname.
3. Click this __kla_id cookie option.

4. Once on the Cookie Details page, navigate to the Categorization tab.
5. Choose Targeting Cookies from the Select a Category dropdown. Make sure that First-Party Cookie is already populated in the Select a party dropdown.

6. Once you have made these updates, click Save in the lower right corner.
7. In this same area, navigate to the Source tab. You should see your website URL appear in the list below.

8. Click on your website URL.
9. A dropdown will appear with a new URL; click on the pencil icon that appears to the right of this.

10. In the modal remove your current URL and replace with: https://static-tracking.klaviyo.com.
11. Click Confirm once you have updated the URL.

Previewing your updated cookies
1. Navigate to Scripts in the left-hand navigation.
2. On the Scripts page, click on your website URL that appears below.

3. Then, click Publish Production in the upper right-hand corner.

4. In the right sidebar that appears, click Confirm.
5. Once on the Review tab, scroll down and click Continue.
6. Finally, on the Confirm and Publish tab, click Publish Test & Preview. Your preview may take a few seconds to load, but you will see a green check appear below once it’s ready.
7. Once this success message appears, click Confirm below.
Publishing your updated cookies
Before you publish your cookies, it’s important to note that production scripts can take up to 4 hours to take effect on your website. Once you follow the directions below, please wait up to 4 hours to see these updates.
1. Navigate to Websites in the left-hand navigation.
2. On the Websites page, click on your website URL from the list below.

3. From here, click Publish in the upper right corner.
4. A sidebar modal will appear confirming your version to publish. Click Confirm in the lower right corner.

5. In this same modal, you will move onto the Review and Publish screen. Click the toggle on Enable Automatic Blocking of Cookies.
You can read more about CookiePro’s Auto-Blocking feature in their guide.

6. Click Publish in the lower right corner.
7. A popup will appear with your Production Scripts. Click Copy Scripts.

8. Place these scripts within the HTML of your ecommerce website. Read more about placing these scripts into your ecommerce website in CookiePro’s step-by-step guide.
Verify your setup
After publishing, test your website in each cookie consent state:
- In a fresh browser session, leave Targeting Cookies unaccepted. Check that Klaviyo’s tracking scripts are blocked and that forms which do not require tracking can still display.
- Accept Targeting Cookies, then follow the onsite tracking test to confirm that Klaviyo records activity for an identified test visitor.
- Withdraw cookie consent and confirm that further onsite activity is no longer tracked.
Additional Resources
- Understanding cookies in Klaviyo
Learn more about how Klaviyo uses cookies as a part of our web tracking to gather information and help improve conversion rates and email performance. This article explains the specific cookie we use and its purposes so that you understand how customers are tracked. This information helps you understand how Klaviyo gathers data, and how this may impact customer privacy and compliance laws.
- Getting started with Klaviyo onsite tracking
Learn about the different ways that Klaviyo can support onsite tracking on your ecommerce site. There are 2 key types of onsite tracking: