---
updatedAt: 2025-04-15T22:34:23.000Z
agentTools:
  projectIndex: https://docs.logrocket.com/llms.txt
---

# Shopify Capture (Custom Pixel)

How to capture additional data from your Shopify site

> ❗️ Deprecated
>
> The Custom Pixel approach to integrating LogRocket into Shopify stores documented here is no longer supported. The supported method for integrating LogRocket into Shopify is to use our [Shopify App](https://docs.logrocket.com/docs/shopify-capture-app).

## Step 1 - add the LogRocket snippet to your Shopify theme

Follow the [Quickstart](https://docs.logrocket.com/docs/quickstart) instructions and add the LogRocket Script Tag or NPM package into your Shopify site.

We recommend adding code similar to this into your `theme.liquid` template to identify the customer when they create an account with your store:

```javascript
  var customerOrders = {{ customer.orders | json }} || [];
  var customerData = {
    id: "{{ customer.id }}",
    email: "{{ customer.email }}",
    name: "{{ customer.name }}",
    phone: "{{ customer.phone }}",
    totalSpent: "{{ customer.total_spent | money }}",
    customerOrders: customerOrders.length,
  };
  
  if (customerData.id !== '') {
    window.LogRocket && window.LogRocket.identify(customerData.id, customerData);
  }
```

## Step 2 - add the LogRocket custom pixel

Shopify limits the ability for scripts to run during the checkout pages. Instead, they make it possible to capture some events from the checkout process for tracking user behavior on these pages. To enable this capture, follow these steps:

1. From the Shopify admin, search for "Pixels"
2. Click "Add custom pixel"
3. Name your pixel "LogRocket event capture"
4. Choose the following options

<Image align="center" src="https://files.readme.io/f35747522981745b8173159369a1c9ffac7e654350d59f73a8ac983786836d70-Screenshot_2024-10-07_at_10.22.24_AM.png" />

5. Update the Code section with the following code, replacing `APP_ID` with the same APP\_ID from Step 1:

```javascript javasc
var s = document.createElement('script');
s.src = 'https://cdn.lrkt-in.com/shopify-pixel.min.js';
document.head.appendChild(s);

s.onload = () => {
  LogRocketShopify.init(APP_ID, {
    analytics: analytics,
    browser: browser,
    
    // if you are using rootHostname to join multiple subdomains, ensure that you set that in your options
    // rootHostname: 'domain.com'
  });
};
```

6. Click the "Save" button and then "Connect".