Understand Klaviyo's anonymous visitor activity backfill
You will learn
Learn about anonymous visitor activity backfilling and how to capture shoppers’ onsite engagements before they are identified.
Before you begin
By default, Klaviyo’s web tracking supports:
- Active on Site tracking
This metric is tracked whenever an identifiable browser visits your website. - Viewed Product tracking
This metric is tracked whenever an identifiable browser views a product page on your website (for ecommerce stores).
Active on Site can help you identify and segment profiles that are visiting your site, while Viewed Product tracking can enable you to send customers reminders in a browse abandonment flow.
Note that some integrations do not have Viewed Product tracking installed automatically.
Anonymous visitor activity backfill
With Klaviyo’s anonymous visitor activity backfill, you can capture onsite activity for a shopper prior to identification. Once that visitor is identified in the same browser, you’ll have access to the historical onsite events still stored there. This gives you a more complete view of your customers’ journeys, including activity before they were identified through Klaviyo’s web tracking.
The anonymous activity backfill only captures and sets historical events on a profile and other historical information like Source will not be captured by this feature.
How does anonymous visitor backfill work
With anonymous visitor activity backfill enabled, Klaviyo stores an unidentified visitor’s onsite events in their browser’s local storage under kl-post-identification-sync. This is a local storage entry, not a cookie. Once the visitor is identified in that browser, the stored events are sent to their profile with their original timestamps. Browser settings and available storage affect how long the events remain available.
Make sure Klaviyo.js is installed and your site’s consent settings allow tracking before testing. If your consent tool blocks Klaviyo until a visitor opts in, activity before that opt-in cannot be backfilled.
Anonymous backfill will be triggered when:
- A visitor submits a Klaviyo sign-up form that identifies them
- A visitor clicks a link in a Klaviyo message
- A visitor is identified using Klaviyo’s Identify API
- A visitor enters contact information or makes a purchase on a supported ecommerce platform
Checkout identification depends on your ecommerce platform and tracking setup:
E-Commerce Platform | Supported |
Shopify | |
WooCommerce | ✅ |
BigCommerce | ⚠️ - Requires a custom script installed on your checkout page(s) |
Magento 2 | ⚠️ - Requires validation |
Salesforce Commerce Cloud | ⚠️ - After version 23.7.0 |
Prestashop | ✅ |
Wix | ❌ |
Custom and other e-commerce platforms | Requires custom script installation |
If you use BigCommerce, a Magento 2 version that does not identify visitors at checkout, or a custom ecommerce platform, add an identification script to your checkout page. The example below identifies a shopper when they leave the email field or click the submit or order button. Load Klaviyo.js first, replace the selectors with ones that match your checkout, and run the script only when your site’s consent settings allow tracking. If your checkout adds these fields dynamically, attach the listeners after the fields appear.
function setUpCheckoutIdentification() {
// Replace these selectors with the fields used by your checkout.
const emailSelectors = [
"input[id='email']",
"input[name='email']",
"input[placeholder='Email']",
"input[type='email']"
];
const submitSelectors = [
"input[id='submit']",
"input[name='submit']",
"input[type='submit']",
"button[type='submit']"
];
const emailField = document.querySelector(emailSelectors.join(","));
const submitButton = document.querySelector(submitSelectors.join(","));
if (!emailField) return;
function identifyVisitor() {
const email = emailField.value.trim();
if (!email || !window.klaviyo) return;
window.klaviyo.identify({ email }).catch(console.error);
}
emailField.addEventListener("blur", identifyVisitor);
if (submitButton) {
submitButton.addEventListener("click", identifyVisitor);
}
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", setUpCheckoutIdentification);
} else {
setUpCheckoutIdentification();
}Testing anonymous visitor backfill
To verify that anonymous visitor historical backfill is working, you can take the following steps:
Make sure that front-end events, such as Viewed Product, are triggering successfully before testing. Follow the onsite tracking test instructions.
Testing the capture of anonymous activity on your site
- Open your website in a new private browsing session that allows local storage. Accept any required tracking consent, then view a product page to generate a Viewed Product event. Keep this session open until you finish the test.
- Open the developer console on your browser and navigate to local storage. This may be on the developer console’s Storage or Application tab depending on your browser.

