# Control storefront surveys with consent

Choose whether website surveys wait for a visitor’s consent. Shopoll can use Shopify’s privacy settings or the choice recorded by your cookie banner.

## Set the Shopify default

Open **Privacy → Storefront consent** in the Shopoll workspace. An owner or administrator can change **Automatic surveys on Shopify** and save the setting.

| Choice | What happens on the storefront |
| --- | --- |
| Wait for visitor consent | Shopoll checks whether Shopify permits analytics. An eligible survey can appear as soon as permission changes. |
| Show surveys to everyone | Automatic surveys and visitor counters may start even when Shopify disallows analytics. An explicit decision from your own consent manager still applies. |

Shopify bases analytics permission on the visitor’s region, the store’s privacy configuration and the visitor’s choices. Review the regions in **Shopify admin → Settings → Customer privacy**. Shopoll reads that decision through the [Shopify Customer Privacy API](https://shopify.dev/docs/api/customer-privacy).

## Connect your own consent manager

On a custom storefront, set the initial state **before the Shopoll script runs**. Outside Shopify, the survey code starts at once unless your page tells it to wait for consent.

```html
<script>
  window.Shopoll = window.Shopoll || {};
  window.Shopoll.requireConsent = true;
</script>
```

In your survey, open **Install on your website**, copy the embed code for your placement and insert it after that block. Use your banner’s analytics callback to grant or withdraw permission. To handle a decision that arrives before the embed has loaded, store it on the configuration object as well.

```javascript
function updateSurveyConsent(analyticsAllowed) {
  const shopoll = window.Shopoll ||= {};
  const decision = analyticsAllowed ? 'granted' : 'denied';
  shopoll.analyticsConsent = decision;
  shopoll.consent?.(decision);
}
```

Shopoll also accepts an object with an `analytics` or `analytics_storage` field set to `'granted'` or `'denied'`. For example, call `window.Shopoll.consent({ analytics_storage: 'granted' })` when your banner records approval. Call this function both when someone gives consent and when they withdraw it. On Shopify, once your page supplies a choice, your code must keep Shopoll informed of later changes.

## Surveys chosen by ID and browser privacy choices

Code with a fixed survey ID opens the survey you chose. By default, if a page contains this kind of code, its surveys do not wait for Shopify’s automatic consent check. To make those forms wait too, set `window.Shopoll.gateEmbeds = true` before the embed loads. An explicit analytics decision or `requireConsent` applies to named embeds as well.

To treat the browser’s Global Privacy Control signal as a denial, set `window.Shopoll.respectGPC = true` before loading the embed. With this option on, the browser’s privacy choice blocks the survey even if your banner records consent. These settings apply to storefront embeds. A person following a survey link opens the survey directly.

## Verify a decision

1. Open the storefront in a fresh browser session. Call `window.Shopoll.getConsentState()` after the embed script loads. It reports `'unknown'`, `'denied'` or `'allowed'`.
2. While a gated survey waits, check that no survey frame, survey-display request or Shopoll visit counters appear. The loader script itself downloads. When Shopify disallows analytics, a policy lookup can carry the store or public workspace identifier. It omits credentials, visitor counters, and the referring page URL.
3. Grant analytics permission. A matching [live survey](/accounts/live-surveys.md) can now appear without reloading.
4. Withdraw consent. Shopoll removes active storefront placements and clears its storefront visit, session and appearance records. Responses already submitted remain in the Shopoll workspace.
