Klaviyo Web Tracking: 7 Smart Steps to Capture Data & Trigger Revenue
Most ecommerce brands install Klaviyo but never fully unlock its real power — web tracking that drives smarter segmentation, real-time automations, and higher ROI. When set up correctly, Klaviyo captures product views, add-to-cart actions, checkout events, and UTM data — turning every click, scroll, and visit into revenue-driving intelligence.
- Core web tracking events and exactly what they capture
- 3 verified ways to install klaviyo.js for your platform
- How to set up identity tracking with the Identify API
- Building high-intent behavioural segments from event data
- Triggering flows like browse abandonment with tracked events
- Debugging tracking issues fast with DevTools and the Activity Feed
- Staying GDPR and CCPA compliant without sacrificing performance
Step 1: Understand Core Klaviyo Web Tracking Events
Klaviyo’s web tracking captures on-site behaviour and ties it to customer profiles — enabling segmentation, personalisation, and automated flows like browse abandonment. All tracking is powered by the klaviyo.js script and records activity only when a visitor is identifiable to Klaviyo.
Fires when an identifiable person visits your site. Useful for real-time segments and time-sensitive flows. Requires cookie-based identification or a prior Klaviyo interaction.
Tracked automatically on Shopify when you enable the Klaviyo app embed in theme settings. Records when identifiable visitors view specific product pages — the foundation of browse abandonment flows.
Captured automatically when Shopify’s checkout begins, if the integration is connected and Track behavioural events is enabled. Powers abandoned checkout recovery flows.
Enable under Integrations → Shopify → Onsite tracking → Track behavioural events. Also activates Viewed Collection and Submitted Search tracking in the same toggle.
Captured when UTM tracking is enabled and a recipient clicks through a campaign or flow. Values like utm_source, utm_medium, and utm_campaign are saved to the profile for attribution.
Stores the first URL a contact visited on your site — useful for intent analysis and targeting visitors who arrived from specific campaigns, sale pages, or paid channels.
Known vs Anonymous Visitors
- Known visitors are identified when they click a Klaviyo email or SMS link (Klaviyo injects a
_kxcookie), submit a Klaviyo form, or you callklaviyo.identify()with their email or phone - Anonymous visitors have activity stored locally until identified — Klaviyo then links all past events to the profile if anonymous tracking and cookie consent are both enabled
Step 2: Install klaviyo.js — 3 Verified Methods
The correct installation depends on your ecommerce platform. Choose the method that matches your setup — using the wrong approach is one of the most common reasons tracking silently fails.
Install the Klaviyo app from the Shopify App Store. Enable the Klaviyo app embed in theme settings for Viewed Product tracking. Toggle on Track behavioural events for Added to Cart, Viewed Collection, and Submitted Search.
Install the Klaviyo WooCommerce plugin and connect with your API key. This embeds klaviyo.js, maps product metadata, and enables default event tracking automatically.
Use the Klaviyo for BigCommerce integration from the BigCommerce App Marketplace to auto-inject tracking code and sync store data without manual script editing.
Add the klaviyo.js snippet manually in the <head> of all pages. Replace the placeholder with your actual site ID from Klaviyo Settings → API Keys.
<script async type="text/javascript"
src="https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=YOUR_PUBLIC_API_KEY">
</script>
Step 3: Set Up Identity Tracking with the Klaviyo Identify API
Klaviyo links on-site behaviour to real customer profiles through identity tracking. Without this step, even correctly installed tracking produces anonymous data that can’t power personalised flows or segments.
Three Ways Users Become Known to Klaviyo
- Email/SMS clickthrough: Klaviyo injects a
_kxtracking cookie that identifies the browser on future visits — zero extra setup needed - Form submission: Submitting a Klaviyo popup or embedded form automatically invokes
identify()and links on-site activity to the subscriber profile - Custom identify() call: For logged-in users, gated content, or custom checkout flows — call
klaviyo.identify()with at least an email address
klaviyo.identify({
'$email': 'sarah@example.com',
'$first_name': 'Sarah',
'$last_name': 'Jones',
'Plan': 'Free Trial',
'SignUpDate': '2025-08-13',
'HasFilledOutProfile': true
});
Key Data Fields Captured by identify()
Step 4: Build High-Intent Segments from Web Tracking Data
Klaviyo’s segment engine creates dynamic, self-updating audiences based on on-site behaviour. With web tracking in place, you can target users by specific actions — or deliberate inactions — to power high-converting automations and campaigns.
Segmentation Best Practices
- Use rolling date filters like “in the last X days” to keep audiences fresh and relevant
- Combine behavioural + profile filters (e.g. “Viewed Product” AND “Country = UK”) for localised campaigns
- Add exclusions (e.g. “Has not Placed Order”) to focus segments on first-conversion and recovery
- Test AND vs OR conditions — AND yields smaller, higher-intent audiences; OR yields broader reach
Step 5: Trigger Revenue-Driving Flows with Web Tracking Events
Web tracking events unlock flows that would be impossible without behavioural data. These are the highest-ROI automations you can build once tracking is correctly configured:
- Browse Abandonment: Triggered by Viewed Product — send a personalised reminder 1–4 hours after a product view with no subsequent purchase
- Abandoned Cart: Triggered by Added to Cart or Checkout Started — recover high-intent shoppers who got distracted before completing payment
- Price Drop Alert: Triggered when a product price drops — notify users who viewed it but didn’t buy using Klaviyo’s native Price Drop flow
- Back in Stock: Triggered by Subscribed to Back in Stock — notifies waitlisted shoppers the moment inventory returns
- UTM-Based Nurture: Triggered by profile properties like
utm_source = facebook— deliver targeted follow-up sequences based on acquisition channel
Step 6: Debug Klaviyo Web Tracking Issues Fast
If events aren’t appearing or profiles aren’t being identified correctly, these four debugging steps diagnose most issues in under 10 minutes.
$email or $id to confirm identification is working correctly.window._learnq. If you see the object, klaviyo.js is loaded and functioning. If _learnq is undefined, the script isn’t loading — check your installation method.?utm_email=your@email.com to any URL on your site, then visit it. Go to Klaviyo → Profiles → your email → Activity Feed to confirm Active on Site and other events are recorded against the correct profile.Step 7: Stay GDPR & CCPA Compliant with Klaviyo Web Tracking
With GDPR, CCPA, and ePrivacy regulations tightening, Klaviyo tracking must only run after explicit user consent. Scripts like identify() and track() should never execute before the visitor agrees — in GDPR regions, this is a legal requirement, not a recommendation.
- Do not fire
identify()or load tracking cookies before consent is given - Use a CMP (OneTrust, Cookiebot) to block klaviyo.js until Accept is clicked
- Enable Data Protection Fields in Klaviyo forms to store consent as profile properties
- Allow opt-out via preferences centre or footer unsubscribe links
- Provide a “Do Not Sell or Share My Information” link for California users
- Use Klaviyo suppression segments to exclude opted-out users automatically
- Store consent as
consent_given = trueto segment and exclude by status - Keep privacy policy up to date on what’s tracked and how data is used
consent_given = true for every user who opts in. This lets you segment by consent status, exclude non-consenting users from tracking-dependent flows, and demonstrate compliance if audited.
Frequently Asked Questions About Klaviyo Web Tracking
Key Takeaways
- Install correctly for your platform: Shopify, WooCommerce, BigCommerce, custom site, or GTM — the wrong method causes silent tracking failures.
- Use identify() intentionally: Always include at least an email address and only fire after consent to properly link visitors to profiles.
- Segment smarter with events: Build dynamic audiences from Viewed Product, UTM source, and First Page URL to power targeted, high-intent flows.
- Trigger flows that convert: Browse abandonment, cart recovery, and price drop flows all depend on clean, consistent web tracking data.
- Debug with DevTools: Use the Network tab and Activity Feed to confirm events are firing and profiles are being identified correctly.
- Stay GDPR/CCPA compliant: Delay tracking scripts until users opt in and store consent as a profile property for segmentation and audit purposes.