- Find
kl-post-identification-syncin your site’s local storage. Verify that its events match the actions you took while anonymous, and note their timestamps. - After confirming that data is being stored in the browser, add ?utm_email=example@gmail.com to the end of your website URL, replacing example@gmail.com with a test email address. If the URL already contains a question mark, use &utm_email= instead. Put the parameter before any # fragment, then reload the page. This identifies the browser based on the email address you provide.
- Search for the email address in Klaviyo.
You should see a profile matching the email address you supplied, with an activity timeline corresponding to the actions you took while anonymous. Check that the events have their original timestamps and that the local storage entry contains no remaining queued events. The entry can remain as an empty array ([]).
Testing anonymous visitor backfill from checkout
- Close the private session used for the previous test, then open your website in a new private session that allows local storage. Accept any required tracking consent and view a product page. Keep this session open through checkout.
- Add a product to your cart and start checkout
- Enter a test email address and the required contact information.
- Place an order
- Search for the email address in Klaviyo.
You should see a profile matching the email address you supplied, with an activity timeline corresponding to the actions you took while anonymous. Check that the events have their original timestamps and that the local storage entry contains no remaining queued events. The entry can remain as an empty array ([]).
Frequently asked questions
Can I disable anonymous visitor activity backfill?
To disable anonymous visitor activity backfill:
- Click your account name in the lower-left corner of Klaviyo, then select Settings.
- Select Data. On the Tracking page, clear Anonymous backfill under Onsite identification.
- Click Save and wait for the confirmation that your changes have been saved.

Klaviyo’s standard web tracking
For onsite events to appear on a shopper’s Klaviyo profile, they must be identified. This is done through Klaviyo’s JavaScript, which sets a cookie that allows for the tracking and identification of site visitors through an auto-generated ID when they:
- Fill out a Klaviyo signup form
- Click a link from a Klaviyo message
This cookie can temporarily hold personally identifiable information and lasts for up to 2 years.
The Klaviyo cookie can contain a browser identifier before the shopper is identified. Anonymous visitor activity backfill stores its queued events separately in local storage.
How Klaviyo collects onsite data for anonymous visitors
To collect onsite data for anonymous visitors, Klaviyo records data about a visitor's actions as they occur and stores that locally in their browser. In the future when that visitor is identified, that data is then sent to Klaviyo and cleared from the browser. Any future onsite activity will be tracked as usual through the Klaviyo cookie once they have been identified as well.
To store data in the browser, the shopper’s browser must support setting items in local storage.
See a list of browsers that support writing data into local storage.
If browser privacy settings or a consent tool prevent Klaviyo from running or writing to local storage, anonymous events cannot be captured. Private browsing alone does not always prevent capture, but its local storage is cleared when the last private tab is closed.
What events are included in post-identification syncing?
Only client-side events, also known as front-end events, are captured through Klaviyo’s web tracking for both identified and anonymous visitors. These events are captured through Klaviyo's main onsite tracking snippet, known as Klaviyo.js.
Some common events include:
- Active on Site - All integrations
- Viewed Product - Most e-commerce integrations
- Added to Cart - Most e-commerce integrations
However, any events recorded onsite via klaviyo.track() are also included in anonymous activity backfill.
Note that some integrations may use server-side events for these. For example, the Added to Cart event on Magento 2 is sent server-side.
How many events can be stored in local storage?
The number of events depends on their size and the browser’s available local storage. If storage is full, Klaviyo removes the oldest queued events until the remaining events fit.
Why use local storage for data storage over cookies?
Cookies are less robust compared to local storage. For example, cookies have an expiration date and a maximum size of about 4KB. Local storage can hold 5 MB on average (depending on the browser).
Safari can delete a site’s local storage after 7 days of Safari use without interaction with that site.
Are there any GDPR or privacy concerns?
Anonymous visitor activity backfill stores onsite events and their event properties in the browser’s local storage until the browser is identified and the events are sent. The stored events are then cleared.
Until it is cleared, data in local storage is accessible to any on-website JavaScript. This can pose a privacy concern if you send certain types of sensitive data through front-end events. For sensitive data, Klaviyo recommends only sending the data via server-side requests, or only after a browser is identified.
Does anonymous visitor activity backfill work with a cookie consent tool?
If your store uses a cookie consent tool (e.g., OneTrust), configure it to control Klaviyo’s tracking according to your consent requirements. When that tool blocks Klaviyo until a shopper opts in, Klaviyo cannot capture anonymous activity before the opt-in.
Do anonymous visitors trigger flows?
Once an anonymous visitor is identified, their backfilled events can trigger metric-triggered flows if the profile qualifies and the events are still eligible for the flow’s timing. Flow timing uses the event’s original timestamp, so identifying a visitor does not restart the flow’s time delays. Older events can appear on a profile without triggering a flow.
Additional resources
- 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:
- Troubleshooting viewed product tracking
Learn how to troubleshoot issues with your Viewed Product tracking, which is used to track when visitors view products on your site. For some ecommerce platforms, Viewed Product is tracked automatically when you integrate with Klaviyo. For other ecommerce platforms, a snippet must be manually added to your product page template.
- 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.