You Will Learn
Learn how to configure OneTrust cookie management tools (including their Auto-Blocking™ functionality and Cookie Pro product) tools to work with Klaviyo’s tracking and onsite functionality.
Klaviyo.js is Klaviyo's JavaScript snippet that enables Active on Site tracking and signup forms. You have the option to enable this tracking through your ecommerce integration or by pasting the code in your site's theme. Typically when Klaviyo’s JavaScript is enabled, the __kla_id cookie can track and identify site visitors. When not blocked, this cookie temporarily holds personally identifiable information, and once the visitor is identified (e.g., clicking a link through a Klaviyo-sent email), this cookied information is passed to Klaviyo. However, OneTrust requires additional setup steps to ensure this information is captured and then compliantly sent to Klaviyo.
In this article we will walk through the steps to ensure OneTrust is capturing visitor information appropriately and sending it to Klaviyo. Please note that you will need to complete all cookie setup steps in this guide and in the order outlined below.
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
OneTrust’s tools will automatically block cookies unless visitors have already explicitly consented via OneTrust. These tools can block cookies but also cause Klaviyo forms to stop working altogether, even forms that do not require tracking.
In order to adhere to this compliance protocol and allow certain forms to function, Klaviyo needs to be configured with OneTrust in a way that does not track events without consent. Klaviyo’s tracking includes:
- if a visitor is active on site, the site referrer URL
- if a visitor views or adds to a product to their cart (if you’ve enabled this separately)
To make consent-based tracking compatible across OneTrust and Klaviyo, as well as some sign-up form functionality continue to work, you will need to follow the steps below inside OneTrust’s CookiePro tool.
Add Your Website to CookieProAdd 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.
Configuring the Static-Tracking CookieConfiguring the Static-Tracking Cookie
In the section below we will walk through setting up your static-tracking cookie to ensure you are able to gather third-party cookies and pass these to Klaviyo.
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 Cookpedia > Categorizations in the left-hand navigation. 1
3. 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.
Configuring the Static.Klaviyo Cookie
In the section below, we will walk through setting up your static.Klaviyo cookie to ensure you are able to gather third-party cookies and pass these to 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 First-Party Cookie
In the section below we will walk through how to set up your websites or first-party cookies directly to capture the 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
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.
OutcomeOutcome
You have successfully set up your OneTrust cookie tracking software to ensure that your visitor information is captured and then compliantly sent to Klaviyo.
Additional Resources