To use Osano's Cookie Consent on a Shopify store, you install Osano in your theme and connect it to Shopify's Customer Privacy API. The API connection is what lets Osano control Shopify's own cookies, scripts, and Pixels. Without it, Osano cannot govern Shopify-controlled content.
You will need:
An Osano account with a published configuration. Plans are at osano.com/plans.
A published privacy policy in Shopify. Shopify requires this before any cookie banner can be used. Set it at Settings > Customer privacy > Privacy policy.
The Osano CMP Shopify app, only if you are installing in checkout. For a storefront-only install you do not need it.
Step | Where |
|---|---|
1. Create and publish your Osano configuration | Osano |
2. Add | Shopify theme code editor |
3. Configure Shopify's privacy settings | Shopify admin |
4. Connect the Customer Privacy API | Shopify theme code editor |
5. Install in checkout (optional) | Shopify checkout and accounts editor |
6. Verify | Browser console |
Steps 1 through 4 are required for every install. Step 5 applies only if you need consent enforced in checkout.
In Osano, go to the Cookie Consent tab and create a new configuration.
Fill in:
Name. An internal identifier.
Domain. Your root domain only. If you own example.com but your store is at www.example.com, enter example.com. Osano covers subdomains automatically.
Policy Link URL. The full URL of your privacy policy.
Click Create Configuration.
Publish the configuration.
Click Get Code and copy your osano.js script tag.
Your script URL looks like this:
<https://cmp.osano.com/{customer_id}/{configuration_id}/osano.js>
Value | What it is |
|---|---|
| The first string of numbers. Unique to your organization, and identical across every configuration in your account. |
| The second string of numbers. Unique to each configuration you create. |
Keep both. You will need them again in Step 5 if you are installing in checkout.
osano.js to your themeThis covers your storefront outside of checkout.
From your Shopify admin, go to Online Store > Themes.
Next to the theme you want to edit, click the ⋯ icon (three horizontal dots), then click Edit code.
In the file list, open the Layout folder and click theme.liquid.
Find the <head> section. Some themes use a variation such as {head}, [header], or [head].
Paste your osano.js script tag inside <head>, before every other <script> on the page.
Click Save.
Osano must load first. If any other script loads ahead of it, Osano cannot block that script before it runs, and cookies may be set before the visitor consents.
You can now manage your banner's appearance and behavior at my.osano.com.
Notes
Editing theme.liquid is one way to add the code. You can also use a Shopify app that injects custom code into the header. Whichever method you use, Osano must still load before other scripts.
The Osano CMP Shopify app does not add osano.js to your storefront. It provides the checkout extension only, so this step is required whether or not the app is installed.
Two things happen here. You remove Shopify's own cookie banner so it does not compete with Osano's, and you tell Shopify which regions require consent before it collects data.
Go to Settings > Customer privacy. You will see the Privacy settings section listing Privacy policy, Cookie banner, and Data sharing opt out page.
Click Cookie banner.
With automated settings on, the page shows a Regions and content section containing a single Use automated settings toggle. Shopify keeps regions and content in sync with its own recommendations, which means it will show its banner in regions it decides require one.
Turn Use automated settings off.
Two Edit rows appear underneath, Regions and Content. You do not need to configure either one, but the toggle must be off before Shopify will let you remove the banner.
With automated settings off, click More actions. The menu now offers Remove cookie banner.
Click Remove cookie banner. Shopify confirms with a dialog that describes exactly this scenario:
The cookie banner will be removed from your store. Make sure that you've set up an app to show a cookie banner in the regions that require it. Automated settings will be turned off.
Click Remove. This is the action that stops Shopify's banner.
After removal, the Cookie banner page may change shape entirely. The Regions and content section is gone, replaced by Visibility and Regions. You may also see the same screen but with new options under the More Actions menu such as 'Set custom banner regions'.
The Regions section controls where Shopify requires consent before collecting customer data. Click Edit to change it.
Select every region in which you do business. Shopify gates its own data collection on consent only in the regions selected here. Leaving a region out means Shopify does not wait for the consent Osano gathered there.
Click Save.
Note: Do not click "Set up banner." The Visibility section offers a Set up banner option. That recreates Shopify's own banner, not Osano’s.
Shopify's framework does not let Osano control Shopify Pixels directly. Consent has to pass through Shopify's Customer Privacy API, which is what this step sets up.
Go to Online Store > Themes.
Click the ⋯ icon next to your theme, then Edit code.
Right-click the Snippets folder and select New file. If your editor shows an Add a new snippet link, you can use that instead.
Name the snippet osano-shopify.
Paste this into the editor, in full:
<script>
window.Shopify.loadFeatures([{
name: "consent-tracking-api",
version: "0.1"
}], function (error) {
if (!error) {
try {
window.Osano.cm.ready("shopify");
} catch (error) {
console.error("Osano must be loaded before initializing the Shopify API.");
}
}
});
</script>
Click Save.
In the Layout folder, open theme.liquid.
Scroll to the closing </body> tag.
Paste this immediately before it:
{% render 'osano-shopify' %}Click Save.
Osano can now pass privacy choices to Shopify, which applies them to Shopify-controlled content including Shopify cookies, scripts, and Pixels.
Osano | Shopify |
|---|---|
Personalization | Preferences |
Marketing | Marketing |
Analytics | Analytics |
Do Not Sell | Sale of Data |
Skip this step if you do not need consent enforced in checkout.
Shopify Plus Plan requirement. Availability depends on your Shopify plan and on where in checkout the Osano block is placed. Shopify restricts apps on the information, shipping, and payment pages to Shopify Plus. Confirm coverage for your plan with your Shopify representative.
Install the Osano Cookie Consent app from the Shopify App Store.
Go to Settings > Checkout.
In the Configurations section, click Edit next to the configuration you want to customize. The checkout and accounts editor opens.
Use the page selector at the top to choose the page you want the banner on.
Click the Sections icon in the left sidebar.
Click ⊕ Add block in the section where Osano should appear.
Select Osano CMP (Checkout).
In the block settings, enter:
Account ID = your {customer_id}
Configuration ID = your {configuration_id}
Click Save.
You can also add the block from the Apps sidebar: click the Apps icon, click ⊕ next to Osano CMP (Checkout), then choose the page.
Shopify supports multiple checkout configurations, including drafts and per-market configurations on Advanced and Plus plans.
Add the Osano block to every configuration you intend to publish. A configuration without the block runs checkout with no consent enforcement, and Shopify does not warn you. Re-check this whenever you create a new configuration or duplicate an existing one.
This is easy to miss because it usually works when you test it. If you test in one market and the block is missing from another market's configuration, consent silently fails only for customers in that other market.
Do this before you consider the install finished.
Open your storefront home page and set a consent preference in the Osano banner.
Go to checkout.
Change your consent preferences at checkout and save.
Go back to your storefront home page.
Open your browser's developer tools and run this in the console:
window.Shopify.customerPrivacy.currentVisitorConsent();Confirm the returned values match your consent choices
An Accept All response looks like this:
{marketing: 'yes', analytics: 'yes', preferences: 'yes', sale_of_data: 'yes'}Value | Meaning |
|---|---|
| The visitor granted consent |
| The visitor declined consent |
| The visitor has not chosen yet |
If the values do not match what you set, or the call returns an error, see the Shopify and Osano Troubleshooting Guide.
Why am I seeing two cookie banners?
Shopify's automated privacy settings are still on. See Step 3a.
Does Osano support Google Consent Mode?
Yes. Google Consent Mode may also be required for events added through Shopify custom pixels to fire correctly, because Google's "additional consent required" triggers can gate subsequent tags. For Shopify Pixels specifically, the Customer Privacy API must be connected per Step 4.
Does Osano work with custom pixels?
Osano reads consent and passes it to the Shopify Customer Privacy API, and Shopify Pixels respond to that signal. Shopify owns pixel and custom pixel functionality end to end. If a custom pixel misbehaves after consent is passing correctly, that is a Shopify support issue.
Why do some Shopify cookies still load after consent is revoked?_shopify_y, _shopify_s, and _landing_page always load because of Shopify framework restrictions. They are outside Osano's control, and Shopify determines their persistence and session length.
I am using a custom or headless storefront. Does this apply?
Partly. You must install the Customer Privacy API on your custom storefront directly so Osano can pass consent across both storefront and checkout. See Shopify's custom storefront installation guidance.
Do I need the Osano CMP Shopify app?
Only for the checkout install. A storefront-only install does not need it, and installing it does not add osano.js to your storefront.