Events and Purchases

How the Sophi Shopify app tracks storefront events and purchases — the events it sends, the purchase pixel Sophi creates, how Shopify consent controls both, and how guest and logged-in shoppers are recognised.

Sophi uses shopper behaviour to recommend better and to show you what the assistant is worth: which chats led to carts and orders. On Shopify, the app sends the same events as the web object, with no code on your side.

ShopifyYour storefrontPage, product and listing views; cart page; cart changes; checkout start
storefront events · analytics consent
SophiSophi analyticsWhich chats led to carts
ShopifyShopify checkoutOrder completed (no theme code runs here)
purchase · web pixel · analytics consent
SophiSophi analyticsWhich chats led to orders
ShopifyLogged-in customerShopify customer id, first and last name
identity · preferences consent
SophiSame Sophi shopperChat history and memory on every device

Storefront events

Switch on Send storefront events to Sophi in the Sophi assistant embed (Connection). The app then sends:

EventWhen
page_viewAny page
product_viewA product page
listing_viewA collection or search results page
basket_viewThe cart page
add_to_cart / remove_from_cartThe cart changed — from the theme's buttons, the cart drawer or the chat
checkout_startedThe shopper went to checkout

Cart changes are worked out by comparing the cart before and after, so a change counts once whether the theme or the chat made it.

Purchases

Shopify's checkout runs no theme code, so purchases come from a web pixel: the sophi-pixel extension deployed with the app. When an order is completed it sends one purchase event with the order id, totals (tax, shipping, discounts and discount code) and the order lines, joined to the same shopper as the chat.

Web pixels have no theme-editor screen; an app creates its pixel through Shopify's Admin API. Sophi creates it for you with your app's credentials, after the app is installed. Afterwards it is listed in your admin under Settings → Customer events.

Running it yourself

The app code includes the script Sophi uses. It reads the credentials from the environment, never prints them, and only reports what it would do unless you pass --apply. Running it again updates the existing pixel instead of creating a second one.

SHOPIFY_STORE=your-store.myshopify.com \
SHOPIFY_CLIENT_ID=… SHOPIFY_CLIENT_SECRET=… \
SOPHI_API_KEY=… SOPHI_API_URL=https://api.usesophi.com \
node scripts/pixel.mjs            # report only; add --apply to create it

The app reads Shopify's Customer Privacy API — the choices the shopper made in your cookie banner — before it starts anything, and fails closed: if consent is unknown, it acts as if it was refused.

Shopper allowsWhat happens
NothingThe chat works, anonymously: no cookies, no customer id or name, no visited pages. No events.
PreferencesThe chat remembers the shopper (Sophi cookies), greets a logged-in customer by name, and uses the pages they visited for context.
AnalyticsStorefront events are sent; for them the tracker also keeps Sophi's session cookies and a cart snapshot in local storage. Shopify runs the purchase pixel (it is declared analytics-only, so Shopify itself skips it otherwise).

One functional exception: when a shopper clicks a Sophi chip in Full page mode, the question (and the product, from a product box) travels to the chat page in its address (?sophi_q=…, ?sophi_product=…). The chat page asks it once, removes it from the address, and uses a one-time token in session storage to make sure only questions the shopper clicked are asked. Mention in your privacy notice that these questions can appear in page addresses, like search terms do.

Consent is whatever Shopify reports for the shopper, so it follows your cookie banner and your Customer privacy settings in the Shopify admin.

Shopper identity

  • Guests get an anonymous Sophi session, kept in first-party cookies on your domain (with preferences consent for the chat, or analytics consent for events). The chat, the events and the purchase pixel all share it, so a purchase is linked to the chat that led to it.
  • Logged-in customers are recognised by their Shopify customer id, so they get the same chat history and memory on every device. The app sends their first and last name, and nothing else about them.
  • Logging in links the guest session to the customer; their earlier guest chats move to their account. Logging out starts a new guest session.

On this page