Guide to Klaviyo Onsite Tracking

read
Last updated at:

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
    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 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. 

The code snippet for Active on Site is known as Klaviyo’s onsite JavaScript, or “Klaviyo.js”. You do not need to add Klaviyo.js separately if you enabled Active on Site tracking through one of the ecommerce integrations below:

  • Shopify
    Active on Site tracking is added automatically through the integration or through the Klaviyo app embed if its toggled on 
  • BigCommerce
    Active on Site tracking is added when you integrate if you check the setting Automatically add Klaviyo onsite JavaScript in Klaviyo
  • WooCommerce
    Active on Site tracking is added automatically when you integrate
  • Magento
    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 is unable to 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 Active on Site Tracking Manually

  1. Copy the following Active on Site code snippet, also known as Klaviyo.js:
<script type="text/javascript" async="" src="https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=API_KEY"></script>
  1. Navigate to Account > Settings > API Keys and note your Public API Key.
  2. 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.
  3. 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.

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 tracking is installed, a Viewed Product 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:

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 to adding viewed product tracking for custom ecommerce stores.

Test Onsite Tracking

After enabling tracking on your site, you can test that tracking is set up properly by following these steps:

  1. Navigate to your website
  2. Add the following to the end of your store url, replacing example@gmail.com with your email address:
    ?utm_email=example@gmail.com
  3. 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.

Your main dashboard view in Klaviyo, and if you click over in on Data Feed you will be presented with real time user data

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 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 and engaged at least once before. Klaviyo will not track anonymous browsers.

An example of a subscriber profile when they have engaged with your website before, as Klaviyo does not track anonymous browsers

There are three key ways Klaviyo will be able to identify a site visitor for onsite 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 onsite activity. Over time, Klaviyo will identify more and more of your contact-base and your onsite 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.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:

http://example.com/?_kx=J8fjcn003Wy6b-3ILNlOyZXabW6dcFwTyeuxrowMers%3D.McN66

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.

Additional Resources

x
Was this article helpful?
847 out of 1245 found this helpful