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 beginBefore 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 segment you identify 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 backfillAnonymous 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 future, you’ll then have access to their historical onsite events. This allows you to have a more complete view of your customers’ journeys, regardless of when they are 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 workHow does anonymous visitor backfill work
When a site visitor has consented to analytics and marketing cookies and has not been identified, Klaviyo will track their site activity in their browser’s local storage for up to 14 days under a client side cookie ‘kl-post-identification-sync’. Once the site visitor is identified, all events stored in the cookie will be pushed to Klaviyo for that profile.
Anonymous backfill will be triggered when:
- After submitting consent through a form
- Clicking on a link in a Klaviyo message
- Identified using Klaviyo’s Identify API
- Contact information has been entered or a purchase has been made on most e-commerce platforms
By default, Klaviyo supports identification via checkout on most e-commerce platforms:
E-Commerce Platform | Supported |
Shopify | ✅ When Shopify additional tracking is enabled |
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 are using BigCommerce, some versions of Magento 2, custom, or other e-commerce platforms the following script needs to be installed on your checkout page if you want to trigger anonymous visitor backfill when a customer makes a purchase on your site:
window.onload = function() {Testing anonymous visitor backfill
// For grabbing the email right after it's entered
// Add the field that contains the customer's email address to this list
const emailSelectors = [
"input[id='email']",
"input[name='email']",
"input[placeholder='Email']",
"input[type='email']"
]
document.querySelector(emailSelectors.join(",")).addEventListener('blur', function() {
klaviyo.identify({"email" : this.value}).then(() => console.log("Identified"))
});
};
window.onload = function() {
// For grabbing the email when the submit/order button is pressed
// Add the field that contains the customer's email address to this list
const emailSelectors = [
"input[id='email']",
"input[name='email']",
"input[placeholder='Email']",
"input[type='email']"
]
// Add the purchase or complete transaction button to this list
const submitSelectors = [
"input[id='submit']",
"input[name='submit']",
"input[type='submit']"
]
document.querySelector(submitSelectors.join(",")).addEventListener('click', function() {
klaviyo.identify({
"email" : document.querySelector(emailSelectors.join(",")).value
}).then(() => console.log("Identified"))
});
};
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 prior to testing, details can be found here.
Testing the capture of anonymous activity on your site
- Navigate to your website in a private window and take an onsite action like Viewed Product.
-
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.
- Verify that the key and values set in the browser match the actions you took while anonymous. Note the timestamp of the data.
- 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 and reload the page. This will identify 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 that you supplied, with an activity timeline corresponding to the actions you took while anonymous. Ensure that the key and values in your local storage have been cleared out, and that the events have made their way into your Klaviyo account with the correct timestamps.
Testing anonymous visitor backfill from checkoutTesting anonymous visitor backfill from checkout
- Navigate to your website in a private window and take an onsite action like Viewed Product.
- Add a product to your cart and start checkout
- Enter your contact information
- Place an order
- Search for the email address in Klaviyo.
You should see a profile matching the email address that you supplied, with an activity timeline corresponding to the actions you took while anonymous. Ensure that the key and values in your local storage have been cleared out, and that the events have made their way into your Klaviyo account with the correct timestamps.
Frequently asked questions
Frequently asked questions
Can I disable anonymous visitor activity backfill?Can I disable anonymous visitor activity backfill?
To disable anonymous visitor activity backfill:
- Navigate to Account > Settings in the bottom left corner in Klaviyo.
- On the Data tab in your account settings, uncheck the Enable anonymous visitor tracking box.
- Select the Update button.
Klaviyo’s standard web tracking
In order for Klaviyo to track a shopper’s onsite activity by default, 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 two years.
The Klaviyo cookie is only used for web tracking after a shopper has been identified and does not store data for anonymous visitors.
How Klaviyo collects onsite data for anonymous visitorsHow 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.
Note that if a site visitor is using any type of cookie-blocking (e.g, incognito in Chrome or private browsing in Safari) Klaviyo cannot record and recover anonymous events.
What events are included in post-identification syncing?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?How many events can be stored in local storage?
There is a 5MB limit imposed by a browser’s local storage, allowing for up to 10,000 events.
Why use local storage for data storage over cookies?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 has a 7 day expiration policy for local storage.
Are there any GDPR or privacy concerns?
Anonymous visitor activity backfill uses a browser's local storage to store data sent as a profile property or event until the browser is identified (after which the local data is 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?Does anonymous visitor activity backfill work with a cookie consent tool?
If your store uses a cookie consent tool (e.g., OneTrust), the shopper would need to opt-in for anonymous activity to be captured. Without access, Klaviyo will not be able to write data to the browser’s local storage.
Do anonymous visitors trigger flows?Do anonymous visitors trigger flows?
Once an anonymous visitor is identified through Klaviyo's standard web tracking, they will trigger flows as long as they qualify and have not exceeded time delays.
Additional resources