---
title: "Analytics and consent"
description: "What the SureBright SDK records about shopper interactions with the protection offer, how it honours Shopify customer privacy consent, and what is never recorded."
---

The SDK records how shoppers interact with the protection offer so the merchant portal can show offer views, plan clicks, add-to-cart with and without protection, and experiment results under **Sales**. This page is for merchants and developers who want to know exactly what is sent, when, and how consent is respected. The raw endpoint and payload are documented in [Event Collector](/frontend-widget-integration/frontend-widget-kit/event-collector).

## What is recorded

Each row is one event sent to SureBright. The wire names are the `et` values in the collector reference.

| Shopper moment | Event |
| --- | --- |
| Plans were fetched for the product on the page | `SB_FETCHED_POLICY`, once per product and variant per page view. Counts as a product view with an offer. |
| The offer rendered on the page, or a plan pop-up opened | `SB_VIEWED_POLICY`, once per surface per view. |
| The offer was actually seen: at least 50% of it on screen for one continuous second | `SB_VIEWED_POLICY_IMPRESSION`, once per surface per view. Opening the cart drawer starts a new view. |
| A plan card was selected or deselected | `SB_CLICKED_POLICY`, `SB_UNCLICKED_POLICY`. Choosing the decline card is a deselect; a selection the SDK made itself to mirror the cart is not recorded. |
| "What's covered" opened | `SB_CLICKED_LEARN_MORE`, followed by `SB_VIEWED_POLICY` for the pop-up. |
| A pop-up was closed | `SB_CLICKED_PROTECT_MY_PURCHASE`, `SB_CLICKED_NO_THANKS` or `SB_CLICKED_CLOSE_POPUP_ICON`, by how it was closed. |
| The add-protection call-to-action in the cart was used | `SB_CLICKED_ADD_WARRANTY_BUTTON`. |
| The cart page or drawer was viewed | `SB_VIEWED_CART`. |
| The shopper added a product to the cart | `ADD_TO_CART`, with the plan that went with it, or empty plan fields when none did. Sent immediately. For a bundle, one per component. |
| The cart confirmed the add | `SB_CONFIRMED_ADD_TO_CART`, when a cart read within 10 seconds shows the product quantity went up. |
| A plan was added from the product-registration page | `SB_CLICKED_ADD_TO_CART`. |
| The shopper was exposed to an experiment | `SB_VIEWED_EXPERIMENT`, on the first impression, once per experiment and treatment per browser session. |
| The SDK hit an error | `SB_ERROR`. |

Every event carries the store id, a visit id (one per browser session), platform and storefront runtime (`SHOPIFY` with `LIQUID`, `HYDROGEN` or `SHOPYFLOW`), store country, the page it came from, the time, the Shopify theme id, the cart token when known, and the configuration version that rendered the offer. Where they apply it adds the quote and plan ids, product id, variant, price and quantity, plan price and term, display currency, which term was pre-selected and which wore the ribbon, and experiment and treatment ids. Events are tagged with the SDK build (`sim-x`) and an `isBot` flag.

### What is never recorded

No customer name, email, phone, address, order number or payment detail is ever part of an event. The SDK reads none of these. The cart token and visit id are the only identifiers, and neither is tied to a person.

The following is also dropped before it is sent:

- Anything from a Shopify theme-editor preview (`Shopify.designMode`) or a SureBright design preview. These are not shoppers.
- Errors raised by crawlers. A client whose user agent names a bot, crawler or spider, or that runs under browser automation, is tagged `isBot: true`; its other events are kept, tagged, so they can be filtered.
- Events with no store id. A headless storefront that omits `data-sb-store-id` produces none; see [Headless and custom storefronts](/frontend-widget-integration/frontend-widget-kit/headless-and-custom-storefronts).

## Where events go

Events are buffered in the page and posted to SureBright's event collector in batches of up to 10, every 5 seconds, when a batch fills, or when the page is hidden or unloaded. `ADD_TO_CART` is sent at once. Events that could not be sent are kept in `sessionStorage` under `sb_analytics_pending_event_list` (at most 100) and retried on the next page in the session. From the collector they feed the **Sales** analytics in the merchant portal. The SDK sends events to SureBright only; it does not load or call any third-party analytics script.

## Consent on Shopify

On a Shopify Online Store theme the SDK follows the shopper's choice in Shopify's Customer Privacy API, the same source your cookie banner writes to.

<Steps>
  <Step title="The SDK loads Shopify's consent API">
    When the page has `Shopify.loadFeatures`, the SDK loads `consent-tracking-api` and listens for the `visitorConsentCollected` document event.
  </Step>
  <Step title="Until the choice is known, nothing is sent">
    Events are recorded into the buffer but no request leaves the page. The buffer is also saved to `sessionStorage`, so a shopper who answers the banner on a later page still gets their earlier interactions counted.
  </Step>
  <Step title="Consent given">
    If `analyticsProcessingAllowed()` is true, or the visitor's analytics consent is anything other than an explicit `no`, the buffer is flushed and recording continues normally.
  </Step>
  <Step title="Consent refused">
    The buffer is discarded, the saved copy is cleared, and the SDK records nothing further on that page.
  </Step>
</Steps>

A store that does not use Shopify's consent banner (no `Shopify.loadFeatures` on the page) is treated as allowed, which matches Shopify's own behaviour for stores with no privacy settings. On Hydrogen, Shopyflow and non-Shopify platforms the SDK has no consent source and records as soon as the shopper interacts; if your storefront runs its own consent manager and must gate SureBright, tell SureBright, since there is no public switch in the SDK today.

<Info>
Consent gates reporting only. The offer still renders, plans are still added to the cart, and cart sync still runs whatever the shopper chose. None of those depend on analytics.
</Info>

## Checking what is sent

Add `?sb_debug` to a product URL and watch for `[SB] [ANALYTICS]` lines in the console; each `track` and `flush` is logged. In the Network tab, filter on `/events/api/event` to see the batches and their `eventList` bodies. If you see `track` lines but no requests on a Shopify store, the consent API has not yet reported a choice; answer the banner and the batch will leave.

If your storefront renders the offer with its own UI, or runs where the SDK cannot see the interaction, you have to send these events yourself; the field list, the minimum set that makes a store visible in Sales, and a worked example are in [Event Collector](/frontend-widget-integration/frontend-widget-kit/event-collector).
