Learn about the different ways that Klaviyo can support web tracking on your ecommerce site. There are two key types of web tracking:
- Active on Site
This metric is tracked whenever an identifiable browser visits your website.
- Viewed Product
This metric is tracked whenever an identifiable browser views a product page on your website (for ecommerce stores).
Active on Site tracking can help you do things like segment your contacts based on engagement level, while Viewed Product tracking can enable you to send customers reminders in a browse abandonment flow.
To enable web tracking, all you have to do is copy short snippets of code to your site. In this article, you will learn how to do this and who Klaviyo tracks once you do.
The code snippet for Active on Site is also known as Klaviyo.js. You do not need to add Klaviyo.js separately if you enabled it through one of the ecommerce integrations that install it automatically, which are:
Because pasting this code requires access to your site's HTML and ecommerce platform, our support team is unable offer hands-on assistance. If you don't have a developer on your team and aren't comfortable adding the code yourself, consider reaching out to a Klaviyo partner for assistance.
Web Tracking Video
Add Active on Site Tracking
1. Copy the following "Active on Site" code snippet, also known as "Klaviyo.js":
2. Add the code snippet to the main template of your site. Where you see Public API Key, you will need to replace this with your Klaviyo account's public API Key. To find your public API Key, navigate to Account > Settings > API Keys.
3. Save and publish your site template.
Now that you've installed the Active on Site code snippet, Klaviyo will track whenever an identifiable browser visits your website.
Viewed Product Tracking
Viewed product tracking in Klaviyo is specifically designed for ecommerce stores. When product page tracking is installed, a Viewed Product metric will be tracked whenever an identifiable browser views a product page on your website. Installation of viewed product tracking is different for each ecommerce platform. If you are not seeing data captured from this metric, double-check that it's installed correctly.
View our guides on how to install viewed product code snippets for these ecommerce platforms:
- Guide to adding viewed product tracking for Shopify
- Guide to adding viewed product tracking for BigCommerce
Viewed Product tracking is automatically installed during these ecommerce integrations:
Viewed product tracking can also be added to other ecommerce platforms and custom carts. For instructions on how to do this, head to our guide to adding viewed product tracking for custom ecommerce stores.
Viewed product tracking is most often leveraged to trigger a browse abandonment flow. If you are not seeing any data captured from this metric, double-check that it's installed correctly.
Test Web Tracking
After adding the relevant code snippets to your site, you can test that tracking is set up properly by following these steps:
- Navigate to your website
- Add the following to the end of your store url, replacing email@example.com with your email address:
- After you reload the page, search in Klaviyo for your email address
You should see that a Klaviyo profile has been created for you (if one didn't exist already) and that this site visit has been tracked on your activity feed.
Over time, to see a live feed of all tracked activity for the Active on Site and Viewed Product metrics, when you navigate to the Activity Feed on your dashboard. Here, you can filter for the metric of your choice by clicking into the dropdown menu next to Showing Feed for.
You can also navigate to the Analytics tab of your account and click on each metric to analyze tracked data through an activity feed, activity map, charts, best people, and cohort reports.
Who Klaviyo Tracks
By enabling basic web tracking on your website, you can collect helpful information around browsing activity that can be leveraged to take your owned marketing and business analytics to the next level.
When you add Klaviyo's web tracking snippet(s) to your site, we only track the browsing activity of "known browsers" — i.e. browsers that have visited and engaged at least once before. Klaviyo will not track anonymous browsers.
There are three key ways Klaviyo will be able to identify a site visitor for web tracking purposes:
- If someone has, at some point, clicked through a Klaviyo email to your website
- If someone has, at some point, subscribed/opted-in through a Klaviyo form
- If someone has, at some point, logged into your site and you have identify tracking installed
As a result, until you start sending emails with Klaviyo and growing your lists, you probably won't see a lot of tracked web activity. Over time, Klaviyo will identify more and more of your contact-base and your web tracking data will become more comprehensive.
Leveraging Active on Site Tracking
Ways to leverage Active on Site include:
- Segment your contacts based on engagement level
By gaining insight into which contacts interact with your website and how often, you can build a more personal communication strategy that drives deeper engagement.
- Trigger an automated flow email to those that browse several times without purchasing
While you don't want to send someone an email every time they visit your website, you might want to send a light touchpoint to those who visit several times in a short period of time but don't engage further. For example, you can trigger a flow to those who have been Active on Site at least 4 times in the last 30 days, but haven't started or completed a checkout.
The _ kx Parameter
When you have email to website tracking enabled and have Klaviyo's main web tracking snippet on your website, we will identify individuals who click through a Klaviyo email and then end up browsing your website. This is one of the main ways Klaviyo is able to identify new site visitors and cookie them so they get identified during all future visits to your page.
The way Klaviyo's email to website tracking works, we add an additional parameter to all URLs in your email. This is the _kx parameter. The unique encrypted value is then decrypted by our web tracking snippet and allows us to identify the user that clicked through the URL. See the example link below for an idea of how this will look in the URL:
This parameter is automatically appended and should not impact the load times of your links nor break any links based on its placement.
However, if you use URLs that contain query parameters to inform your server to automatically download a file, the _kx parameter could cause your link to break. In order for the download to function properly, either toggle off email to website tracking in your account email settings or configure your server to ignore this parameter. As of now, you can only toggle this off across your account; you cannot turn it off for individual campaigns.