Ask the assistant
0/400
Your question is processed by an AI service and kept to improve answers. Do not enter personal data.

    Consent

    A cookie consent banner provided by the platform; it adapts to the page's theme. It asks the visitor for permission for categories of scripts, embeds and counters.

    The banner does not need the element. A page that has something to gate gets the standard banner by itself, in the page's language. The Consent element sets its own texts, the policy link and the screen edge.

    Type: leaf Web only: in the app the element does nothing (reads of $consent.* answer “not given”, calls to consent.* do nothing).

    Consent position:bottom policyLabel:$strings.cookiesPolicy policyUrl:"/privacy"

    Parameters

    Parameter Type Default Description
    position bottom | top bottom Which edge the banner sticks to
    policyLabel , policyUrl string — Link to the privacy policy; shown when both are set
    always bool false Show the banner even when the document has nothing that waits for consent
    title , message , acceptLabel , rejectLabel string / $strings in the page's language Title, description and button labels

    Categories

    Fixed: necessary (always on — a choice there is no need to ask about), analytics , marketing . You cannot add categories of your own: the banner promises the visitor exactly these three, and the requiresConsent tag on Script / HtmlEmbed is what turns the promise into behaviour. Counters from settings.analytics always go under analytics .

    The visitor answers with one of two buttons of equal weight: “Reject” or “Accept all”. The platform's banner is a card at the bottom centre, narrower than the window (no wider than 560), text above the buttons; “Accept all” uses the theme's main colour ( primary ), like the site's other main buttons. There is no “Customize” panel: a per-category choice is drawn by the author in their own Consent content with consent.allow("analytics") / consent.deny(…) .

    When the banner exists and when it shows

    It exists on a page where something waits for consent: a Script or HtmlEmbed with requiresConsent on the page itself, or something declared for the whole site in project.json (a counter in settings.analytics , a settings.scripts entry with requiresConsent ). And, of course, wherever the Consent element is written.

    It shows by itself only when the document holds something consent would wake up. On platform addresses gated things do not exist at all, and the banner does not ask for consent “for nothing”. always:true overrides this rule.

    In the browser

    • The choice is stored in the browser's localStorage under the key reeel.consent.v1 and lasts a year — after that the banner asks again.
    • The state is available to markup: $consent.analytics , $consent.marketing .
    • Actions: consent.open() (show the banner again — the “cookie settings” link in the footer), consent.acceptAll() , consent.rejectAll() and one category at a time — consent.allow("analytics") / consent.deny("marketing") .
    • Consent activates the inert tags of allowed categories without reloading the page . Withdrawing consent already given reloads the page: a script that has run cannot be unloaded, so the choice is saved and the page starts over without that category. A first refusal reloads nothing.
    • Your own JavaScript sees the choice without reading storage: window.reeel.consent — {necessary, analytics, marketing} , and document receives a reeel:consent event on every decision, including a refusal ( detail : {categories, analytics, marketing} ). Google Consent Mode hooks into this.

    Examples

    Script src:"https://cdn.example.com/pixel.js" requiresConsent:"marketing"
    
    Consent position:bottom policyUrl:"/privacy"

    Yandex Metrica and Google Analytics counters are not added with a Script element: they are declared in `settings.analytics` , and they wait for analytics consent by themselves.

    Your own banner

    Give Consent content — it becomes the banner. When to show and hide it is still decided by the platform; the look and the words are ordinary layout. Buttons call consent.acceptAll() , consent.rejectAll() or consent.allow("analytics") .

    Consent
      Container
        #decoration color:$theme.colors.surface
        Row spacing:12
          Text $strings.cookiesMessage
          OutlinedButton onPressed:(){consent.rejectAll()}
            Text $strings.cookiesNecessary
          ElevatedButton onPressed:(){consent.acceptAll()}
            Text $strings.cookiesAccept

    The content sits centred at the bottom edge of the window (at the top with position:"top" ), 16 px from it. With your own content the text parameters ( title , message , button labels, the policy link) have nobody to show them — they are skipped with a warning. In the app the content is not drawn.

    There is one banner per page, so your own banner goes into a block present on every page of the site — usually the footer.

    InkWell onTap:(){consent.open()}
      Text $strings.cookieSettings

    No #web href: — an element with navigation becomes a real link, and its click handler is dropped on the web; here it is exactly the handler that is needed.

    Rules

    • SHOULD Write the Consent element only when you need your own texts, a policy link or the top edge; there is one per page and it lives in a shared block present on every page (usually the footer). There is no need to write it just to get the banner.
    • MUST NOT Do not glue a banner together by hand as a Positioned overlay: such overlays are for your own site decoration (a scroll progress bar, a slide-out menu), while the standard consent is one element, and only it is connected to $consent.* .
    • MUST NOT Do not mark with requiresConsent something that is not ready to wait: an inert tag does not run before consent, and on a platform address it never runs.
    • MUST NOT Do not call consent.* on a site page that has nothing to gate and no Consent element: there is no banner there, and the call does nothing (a warning is issued when the site is built).

    See also

    • Script — your own JavaScript and requiresConsent
    • HtmlEmbed — your own HTML and requiresConsent