Consentl on Wix
Add Consentl as Wix custom code, route tracking through Marketing Integrations, pass each choice to Wix's Consent Policy Manager and learn the limits on Wix.
- Loader first in <head>
- No — read the limitations
Can the loader be first in <head>? No. Wix does not document where Head custom code is placed
relative to its own runtime (Thunderbolt) scripts, so treat Consentl as not first and read the
Limitations before you install it. Wix is the most restricted platform in these
guides.
Requirements
- A Premium plan with a connected domain. Custom code only runs on a published site with a connected domain, and snippets are tied to the domain: they are deleted if the primary domain changes.
- Your Consentl site key, on your site's Setup page in the dashboard. Add the site's hostname in
the Domains field;
www.and the bare domain count as the same site, so there is no need to addwww.separately.
What your Consentl plan covers
- Free: banner, consent log and manual blocking only.
- Pro: adds Google Consent Mode v2.
- Business: adds automatic blocking of known trackers and the blocking rules you add in the dashboard.
On Free and Pro, only tags you mark manually are held back. On Wix, the tags most sites care about (Google Analytics, GTM, Meta and TikTok pixels) are loaded by Wix itself; see How Wix gates tracking.
Install
In the Wix dashboard, go to Settings → Custom Code (in Development & integrations; older dashboards list it under Advanced).
Click + Add Custom Code and paste:
<script src="https://api.consentl.com/v1/loader.js?k=SITE_KEY&l=en"></script>Name:
Consentl.Add Code to Pages: All pages → Load once (Default option). Wix sites navigate like single-page apps; client-side navigation does not lose the banner. Do not choose Reload on every page, which would inject the loader again on every navigation, and keep the loader URL identical on every page.
Place Code in: Head.
Code Type tab: keep Essential. Consentl is the consent tool itself and must load before consent; any other category (Marketing, Analytics, Functional) would make Wix hold it back until Wix's own consent policy allows that category.
Click Apply, then publish the site.
Turn off Wix's own cookie banner: Settings → Privacy & Cookies → Cookie banner (provided by Usercentrics on current dashboards). Only one consent banner may be active.
Optional: add a "Cookie settings" link. Links whose URL ends in
#consentlor#consentl-preferences, and any element with the attributedata-consentl-open, open the preferences.
How Wix gates tracking
Wix states that "tracking scripts for Google Analytics, Google Tag Manager, and Facebook & TikTok pixels don't work through custom code". Connect them through Wix Marketing Integrations instead. Wix then loads them itself and gates them by its own consent policy, which Consentl cannot block directly.
Forward the choice to Wix
To make those tags follow Consentl, add a second custom code snippet below the loader (Head, All pages, Load once (Default option), Essential). It forwards the current Consentl choice, and every later change, to Wix's Consent Policy Manager:
<script>
(function () {
function toWix(c) {
var m = window.consentPolicyManager;
if (!c || !m || !m.setConsentPolicy) return;
m.setConsentPolicy({
functional: !!c.preferences,
analytics: !!c.analytics,
advertising: !!c.marketing,
dataToThirdParty: !!c.sale
});
}
function now() {
if (window.Consentl) toWix(window.Consentl.get());
}
document.addEventListener("consentl:change", function (e) { toWix(e.detail); });
if (window.consentPolicyManager) now();
else window.addEventListener("consentPolicyManagerReady", now, { once: true });
})();
</script>
| Consentl | Wix policy key | Wix Code Type |
|---|---|---|
| (necessary) | essential |
Essential |
preferences |
functional |
Functional |
analytics |
analytics |
Analytics |
marketing |
advertising |
Marketing |
sale |
dataToThirdParty |
none |
essential is always true on Wix, and Wix applies a policy change from the next page load.
If the GTM container you connect through Marketing Integrations uses the
Consentl GTM template, add &gcm=ext to the loader URL
(…loader.js?k=SITE_KEY&l=en&gcm=ext) so that only the template sends Consent Mode commands.
Other third-party custom code (not the tags above) can be given the matching Code Type; Wix then holds it according to the forwarded policy, from the next page load. If you keep such code Essential instead, mark it manually as described in the web guide so that Consentl holds it.
Check that it works
Test on the live domain in a private window. Custom code does not run in the Editor or Preview.
The visitor's region comes from their IP address: Consentl looks up the country in memory on each page view (nothing is stored) and applies your dashboard rule for it. US states are not told apart: US visitors get your rule for the whole US or, without one, your first US-state rule. An unknown country gets your rule for unknown regions (opt-in by default).
Limitations
First page view with native integrations. Unless Wix's own banner or a Wix consent app changes it, a site's default Wix consent policy is "everything allowed". Custom code cannot change that default, and a forwarded policy only takes effect after the next page load.
- Tags connected through Marketing Integrations therefore run on a visitor's first page view before any decision, and also on the page where the visitor decides.
- From the next page load they follow the forwarded policy: until the visitor accepts, that policy is "denied" wherever the visitor's region rule is opt-in (and, with the default rule, where the country is unknown); in opt-out and notice regions it is "allowed".
- Consentl cannot close this gap with custom code. If your site must not send tracking requests before consent, do not connect these tags until a Wix consent app (which can set the site default) is available. A native Wix consent app is on our roadmap.
Wix frontend security hardening. Wix locks several browser APIs: it ignores
document.cookiewrites to Wix's internal cookies, locksEventTarget/Objectprototypes, and prevents replacingfetchandXMLHttpRequest. Consentl's network-beacon filter (which drops tracking requests sent withfetchorsendBeaconby scripts already running) therefore does nothing on Wix. Only holding<script>,<iframe>and<img>elements works: automatically on Business for tags inserted by code, and manually on every plan. Check your own tags in a private window after installing.Hard-coded tags. A
<script src>,<img>pixel or<iframe>written in custom code or an embed is fetched by the browser before any script can stop it, even when Consentl prevents it from running. Mark such tags manually and remove<noscript>pixels:<script type="text/plain" data-consentl="marketing" src="https://ads.example.com/tag.js"></script> <iframe data-consentl="marketing" data-src="https://www.youtube-nocookie.com/embed/ID" title="Video"></iframe> <img data-consentl="marketing" data-src="https://tracker.example.com/pixel.gif" alt="" width="1" height="1">Tags loaded by code are held without a request only when automatic blocking is on (Business).
Embedded HTML widgets (iframes) run on a separate origin. Trackers inside them are not visible to Consentl.
Related guides
Stuck? Write to [email protected] — we answer in English on business days.