How it works: Shopify to Klaviyo

Updated on 2024-04-08

Littledata’s connection to Klaviyo gives brands more identifiable event data about customer behavior, with enhanced accuracy in tracking pre-purchase customer events.

In addition to syncing events with Klaviyo, Littledata automatically integrates with Shopify sites to capture customer touch-points, including sales, marketing, customer, and product performance data.

Client-side (browser) tracking

During the automatic installation process, Littledata adds a data layer and tracking script to all the store pages.

  • A minified tracking script, hosted on a content delivery network (CDN) is loaded asynchronously by Shopify in the <head> of each page
  • Klaviyo, Google, Facebook, and Shopify cookies are passed to Littledata's servers to ensure consistent user journey tracking

Server-side tracking

Littledata also adds a set of webhooks to your Shopify store. This means that each time a user changes the cart or checkout state our servers can relay that event to Klaviyo.

There are many advantages to this approach:

  • 100% accurate tracking of events
  • Smaller script in the browser = faster page load
  • No scripts are loaded on the sensitive and secure checkout pages
  • Persistent identity for users
  • Data security and spam reduction: only authorized servers can feed into your data stream

Server-side tracking is a more accurate way to track actions and attribute them to Klaviyo profiles. In situations where Klaviyo’s tracking script might be blocked by ad blockers or iOS / Safari restrictions, Klaviyo’s server-side Events API can still track events.

Server-side events are linked to a Klaviyo profile in the same way as web events sent via Klaviyo’s tracking script.

What you can track

Here’s what you can track with Littledata’s Klaviyo integration for Shopify. All the events listed below are tracked by default. You can turn events off within the app settings.

Server-side events

Event nameDescription
Added to Cart - LittledataWhen a user adds an item to the cart
Removed from Cart - LittledataWhen a user removes an item from the cart
Viewed Product - LittledataWhen a user views a product
Checkout Started - LittledataWhen the user first enters the checkout page on a session

Event properties

The cart events designed to be backwards compatible with both the standard Added to Cart and Checkout Started events from Shopify.

tip:

Read the full event schema for Klaviyo here.

One major improvement over the Klaviyo standard event schema is the including of the full contents of the cart (Items) with the Added to Cart event.

NameProduct namestring
ProductIDProduct IDstring
CategoriesCategory of the productstring
ImageURLThe URL of the product imagestring
URLProduct URLstring
BrandProduct brandstring
PriceProduct price at the moment of the trigger.string
CompareAtPriceOriginal price of the product in case of a sale.string
SKUProduct SKUstring
QuantityProduct quantitynumber
TotalDiscountTotal amount of discountstring
DiscountsArray of all applied discountsarray
GramsProduct weight in gramsnumber
TaxableProduct is taxable or notboolean
VariantTitleProduct variant namestring
VariantIdProduct variant IDstring
PropertiesArray of custom properties set for the itemarray
CheckoutUrlThe URL of the checkout pagestring
CartTokenShopify cart tokenstring
ItemsCurrent products inside of the cartarray
Items.NameProduct namestring
Items.ProductIDProduct IDstring
Items.CategoriesCategory of the productarray
Items.ImageURLThe URL of the product imageobject
Items.URLProduct URLstring
Items.BrandProduct brandstring
Items.PriceProduct price at the moment of the trigger.string
Items.CompareAtPriceOriginal price of the product in case of a sale.string
Items.SKUSKU assigned to the productstring
Items.QuantityProduct quantitynumber
Items.TotalDiscountTotal amount of discountstring
Items.DiscountsArray of all applied discountsarray
Items.GramsProduct weight in gramsnumber
Items.TaxableProduct is taxable or notboolean
Items.VariantTitleProduct variant namestring
Items.VariantIdProduct variant IDstring
Items.PropertiesArray of custom properties set for the itemarray
Item CountTotal count of different items in the cart (not summed quantity)number
Total DiscountsSum of total discounts in the cart (from applied coupons)string
Source NameSource of the eventstring
ValueTotal value of the cartnumber
extraExtra product details found in the checkout webhookobject
extra.tokenShopify checkout tokenstring
extra.webhook_topicType of webhookstring
extra.responsive_checkout_urlURL of the checkoutstring
extra.checkout_urlURL of the checkoutstring
extra.presentment_currencyCurrency code of the presentment currencystring
extra.line_itemsContents of the cart or checkoutstring
$valueTotal value of the cartnumber

User identity from web sessions

Littledata can infer the identity of a visitor on your site with an identity graph that uses several cookie identifiers (from Google, Meta, Klaviyo and Shopify).

One of these is the _kx parameter, used by Klavyio specifically to recognize users who click on an email or SMS link. 

We have a complex logic on our servers that allows us to identify the user by many different identifiers, to make sure the identity resolution is as complete as possible.

Littledata’s tracking is compatible with cookie consent (eg. Shopify cookie banners or OneTrust), and so the solution is GDPR compliant.

Littledata does not send events from their browser session to Klaviyo until the user has opted into tracking.

Comparison with Anonymous visitor activity backfill

Klaviyo CDP includes a feature to backfill anonymous visitor events to a Klaviyo profile after the user is identified in the browser. In practice, it is only on the Thank You page, after the checkout is completed, that the backfill script can run.

There are a few limitations of this approach compared with Littledata’s integration:

  • Requires opting into the additional tracking via Klaviyo
  • Only works for client-side events
  • Only backfills Added to Cart events if that event trigger is set up
  • Relies on browser's local storage to queue up the anonymous visitor events, which is wiped after 7 days in Safari / iOS
  • There are many reasons a script on the thank you page might not fire - see our post on what goes wrong