# Shopify checkout

A Shopify theme's install snippet cannot see the checkout.
Kontala's Shopify pixel, pasted into the store's Customer events, counts its carts, checkouts and orders, line by line.

## Before you start

- Install the [website tag](/docs/data-capture/install-the-website-tag) in your theme as well.
The pixel continues the visits the tag starts, so each order lands in the right visit.
- Turn on **Clicks** for the property.
An add to cart is only counted when the tag saw the click that made it.

## Add the pixel

1. In Kontala, open the property and find the **Shopify Checkout** card.
2. In the Shopify admin, open **Settings**, then **Customer events**, and add a custom pixel named Kontala.
3. Under **Customer privacy**, set **Permission** to **Required**, with analytics as its purpose.
4. Copy the code from the Shopify Checkout card, paste it in place of what the Code window holds, choose **Save**, then **Connect**.
5. Back in Kontala, turn on **Accept carts, checkouts and orders**.

The code looks like this, with your property's key in it:

```js
// Kontala: sends this store's checkout steps and purchases to Kontala.
// Paste it as a custom pixel under Settings > Customer events; nothing in it
// needs editing. It loads the pixel from Kontala, so it never goes stale.
(function (k) {
  k.v = 1;
  k.analytics = analytics;
  k.browser = browser;
  k.init = init;
  k.api = typeof api === 'undefined' ? undefined : api;
  analytics.subscribe('all_standard_events', function (event) {
    k.q.push(event);
  });
  var s = document.createElement('script');
  s.async = true;
  s.src = "https://konta.la/v1/shopify-pixel.js?k=pk_live_...";
  (document.head || document.documentElement).appendChild(s);
})((window.kontala = window.kontala || { q: [] }));
```

It loads the pixel from Kontala, so you only need to paste it again if the key changes.

## What it captures

| In Shopify | In Kontala |
| --- | --- |
| Cart viewed | the cart page's view |
| Product added to or removed from cart | the Add to cart or Remove from cart click |
| Checkout started | a Checkout page view |
| Contact, address, shipping and payment submitted | the four checkout step clicks |
| Checkout completed | an Order confirmation page view and the order |

Each order carries its id, currency, value, subtotal, tax, shipping, discount, whether it was the customer's first order, its lines and its payments.
The pixel also sends the buyer's contact details: email, phone, name and addresses.
An order is counted once, however many times its confirmation page is seen.

If **Friction** is on too, checkout alerts and checkout extension errors appear as struggle signals.

## Where to see it

The Carts, Checkout and Items explores, and the Conversion dashboard.

## Consent

The pixel follows the store's Shopify customer privacy settings.
With **Permission** set to **Required**, it only sends for visitors who allowed analytics.
