Skip to main content
When Tolstoy runs on a Shopify store:
  • If Shopify’s Customer Privacy API is present, Tolstoy follows Shopify’s analytics consent state.
    • Analytics will be allowed when Shopify’s analytics state is anything other than ‘no’.
    • Analytics will be blocked when Shopify’s analytics state is ‘no’.
  • If Shopify’s API is not present, Tolstoy allows analytics by default unless you explicitly default to reject (see last section).
You can programmatically reject cookies when a user doenst accept analytics cooikes policy like this: Reject Policy:

Default Reject (No Cookies Until Accept)

If you want Tolstoy to start in a rejected state until the user explicitly accepts, set the following before loading the Tolstoy widget script:
Then when a user accpets policy send this:

The Tolstoy SDK

A page that sends events with the Tolstoy SDK does not use window.tolstoyWidget. The SDK examines consent at each event, in this order:
  1. The tolstoy-cookie-policy value in localStorage: rejected blocks analytics, and accepted allows it. Your page sets this value from the consent tool of your store. On Shopify, see Shopper consent.
  2. Shopify’s Customer Privacy API, if the page already loaded it: the analytics state no blocks analytics.
  3. Cookiebot (the statistics category) and OneTrust (the performance category, C0002), after the shopper answers.
  4. Shopify’s Customer Privacy API: the analytics state yes allows analytics; otherwise its analyticsProcessingAllowed() answer decides.
  5. With no consent tool and no stored value, analytics is allowed.
The SDK does not load a consent tool and does not wait for one. When analytics is blocked, the SDK sends no event and stores no shopper ID. It drops the events from before consent; it does not send them later. To start in a rejected state with your own consent banner, set the value before the first event, and set it to accepted when the shopper accepts: