2.0 Beta

Smootify 2.0 is in public beta. Your 1.x store keeps working. Move when you want.

What changed

Cookie consent

Build the cookie banner and the preferences panel in Webflow with smootify-consent, over Shopify's Customer Privacy API, and let visitors reopen it from a preferences button.

v2.0 beta
Open .md1.x page ↗
On this page
  1. How it fits together
  2. 1. Build the banner
  3. 2. Add the preferences panel
  4. 3. Let visitors change their mind
  5. Style and placement
  6. What follows the choice
  7. The analytics proxy
  8. Before you publish
  9. Coming from 1.x

In regions with privacy laws, such as the EU and the UK, visitors must agree before a site tracks them. Every site needs the banner in Webflow, even one that does not sell in Europe: it shows only to the visitors who have to answer, and stays hidden for everyone else. Smootify does not add one: you design it in Webflow, like any other part of the site. The visitor’s choice is saved with Shopify’s Customer Privacy API, so the checkout, Shopify’s analytics and the pixels Smootify loads all follow it.

Note

Before you start, turn on consent collection in Shopify: in the Shopify admin, open Settings › Customer privacy, then Cookie banner, activate it and choose the regions where visitors must answer. Shopify decides where consent is needed from these settings, and your Webflow banner shows only in those regions, and only to visitors who have not answered yet. Shopify’s own banner does not show on the Webflow site: only the one you build here.

How it fits together

What Smootify needs:

  • one smootify-consent element on every page. A visitor can arrive on any page, so put it in a Component that every page uses, such as the footer;
  • inside it, the buttons that accept and decline, and a button that opens the preferences;
  • a preferences panel, where the visitor chooses category by category;
  • a preferences button, so the visitor can change their choice at any time.

Visitors must always be able to choose their preferences, not only accept or decline everything, so the panel and the button are part of every banner.

It works on any domain, your .webflow.io address included: Smootify asks Shopify for the visitor’s region on the first visit and keeps the answer on your domain.

What is up to you: the text, the layout and where it sits (a bar at the bottom, a box in a corner).

One Component for all of it. The simplest setup puts everything in one smootify-consent, in the footer Component: the preferences button, and the banner and the preferences panel in a popover. The button stays in the footer; the popover is fixed where you want the banner, for example at the bottom of the window, not next to the button: it opens by itself at the top of the page too.

Example structure of the Navigator
smootify-consentCustom Element
buttonCustom Elementdata-is=preferences-buttonpopovertarget=consent
Text“Cookie preferences”
Div Blockid=consentpopover
Text Block“…”consent-panel=banner
Text Block“…”consent-panel=preferences

Without a preferences button inside it, Smootify shows the element only while the visitor has to answer, or while the preferences panel is open, and hides it the rest of the time. With the button inside, the element stays in the page with only the button wherever consent applies: keep the banner’s text and buttons inside the popover or a consent-panel, since everything else in the element stays visible with the button. Smootify adds no other style: position the banner yourself. In the Designer it is always visible.

1. Build the banner

Add a Custom element with the tag smootify-consent. Put your text and the buttons inside it. Each button is a Webflow Button, or a Custom element with the tag button, with the custom attribute data-action:

data-action="accept"

Accept everything

Answer
Every category accepted.
Banner
Closes.
data-action="decline"

Decline everything

Answer
Every category declined.
Banner
Closes.
data-action="preferences"

Choose by category

Answer
None yet: the visitor answers in the panel (step 2).
Banner
Shows the preferences panel.
data-action="close"

Close without answering

Answer
None. Nothing that needs consent loads.
Banner
Hidden for this page. It shows again on the next page.
Example structure of the Navigator
smootify-consentCustom Element
Text Block“We use cookies to measure the site and to show relevant ads.”
Button“Accept all”data-action=accept
Button“Decline”data-action=decline
Button“Preferences”data-action=preferences

2. Add the preferences panel

The preferences panel lets visitors choose category by category. Every banner needs it. Inside smootify-consent, make two Div blocks:

  • one with consent-panel="banner", holding the first message and its buttons, including data-action="preferences". It hides while the preferences are open;
  • one with consent-panel="preferences". It shows only while the preferences are open.

Webflow keeps Checkboxes inside a Form Block, so put a Form Block in the preferences panel. In each Checkbox’s settings, set its Name to one of these:

Name: analytics

Measuring the site

Allows
Measuring the site, such as Google Analytics and Shopify's reports.
Without it
Save declines it.
Name: marketing

Advertising

Allows
Advertising, such as the Meta, Google Ads and TikTok pixels.
Without it
Save declines it.
Name: preferences

Remembering settings

Allows
Remembering their settings on the site.
Without it
Save declines it.
Name: sale_of_data

The sale of data

Allows
The sale or sharing of their data, under US privacy laws.
Without it
Save leaves it as it was.
Shows
Inside an element with consent-condition="sale-of-data": only in those regions.

Then add a button with data-action="save". The Form Block only holds the Checkboxes: the form is never sent.

Example structure of the Navigator
Div Blockconsent-panel=preferences
Form Block
Form
Field Label
CheckboxName “analytics”
Text Span“Analytics”class=w-form-label
Field Label
CheckboxName “marketing”
Text Span“Marketing”class=w-form-label
Field Label
CheckboxName “preferences”
Text Span“Preferences”class=w-form-label
Div Blockconsent-condition=sale-of-data
Field Label
CheckboxName “sale_of_data”
Text Span“Allow the sale of my data”class=w-form-label
Button“Save my choices”data-action=save
Success Message
Text Block“Saved”
Error Message
Text Block“Something went wrong”
  • Checked means yes. When the panel opens, each Checkbox shows the visitor’s current choice. Write every label so that checked means “allowed”: “Allow the sale of my data”, not “Do not sell my data”.
  • Save saves the checked boxes and closes the banner. Add a Checkbox for each of analytics, marketing and preferences: a missing one counts as declined.

3. Let visitors change their mind

Visitors must be able to change their choice later, as easily as they made it. Add a Custom element with the tag button and the custom attribute data-is="preferences-button", inside smootify-consent as above or anywhere else, for example in the footer. A click opens the preferences panel.

Example structure of the Navigator
buttonCustom Elementdata-is=preferences-button
Text“Cookie preferences”
  • It needs the banner. Without a smootify-consent on the same page, Smootify removes the button.
  • It needs the button tag. A Webflow Button publishes a link, and does nothing here.
  • It hides while the banner is on screen, and shows again once the visitor has answered.
  • It shows only where consent applies: where Shopify asks for consent, where the visitor has already answered, and in regions with the sale-of-data choice, such as California, where it is the “Do not sell or share” link those laws ask for. Elsewhere it is hidden, and so is a smootify-consent that holds it, without leaving a gap. It also stays hidden until Shopify has answered. Smootify marks the button and the element with is-applicable when it applies.

Style and placement

The banner goes through these states. Style them with the classes, as combo classes:

is-required

The visitor has to answer

Banner
Shows.
Body
cookie-banner-visible
Preferences button
Hidden.
is-open

The preferences are open

Panels
consent-panel="banner" hides, consent-panel="preferences" shows.
Body
cookie-banner-visible
No class

The visitor has answered

Banner
Hidden.
Preferences button
Shows. A click opens the preferences.
No class

No consent needed in the region

Banner
Never shows.
Preferences button
Shows, and opens the preferences, for example to refuse the sale of data.
  • More classes. smootify-consent also gets is-sale-of-data-region in regions with the sale-of-data choice, and is-applicable where consent applies. Use cookie-banner-visible on the body, for example, to move a chat button up while the banner shows. See state classes.
  • In a popover. A popover inside smootify-consent, made with Webflow’s Popover element or a Div block with the popover attribute, opens and closes with the banner. Escape or a click outside closes it and hides the banner for this page, without an answer. See Popovers.
  • The market suggestion waits until the banner is closed before it shows: see Market suggestion.

