What you need

  • Access to your HTML shell (app.html, layout.tsx, or index.html)
  1. Load synchronously first in <head>

    Embed the precompiled Shadow DOM bundle (14 KB gzip budget for the core, plus a fixed allowance per paid module) synchronously as the first script in <head>. Avoid async and defer, so window.Limes and GCM defaults exist before any third-party script runs.

    HTML <head>
    <script src="https://cdn.uselimes.com/v1/your-site-id.js"></script>
  2. Block scripts and iframes with markup

    Give a script type="text/plain" and data-limes-category with the category. External scripts get data-src instead of src. Limes starts them only once the visitor consents to that category, in document order.

    Iframes get data-limes-category and data-src. Until consent, Limes shows a placeholder in their place whose button grants only that category.

    HTML
    <script type="text/plain" data-limes-category="statistics"
      data-src="https://www.googletagmanager.com/gtag/js?id=G-XXXX"></script>
    
    <iframe data-limes-category="marketing"
      data-src="https://www.youtube-nocookie.com/embed/ID"></iframe>
  3. Gate custom scripts via window.Limes

    For your own logic, check consent synchronously with window.Limes.has(...) and subscribe to limes:change for later decisions and withdrawals.

    JavaScript / TypeScript
    if (window.Limes?.has("statistics")) {
      initAnalytics();
    }
    
    window.addEventListener("limes:change", ({ detail }) => {
      if (detail.selection.marketing) {
        loadAdPixel();
      }
    });
  4. Configure Content-Security-Policy (CSP)

    Limes needs no unsafe-inline or unsafe-eval. Simply allow your script host in script-src and connect-src.

    CSP directives
    script-src 'self' https://cdn.uselimes.com;
    connect-src 'self' https://consent.uselimes.com;
  5. Run automated scans in CI/CD

    Run the 5-state Playwright scanner before every release. Limes also scans your site on a schedule: monthly on Free and Starter, weekly on Professional, daily from Business.

    CLI command (exit 0 = clean, 1 = violation)
    bun run scan --url https://www.example.com --site sites/your-site.json --json

Frequently asked questions

Can the banner CSS clash with Tailwind or our design system?

No. The UI renders completely encapsulated inside Shadow DOM and only reads explicit --ds-* CSS custom properties if configured.