Control storefront surveys with consent
On a Shopify storefront, Shopoll waits for Shopify to allow analytics before displaying a survey or recording visits. This applies to automatic surveys, surveys selected by ID and surveys opened by a custom button. A shopper’s refusal or withdrawal also blocks surveys when a separate cookie banner reports approval. Granting permission can start an eligible survey without reloading the page.
Shopify uses the visitor’s region, the store’s settings and the visitor’s choices to determine permission. Manage these regions in Shopify admin → Settings → Customer privacy. Shopify Customer Privacy API.
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.
<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.
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
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
- Open the storefront in a fresh browser session. Call
window.Shopoll.getConsentState()after the embed script loads. It reports'unknown','denied'or'allowed'. - While a gated survey waits, check that no survey frame, survey-display request or Shopoll visit counters appear. The loader script itself downloads.
- Grant analytics permission. A matching live survey can now appear without reloading.
- Withdraw consent. Shopoll removes active storefront placements and clears its storefront visit, session and appearance records. Responses already submitted remain in the Shopoll workspace.