The full list of attributes is in the Reference: consent attributes and smootify-consent.

What follows the choice

  • The pixels Smootify loads: the Meta Pixel, Google Analytics 4, Google Ads and the TikTok Pixel, each with the category it needs. See Analytics and pixels.
  • Shopify’s analytics: page views and additions to the cart reach your store’s reports once the visitor allows analytics. Visits and returning visitors need the analytics proxy: see below.
  • Webflow Analyze follows the visitor’s choice.
  • The checkout receives the same choice from Shopify.
  • Your own scripts: a developer reads the choice with the JavaScript API and the consent_changed event.

The analytics proxy

Shopify no longer reads the shopify_y and shopify_s cookies that a site sets in the browser. It now gives the visitor and session tokens from its own server, in a response header, and a site on another domain gets them through a small proxy. Without it, Shopify’s reports cannot tell a new visit from a returning visitor. Smootify calls the proxy once per visit, only after the visitor allows analytics, and never on your .webflow.io address.

  • Server plan: Smootify’s own proxy does it. There is nothing to set up.
  • Free and Lite plans: deploy the free proxy on your own Cloudflare account, with one click.
  1. Open shopify-headless-proxy and click Deploy to Cloudflare. Log in to Cloudflare and confirm. You get an address such as https://shopify-headless-proxy.your-account.workers.dev.
  2. In Webflow, go to Site settings › Custom code and paste this in Head code, before the Smootify loader, with your address followed by /_cks:
<script>
  window.smootifyCksEndpoint = "https://shopify-headless-proxy.your-account.workers.dev/_cks";
</script>

The proxy needs no domain or DNS change, and one call per visit stays well within Cloudflare’s free plan. To accept calls only from your site, set its ALLOWED_ORIGIN variable to your domain, such as https://www.example.com, in the Cloudflare dashboard.

The same proxy can also open the panel of Shopify’s chat, if you add it: see Shopify Inbox chat.

Before you publish

On your .webflow.io address, turn on Smootify’s debugger with Alt⇧ ShiftD (⌥ Option⇧ ShiftD on a Mac). It points out analytics ids set on a page without smootify-consent, and CSS that still uses the 1.x body class. See The debugger.

Check these first

  • The banner always shows, even after an answer. Smootify’s stylesheet is missing, and it is the stylesheet that hides the banner. Add data-css="true" to the loader: see Install Smootify 2.0.
  • The banner never shows. Consent collection is off in Shopify (Settings › Customer privacy › Cookie banner), so Shopify asks for consent nowhere. Or the store does not ask for it in the visitor’s region, the visitor already answered, or your own styles hide the element. Smootify only hides it: it never shows what your styles hide.
  • The preferences button disappears. The page has no smootify-consent: put the banner in a Component that every page uses. Or consent does not apply in the visitor’s region, and the button is hidden on purpose.
  • The preferences button does nothing. It is a Webflow Button, which is a link. Use a Custom element with the tag button.
  • Save declines a category the visitor never saw. A category without its Checkbox counts as declined. Add a Checkbox for each of analytics, marketing and preferences.
  • The banner comes back on the next page. The visitor closed it with data-action="close", or closed its popover from outside. That hides it for one page, without an answer.

Coming from 1.x

  • 2.0 no longer loads Shopify’s cookie banner. Its appearance settings in Shopify, the #shopify-pc__… selectors and its CSS variables no longer apply. A site that relied on that banner has none until you add smootify-consent.
  • The body class is-shopify-cookie-banner-visible is now cookie-banner-visible: rename it in your styles.
  • button[data-is="preferences-button"] keeps working, and opens your new banner.

    ↑ ↓ to moveEnter to openEsc to close