How it works: Shopify to Klaviyo

Updated on 2024-07-18

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, loaded via Littledata's app embed in your Shopify theme
  • 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 Viewed Product, Added to Cart and Checkout Started event.

note:

All events are sent in presentment currency. This means that the value is adjusted accordingly, to the currency it was shown to the customer

Items.NameProduct namestring
Items.ProductIDProduct IDstring
Items.CollectionsCategories of the product, selected from product types and collections.string
Items.ImageURLThe URL of the product imagestring
Items.URLThe current URLstring
Items.ProductURLURL of the productstring
Items.BrandProduct brandstring
Items.FulfillmentServiceType of fulifllmentstring
Items.TaxLines *If the product has tax linesobject
Items.PresentmentTitleTitle of the product in presentment languagestring
Items.PresentmentVariantTitleTitle of the variant in presentment languagestring
Items.PriceProduct price at the moment of the trigger.string
Items.ItemPricePrice of the Itemstring
Items.CompareAtPriceOriginal price of the product in case of a sale.string
Items.SKUProduct SKUstring
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 Count *Number of products inside the cartstring
Discount CodesDiscounts codes usedobject
Total Discounts *Array of total discountsarray
Source Name *Name of the sourcestring
extra.token *Shopify checkout tokenstring
extra.webhook_topic *Type of webhookstring
extra.responsive_checkout_url *URL of the checkoutstring
extra.referring_site *URL of the storestring
extra.checkout_url *URL of the checkoutstring
extra.full_landing_site *URL of the storestring
extra.presentment_currency *Currency code of the presentment currencystring
extra.note_attributes.nameName of note attributestring
extra.note_attributes.valueValue of note attributestring
extra.line_items.fulfillment_service *Type of fulfillment servicestring
extra.line_items.presentment_title *Title of the item in presentmentstring
extra.line_items.presentment_variant_title *Title of the variant in presentmentstring
extra.line_items.tax_linesTypes of tax for the productarray
extra.line_items.compare_at_price *Original price of the productstring
extra.line_items.applied_discounts *Discounts applied for the productstring
extra.line_items.key *Shopify variant ID assigned to the productstring
extra.line_items.gift_card *If a gift card was used for the productboolean
extra.line_items.gramsWeight of the productnumber
extra.line_items.origin_location_id *Id for the location of the POS devicestring
extra.line_items.destination_location_id *Id for the destination of the order placed by the POS devicestring
extra.line_items.product_idShopify product ID assigned to the productstring
extra.line_items.quantityQuantity of the productnumber
extra.line_items.skuProduct SKUstring
extra.line_items.taxableIf the product is taxable or notboolean
extra.line_items.titleTitle of the productstring
extra.line_items.user_idThe id of the user, if logged innumber
extra.line_items.variant_idId of the variantstring
extra.line_items.variant_titleTitle of the variantstring
extra.line_items.variant_pricePrice of the variantnumber
extra.line_items.vendorBrand of the variantstring
extra.line_items.line_priceTotal value of products of the same kind (price x quantity)number
extra.line_items.pricePrice of the productnumber
extra.line_items.properties *Custom properties of the product.array
extra.line_items.requires_shippingIf the product requires shipping or notboolean
extra.line_items.rank *Position of the image shown on the storenumber
extra.line_items.unit_price_measurement.measured_type*Type of unit measurementstring
extra.line_items.unit_price_measurement.quantity_value*Value of the unit measurementstring
extra.line_items.unit_price_measurement.quantity_unit*Quantity of the unit measurementstring
extra.line_items.unit_price_measurement.reference_value*Base reference for the unit of measurementstring
extra.line_items.unit_price_measurement.reference_unit*Measurement unitstring
extra.line_items.product.idShopify product ID assigned to the productstring
extra.line_items.product.titleTitle of the product found in URLstring
extra.line_items.product.handleName of the product used in URLstring
extra.line_items.product.vendorBrand of the productstring
extra.line_items.product.tagsTags of the productstring
extra.line_items.product.body_htmlRaw HTML of the product descriptionstring
extra.line_items.product.product_typeType of the productstring
extra.line_items.product.properties *Properties of the productarray
extra.line_items.product.images.idObject containing images detailsobject
extra.line_items.product.images.product_idShopify ID of the imagestring
extra.line_items.product.images.positionPosition of the image shown on the storenumber
extra.line_items.product.images.created_atTimestamp for the creation of the imagetimestamp
extra.line_items.product.images.updated_atTimestamp for the latest update of the imagetimestamp
extra.line_items.product.images.altUsed by visually imparied individuals to describe the imagestring
extra.line_items.product.images.widthWidth of the imagestring
extra.line_items.product.images.heightHeight of the imagestring
extra.line_items.product.images.srcURL of the picturestring
extra.line_items.product.images.variant_idsShopify product ID assigned to the productstring
extra.line_items.product.images.admin_graphql_api_idIdentifier for GraphQL operations of the imagestring
extra.line_items.product.images.thumb_srcURL of the thumbnail of the product imagestring
extra.line_items.product.variant.idId of the product variantobject
extra.line_items.product.variant.skuSKU assigned to the product variantstring
extra.line_items.product.variant.titleTitle assigned to the product variantstring
extra.line_items.product.variant.options.TitleArray of options for the product variantarray
extra.line_items.product.variant.imagesArray of images for the product variantarray
extra.line_items.product.variant_options.TitleAdditional array of options for the product variantarray
$valueTotal value of the cartnumber

Fields marked with * are only present for Added to Cart - Littledata & Checkout Started - Littledata events.

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.

Automated Klaviyo Segments

After you finish your setup, Littledata will automatically create 6 segments for you to use and see the benefits of our app.

Those 6 segments are called Legacy and Combined and contain the following events: Viewed Product, Added To Card and Checkout started.

Littledata Segments in klaviyo

Legacy segments contain Klaviyo events, while Combined segments contain Klaviyo and Littledata events, thus you can see how many more customers Littledata has tracked for you, on top of Klaviyo's basic 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