> For the complete documentation index, see [llms.txt](https://help.littledata.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.littledata.io/integrations/shopify-klaviyo/how-it-works-shopify-to-klaviyo.md).

# How it works: Shopify to Klaviyo

The events Littledata sends to Klaviyo, the properties on each event and profile, and how consent, identity and the automatic segments work.

This page explains what Littledata sends to Klaviyo. Use it to see which events you get, which properties you can use in flows and segments, and how Littledata matches events to Klaviyo profiles.

<figure><img src="https://3956158252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QhTbrMraNWciQeDvu1b%2Fuploads%2Fgit-blob-e2ca17be263f421fa3ba49413c0e1d6cc7b22079%2Fconnection-klaviyo.png?alt=media" alt="Diagram of browser, server and metafield data flowing through Littledata to Klaviyo"><figcaption></figcaption></figure>

During the [installation](https://help.littledata.io/integrations/shopify-klaviyo/littledata-klaviyo-installation-guide), Littledata adds a tracking script to your store pages and sets up [server-side tracking for Shopify](https://help.littledata.io/get-started/how-server-side-tracking-works). Littledata then sends events to Klaviyo from its servers.

#### Events Littledata sends

All of these events are on by default. You can turn an event off in the Littledata app: find the Klaviyo card, click the **⋯** menu on its card, choose **Settings** and open the **Event Editor** tab.

| Event name                     | When it's sent                                      |
| ------------------------------ | --------------------------------------------------- |
| Viewed Product - Littledata    | A visitor views a product                           |
| Added to Cart - Littledata     | A visitor adds a product to the cart                |
| Removed from Cart - Littledata | A visitor removes a product from the cart           |
| Checkout Started - Littledata  | A customer starts checkout (sent once per checkout) |
| Placed Order - Littledata      | A customer places an order                          |

{% hint style="info" %}
Profiles created by these events carry the email address typed at checkout, which neither Shopify nor Klaviyo verifies. A flow triggered by them is often the first to email a new address, so it takes the bounce if the address is bad. See [Reducing the bounce rate from Littledata flows](https://help.littledata.io/integrations/shopify-klaviyo/reducing-bounce-rate-littledata-flows).
{% endhint %}

#### How events are matched to profiles

Littledata sends an event to Klaviyo only when it can tie it to a person. It needs at least one of these:

* the customer's email address,
* the customer's phone number, or
* the Klaviyo identifier stored in the visitor's browser (used when there's no email or phone number).

If none of these is available, the event isn't sent.

Each event also updates the Klaviyo profile with the details Littledata has: email, phone number, first and last name, and location (IP address, city, region, zip code, country and address).

#### Respecting cookie consent

Littledata's tracking works with cookie consent tools, such as [Shopify cookie banners](https://help.littledata.io/partner-recipes/cookie-consent-integrations/shopify-customer-consent-api) or [OneTrust](https://help.littledata.io/partner-recipes/cookie-consent-integrations/integrating-onetrust-shopify).

Littledata's tracking script waits for the visitor to accept tracking before it tracks browsing activity or reads the visitor's Klaviyo identifier. Consent is checked in the browser. Littledata doesn't run a separate consent check on its servers.

#### Automatic Klaviyo segments

When you finish setup, Littledata creates six segments in your Klaviyo account. They help you see how many more people Littledata tracks compared with Klaviyo's own tracking.

| Segment                   | Profiles in the segment, in the last 30 days                    |
| ------------------------- | --------------------------------------------------------------- |
| Littledata - Legacy VP    | Had Klaviyo's Viewed Product event                              |
| Littledata - Combined VP  | Had Klaviyo's Viewed Product or Viewed Product - Littledata     |
| Littledata - Legacy ATC   | Had Klaviyo's Added to Cart event                               |
| Littledata - Combined ATC | Had Klaviyo's Added to Cart or Added to Cart - Littledata       |
| Littledata - Legacy CS    | Had Klaviyo's Checkout Started event                            |
| Littledata - Combined CS  | Had Klaviyo's Checkout Started or Checkout Started - Littledata |

Compare a **Legacy** segment with its **Combined** segment to see the extra profiles Littledata adds.

#### Event properties

Prices and values use the presentment currency, which is the currency the customer saw on your store.

**Properties on every event**

| Property        | Description                                                                                 | Type   |
| --------------- | ------------------------------------------------------------------------------------------- | ------ |
| MarketID        | Shopify Market ID. Only sent when the event belongs to a Shopify Market.                    | number |
| MarketHandle    | Shopify Market handle. Only sent when the event belongs to a Shopify Market.                | string |
| Customer Locale | The visitor's browser locale, or the storefront language and country (for example `en-US`). | string |

**Viewed Product - Littledata**

This event describes one product. It has no `Items` list and no event value.

| Property           | Description                                      | Type   |
| ------------------ | ------------------------------------------------ | ------ |
| Name               | Product title                                    | string |
| ProductID          | Shopify product ID                               | string |
| Categories         | The product's collections and product type       | array  |
| ImageURL           | Product or variant image URL                     | string |
| URL                | Product URL                                      | string |
| ProductURL         | Product URL                                      | string |
| Brand              | Product vendor                                   | string |
| Price              | Product price, with currency symbol              | string |
| ItemPrice          | Product price, with currency symbol              | string |
| CompareAtPrice     | Compare-at price, with currency symbol           | string |
| SKU                | Variant SKU                                      | string |
| VariantTitle       | Variant title                                    | string |
| VariantID          | Shopify variant ID                               | string |
| $extra.line\_items | The viewed product in Shopify's line item format | array  |

**Added to Cart and Removed from Cart - Littledata**

These events include the product that was added or removed, plus the full cart.

| Property                                             | Description                                                                                                                         | Type   |
| ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------ |
| Name, ProductID, Price, SKU and other product fields | The added or removed product, with the same fields as an `Items` entry below                                                        | mixed  |
| Value                                                | Price of the added or removed product (the discounted price when there is one). This is also the event value.                       | number |
| Items                                                | Every product in the cart (see the table below)                                                                                     | array  |
| Item Count                                           | Number of products (line items) in the cart                                                                                         | number |
| Item Names                                           | Titles of the products in the cart                                                                                                  | array  |
| Total Discounts                                      | Total cart discount                                                                                                                 | string |
| CartToken                                            | Shopify cart token                                                                                                                  | string |
| CheckoutURL                                          | URL that starts checkout with this cart                                                                                             | string |
| Source Name                                          | Always `web`                                                                                                                        | string |
| $extra                                               | Cart details in Shopify's format, including `token`, `checkout_url`, `presentment_currency` and `line_items`                        | object |
| profit\_value                                        | Profit of the added or removed product. Only sent when [Profit Signal](https://help.littledata.io/sources/profit-signal) is set up. | number |

Each entry in `Items` has these fields:

| Property             | Description                                          | Type    |
| -------------------- | ---------------------------------------------------- | ------- |
| Items.Name           | Product title                                        | string  |
| Items.ProductID      | Shopify product ID                                   | string  |
| Items.Categories     | The product's collections and product type           | array   |
| Items.ImageURL       | Product image URL                                    | string  |
| Items.URL            | Product URL                                          | string  |
| Items.ProductURL     | Product URL                                          | string  |
| Items.Brand          | Product vendor                                       | string  |
| Items.Price          | Product price, with currency symbol                  | string  |
| Items.ItemPrice      | Product price, with currency symbol                  | string  |
| Items.CompareAtPrice | Compare-at price, with currency symbol               | string  |
| Items.SKU            | Variant SKU                                          | string  |
| Items.Quantity       | Quantity in the cart                                 | number  |
| Items.TotalDiscount  | Total discount on this product, with currency symbol | string  |
| Items.Discounts      | Discounts applied to this product                    | array   |
| Items.Grams          | Product weight in grams                              | number  |
| Items.Taxable        | Whether the product is taxable                       | boolean |
| Items.VariantTitle   | Variant title                                        | string  |
| Items.VariantID      | Shopify variant ID                                   | string  |
| Items.Properties     | Custom line item properties                          | object  |

**Checkout Started - Littledata**

| Property                | Description                                                                                                                                                                         | Type   |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
| $value                  | Checkout total. This is also the event value.                                                                                                                                       | number |
| Items                   | Titles of the products in the checkout                                                                                                                                              | array  |
| Collections             | Collections and product types of all products in the checkout                                                                                                                       | array  |
| Item Count              | Number of products (line items) in the checkout                                                                                                                                     | number |
| Discount Codes          | Discount codes used                                                                                                                                                                 | array  |
| Total Discounts         | Total discount                                                                                                                                                                      | string |
| Source Name             | Always `web`                                                                                                                                                                        | string |
| $extra                  | Checkout details in Shopify's format, including `token`, `checkout_url` (the abandoned checkout link), `referring_site`, `presentment_currency`, `note_attributes` and `line_items` | object |
| profit\_value           | Checkout profit. Only sent when [Profit Signal](https://help.littledata.io/sources/profit-signal) is set up.                                                                        | number |
| profit\_margin\_applied | Profit margin used for the calculation (for example `0.4` for 40%). Only sent with `profit_value`.                                                                                  | number |

**Placed Order - Littledata**

This event follows the shape of Klaviyo's built-in Shopify Placed Order event. Littledata uses the Shopify order ID as the event's unique ID, so Klaviyo doesn't count the same order twice, and the event time is the time the order was placed.

| Property                 | Description                                                                                               | Type    |
| ------------------------ | --------------------------------------------------------------------------------------------------------- | ------- |
| $value                   | Order total. This is also the event value.                                                                | number  |
| Order Type               | `REGULAR`, `FIRST_RECURRING` or `RECURRING`                                                               | string  |
| Items                    | Titles of the products in the order                                                                       | array   |
| Collections              | Collections and product types of all products in the order                                                | array   |
| Item Count               | Total quantity of products in the order                                                                   | number  |
| Discount Codes           | Discount codes used                                                                                       | array   |
| Total Discounts          | Total discount                                                                                            | string  |
| ShippingRate             | Name of the shipping method                                                                               | string  |
| Source Name              | Shopify order source, `web` by default                                                                    | string  |
| Location ID              | Shopify location ID, for orders that have one                                                             | number  |
| tags                     | Order tags                                                                                                | array   |
| OptedInToSmsOrderUpdates | Whether the customer is subscribed to SMS marketing                                                       | boolean |
| extra                    | The order in Shopify's format, including totals, `line_items`, `shipping_lines`, addresses and `customer` | object  |
| profit\_value            | Order profit. Only sent when [Profit Signal](https://help.littledata.io/sources/profit-signal) is set up. | number  |
| profit\_margin\_applied  | Profit margin used for the calculation. Only sent with `profit_value`.                                    | number  |

#### Profile properties

When an event belongs to a Shopify Market, Littledata also saves the market on the Klaviyo profile. Use these to build market-specific segments and flows, for example a different abandoned cart email for each market. This needs Shopify Markets to be active on your store, but no extra setup in Littledata.

| Profile property           | Description                             | Type   |
| -------------------------- | --------------------------------------- | ------ |
| littledata\_market\_id     | Shopify Market ID of the last event     | number |
| littledata\_market\_handle | Shopify Market handle of the last event | string |

#### Comparison with Klaviyo's anonymous visitor backfill

Klaviyo can [backfill anonymous visitor events](https://help.klaviyo.com/hc/en-us/articles/17928628922395) to a profile after the visitor is identified in the browser. In practice, that often only happens on the thank you page, after checkout is complete.

This approach has some limits compared with Littledata's integration:

* It needs Klaviyo's additional browser tracking to be turned on.
* It only works for browser (client-side) events.
* It relies on the browser's local storage to hold the anonymous events, which Safari and iOS can clear after 7 days.
* A script on the thank you page can fail to run for [many reasons](https://blog.littledata.io/2021/04/08/for-every-100-orders-in-shopify-12-go-missing/).

#### Related articles

* [Shopify to Klaviyo installation guide](https://help.littledata.io/integrations/shopify-klaviyo/littledata-klaviyo-installation-guide)
* [Set up your Klaviyo flows using Littledata's triggers](https://help.littledata.io/integrations/shopify-klaviyo/set-up-klaviyo-flows)
* [Use the Event Editor with Klaviyo](https://help.littledata.io/event-editor/use-the-event-editor-with-klaviyo)
* [Reducing the bounce rate from Littledata flows](https://help.littledata.io/integrations/shopify-klaviyo/reducing-bounce-rate-littledata-flows)
