top of page

Klaviyo Web Tracking: How to Set Up Website Activity Tracking for E-commerce

Writer: Dispatch Strategy TeamDispatch Strategy Team

Setting up web tracking with Klaviyo is a powerful way for e-commerce marketers to gain insights into customer behavior, personalize marketing campaigns, and optimize conversion strategies. Klaviyo web tracking allows you to monitor website visits, track specific actions, and trigger automated email and SMS flows based on user behavior.

This guide provides a detailed, step-by-step approach to implementing Klaviyo web tracking, along with best practices and common mistakes to avoid.

Klaviyo Web Tracking: How to Set Up Website Activity Tracking for E-commerce

Why Is Klaviyo Web Tracking Important for E-commerce Marketers?


Web tracking in Klaviyo offers several benefits:

  • Customer Behavior Insights: Understand what products and pages your visitors interact with.


  • Personalized Marketing: Trigger targeted campaigns based on browsing behavior.


  • Enhanced Automation: Automate abandoned cart emails, browse abandonment messages, and product recommendation flows.


  • Data-Driven Decisions: Use website activity data to refine your marketing strategy and improve ROI.


By tracking website activity in Klaviyo, you can create a more personalized and effective customer journey, ultimately boosting engagement and sales.


How to Set Up Web Tracking in Klaviyo: Quick Answer


To set up Klaviyo web tracking, add the Klaviyo tracking code to your website, enable onsite tracking features, and configure specific actions to trigger flows and segmentations.


Step-by-Step: How to Set Up Klaviyo Web Tracking


1. Create or Log Into Your Klaviyo Account

  • Visit www.klaviyo.com and sign in.

  • If you don’t have an account, create one using your business email and set up your profile.


2. Access the Web Tracking Setup

Navigate to the Tracking Section

  • In Klaviyo, go to Settings > Tracking & Analytics.

  • Click on Web Tracking to start the setup process.


3. Generate Your Klaviyo Tracking Code


Get Your Site ID

  • Under Web Tracking, locate your Site ID. This unique code is required to set up tracking on your website.

  • Copy the Site ID for the next step.


Generate the Embed Code

  • Klaviyo provides a JavaScript code snippet that needs to be added to your website.

  • The code should look like this:

html

CopyEdit

<script type="text/javascript"> (function () { var learnq = window.learnq || []; learnq.push(['account', 'YOURSITE_ID']); var b = document.createElement('script'); b.type = 'text/javascript'; b.async = true; b.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'a.klaviyo.com/media/js/learnq.js'; var a = document.getElementsByTagName('script')[0]; a.parentNode.insertBefore(b, a); })(); </script>

  • Replace YOUR_SITE_ID with the actual Site ID from Klaviyo.


4. Install the Tracking Code on Your Website


For Shopify Stores:

  1. Go to Online Store > Themes in Shopify.

  2. Click Edit Code on your active theme.

  3. Open theme.liquid or the footer.liquid file.

  4. Paste the Klaviyo tracking code before the closing </body> tag.

  5. Save the changes.


For WordPress or Custom Websites:

  • Add the tracking code in the header or footer section using a plugin or directly within the theme’s code files.

  • Test the integration by visiting your website and checking if Klaviyo records the visit.


5. Enable Specific Tracking Features


Viewed Product Tracking

  • In Settings > Tracking, toggle on Viewed Product Tracking.

  • This feature allows you to see which products individual visitors view, helping with personalized marketing.


Added to Cart Tracking

  • Activate Added to Cart Tracking to track when users add products to their carts.

  • This is particularly useful for triggering abandoned cart flows.


Custom Events Tracking

  • Set up custom events by using Klaviyo's API or adding event-specific tracking code to your site.

  • Example: Create a custom event for when a customer signs up for a membership or completes a specific action.


6. Test and Verify the Web Tracking


Monitor Real-Time Activity

  • Go to Analytics > Metrics in Klaviyo.

  • Check if Active on Site, Viewed Product, and Added to Cart events are being logged.


Use a Test Profile

  • Visit your website in an incognito browser and perform actions such as viewing products or adding items to the cart.

  • Check if these actions appear in Klaviyo under the Profiles and Metrics sections.


Best Practices for Klaviyo Web Tracking


1. Set Up Key Conversion Events

  • Track important actions such as:

    • Purchases Completed

    • Cart Abandonments

    • Product Page Views

    • Form Submissions


2. Create Segments Based on Web Activity

  • Build dynamic segments in Klaviyo using tracked data:

    • Customers who viewed a specific product but didn’t purchase.

    • Visitors who spent more than a certain amount of time on your site.

    • Users who repeatedly abandon their cart.


3. Automate Personalized Flows

  • Use web tracking data to trigger automations such as:

    • Abandoned Browse Emails: Nudge users back to viewed products.

    • Price Drop Alerts: Notify interested customers when prices change.

    • Behavior-Based Product Recommendations: Show related products based on browsing history.


4. Monitor and Refine Your Tracking Strategy

  • Regularly review web tracking metrics in Klaviyo to ensure accurate data collection.

  • Adjust tracking settings based on campaign performance insights.


Common Mistakes to Avoid When Setting Up Klaviyo Web Tracking


❌ Not Installing the Tracking Code Correctly

  • Double-check that the tracking code is placed in the correct section of your website’s code (before the closing </body> tag).


❌ Ignoring Test Data

  • Always test the integration to verify that Klaviyo is capturing website activity accurately.


❌ Overlooking Custom Event Opportunities

  • Many marketers only use standard events. Setting up custom events can provide more specific insights into user behavior.


❌ Not Segmenting Web Tracking Data

  • Without segmentation, it’s challenging to take full advantage of the insights provided by web tracking.


How to Use Klaviyo Web Tracking to Improve Your Marketing Strategy


  • Personalize Campaigns: Use browsing behavior to recommend products and tailor content.


  • Enhance Automation: Trigger flows based on specific website interactions.


  • Refine Segmentation: Build advanced segments to target users with personalized messages.


  • Measure Impact: Monitor how web activity influences conversions and optimize accordingly.


Conclusion: Ready to Set Up Klaviyo Web Tracking?


Klaviyo web tracking is a powerful tool for e-commerce marketers who want to better understand customer behavior and create highly personalized marketing campaigns. By setting up tracking correctly, leveraging custom events, and using tracked data for segmentation and automation, you can significantly boost your marketing effectiveness.


📩 If your email program is underperforming and you’re unsure how to optimize frequency, let’s talk.


At Dispatch, we help brands maximize revenue from email & SMS without damaging subscriber engagement.


👉 Connect with Dispatch today to optimize your email marketing strategy.

Commentaires


Find Out If You Qualify For a Free Retention Audit

get_in_touch_illustration logo
bottom of page