You will learn
Learn about the different ways that Klaviyo can support onsite tracking on your ecommerce site. There are two key types of onsite tracking:
- 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 your contacts based on engagement level, while Viewed Product tracking can enable you to send customers reminders in a browse abandonment flow.
Before you begin
Enabling onsite tracking is different for each ecommerce integration. In this article, you will learn how to do this and who Klaviyo tracks.
Active on Site tracking is added automatically through the integration or through the Klaviyo app embed if its toggled on.
Active on Site tracking is added automatically when you integrate.
Active on Site tracking is added automatically when you integrate.
If you are using another ecommerce platform, or a custom platform, you can install Klaviyo.js manually.
Because pasting this code requires access to your site's HTML and ecommerce platform, our support team cannot offer hands-on assistance. If you don't have a developer resource on your team and aren't comfortable adding the code, consider reaching out to a Klaviyo partner for assistance.
Add onsite tracking manually
- Copy the following Active on Site code snippet, also known as Klaviyo.js:
- In Klaviyo, click your account name in the lower left corner and navigate to Settings > API Keys, then note your Public API Key.
- Paste the code snippet in the main template of your site. Where you see PUBLIC_API_KEY in the snippet, replace this with your key.
- Save and publish your site template.
Now that you've installed Active on Site tracking, Klaviyo will track whenever an identifiable person visits your website.
Understanding Viewed Product tracking
Viewed Product tracking in Klaviyo is specifically designed for ecommerce stores, and can enable you to send customers reminders in a browse abandonment flow. Once Viewed Product is installed, a metric will be recorded whenever an identifiable person views a product page on your website.
Enabling 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.
Learn how to enable Viewed Product tracking for these ecommerce platforms:
Enable Viewed Product tracking through the Klaviyo app embed in Shopify.
Learn how to add viewed product tracking to your BigCommerce store.
Viewed Product tracking is automatically installed through 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 detailing how to add Viewed Product tracking for custom ecommerce stores.
Test your onsite tracking
After enabling tracking on 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.
- To see a feed of all tracked activity for the Active on Site and Viewed Product metrics, navigate to Analytics > Metrics. You can click on each metric to analyze tracked data through an activity feed, activity map, charts, best people, and cohort reports. You can also filter by source. Filter by API to see active on site and viewed product events (these events have a gear icon).
Who Klaviyo tracks
By enabling basic onsite 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 onsite tracking to your site, we only track the browsing activity of "known browsers" — i.e. browsers that have visited, engaged, and been identified (or "cookied"), at least once before. Klaviyo will not track anonymous browsers.
There are three key ways Klaviyo will identify a site visitor for onsite tracking:
- 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 tracking installed.
As a result, until you send emails with Klaviyo and grow your lists, you probably won't see a lot of tracked onsite activity. Over time, Klaviyo will identify more and more of your contact-base and your onsite tracking data will become more comprehensive.
Examples of how to use onsite tracking
Ways to use onsite tracking 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.js on your website, Klaviyo 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 Active on Site 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 when live emails are sent and should not impact the load times of your links or break any links based on its placement. Note that when previewing an email, the _kx parameter will display with as ?_kx= with no value appended.
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.
You've now learned how to enable Klaviyo onsite tracking on your ecommerce platform, which is comprised of Active on Site and Viewed Product tracking.