AI-assisted integration

Do you use an AI assistant to code (ChatGPT, Claude, Copilot, Cursor)? Give it the context below: it will know how to install the Moelleux embed and wire the consent API correctly.

The prompt to copy-paste

Copy this block into your AI assistant, then describe what you want to integrate (for example “load Google Analytics only after consent”).

You are integrating Moelleux, a Quebec Law 25 / GDPR consent manager, on my website.

INSTALLATION
Add this script once, ideally before </head>:
<script src="https://cdn.moelleux.ca/c/{site_key}.js" async></script>
Replace {site_key} with my site key (UUID, visible in the Moelleux dashboard).

THIRD-PARTY SCRIPT GATING
To load a script only after consent, add the data-consent attribute with the category: data-consent="analytics" (categories: analytics, marketing, functional, preferences; essential is always active). Moelleux switches the script to type="text/plain" then re-enables it on consent. Google Consent Mode v2 is handled natively, do not wire it manually.

JAVASCRIPT API (window.Moelleux)
NEVER call window.Moelleux directly on load. Always use the guard:
window.MoelleuxOnReady = window.MoelleuxOnReady || [];
window.MoelleuxOnReady.push(function (M) { /* M === window.Moelleux, ready */ });
Methods: version, ready(cb), getConsent(), hasConsent(cat), acceptAll(), rejectAll(), setConsent({analytics:true}), acceptCategory(cat), denyCategory(cat), openPreferences(), reset(), on(event, cb), getLanguage(), setLanguage('fr'|'en'), getJurisdiction() [read-only], showBadge(), hideBadge().

DOM EVENT (preferred to react to consent):
document.addEventListener('moelleux:consent', function (e) { /* e.detail = {choices, consentId, policyVersion, timestamp} */ });

CSS CLASSES (if the cssClasses option is enabled): on <html>, mx-consent-{cat} / mx-consent-no-{cat} + mx-consent-ready, set from init to avoid any flash.

Do not suggest any external dependency: the embed is vanilla JavaScript.

Going further

To give your AI assistant the full product and API context, point it to our llms-full.txt file — a structured document optimized for language models.

Open llms-full.txt →