{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs-realm.sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["configOptionRequirements","admonition"]},"redocly_category":"Realm","type":"markdown"},"seo":{"title":"consent","description":"OpenAPI-generated documentation tool with 24k+ stars on Github - make APIs your company's superpower.","siteUrl":"https://redocly.com","image":"/assets/redocly-card.f670aae34a39545a5ea633a540cb3a4a333a1f23bb2ed3c4a1b17a5fbcf0ac85.db81178d.png","lang":"en-US"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"consent","__idx":0},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["consent"]}]},{"$$mdtype":"Tag","name":"ConfigOptionRequirements","attributes":{"products":["Redoc","Revel","Reef","Realm"],"plans":["Enterprise+"]},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Show a cookie consent banner and load analytics integrations only after the visitor agrees."," ","Or load them at once and give the visitor a footer link to opt out."," ","Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mode"]}," to turn the feature on."," ","The default is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["none"]},", so the block alone changes nothing."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"You own the wording"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Redocly supplies the banner and the gate, not legal advice."," ","You are responsible for the text of the banner, the category descriptions, and your privacy policy."," ","Consent law differs by country and by US state, so ask your own counsel which rules apply to your site."," ","Every string on this page is configurable for that reason."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"options","__idx":1},"children":["Options"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Option"},"children":["Option"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["mode"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["How the site asks for consent."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["auto"]}," picks ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-in"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-out"]}," for each visitor from where they are."," ","See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#auto-mode"},"children":["Auto mode"]},"."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-in"]}," shows the banner on the first visit and loads nothing until the visitor accepts."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-out"]}," shows no banner, loads analytics and marketing at once, and gives the visitor a footer link to refuse."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["none"]}," shows no banner and no link, and loads everything, as if the block were absent."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onetrust"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cookiebot"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["trustarc"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tcf"]}," are consent providers."," ","A provider value hands the banner, the decision and the geo-targeting to that consent manager."," ","Realm gates its integrations and your scripts from the provider's state."," ","See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#use-your-own-consent-provider"},"children":["Use your own consent provider"]},"."," ","Possible values: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["auto"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-in"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-out"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["none"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onetrust"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cookiebot"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["trustarc"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tcf"]},"."," ","Default: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["none"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["privacyPolicyUrl"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Link to the privacy policy."," ","The banner shows it after the message."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["expires"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["number"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["How long the browser keeps the choice, in days."," ","Default: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["365"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["settingsLink"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Where the settings link appears."," ","The link reads ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cookie preferences"]}," in every mode."," ","Possible values: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["auto"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["footer"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["none"]},"."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["auto"]}," uses the footer when your project shows one, and shows no link when it does not."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["footer"]}," puts the link in the footer."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["none"]}," shows no link, and you place your own."," ","Default: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["auto"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every string in the banner and the dialog is a translation key."," ","The ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/realm/content/localization/translation-keys"},"children":["predefined translation keys"]}," page lists them all."," ","Change the wording of any string in your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["translations.yaml"]}," file."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"categories","__idx":2},"children":["Categories"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Consent has three fixed categories."," ","You cannot add a category."," ","Change the title and the description of each one with translation keys."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Category"},"children":["Category"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"What it covers"},"children":["What it covers"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Visitor control"},"children":["Visitor control"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["necessary"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Cookies the site needs to work, such as the consent choice itself, the color mode, and Realm telemetry."]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Always on."," ","The settings dialog shows the category and explains why it has no toggle."]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["analytics"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Tools that measure how visitors use the site, such as Google Analytics, Segment, or Amplitude."]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Off until the visitor accepts in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-in"]}," mode."," ","On until the visitor refuses in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-out"]}," mode."]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["marketing"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Tools that build an advertising audience or attribute a signup to a campaign, such as a Meta or LinkedIn pixel."]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Off until the visitor accepts in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-in"]}," mode."," ","On until the visitor refuses in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-out"]}," mode."," ","Off when the browser sends the Global Privacy Control signal, in both modes."]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Realm ships no marketing integration, so the marketing category gates only the scripts you add."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"which-integrations-wait-for-which-category","__idx":3},"children":["Which integrations wait for which category"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Integration"},"children":["Integration"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Category"},"children":["Category"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Google Analytics, Google Tag Manager, Segment, Rudderstack, Amplitude, Heap, FullStory, Adobe"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["analytics"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Realm telemetry"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["necessary."," ","The anonymous ID changes every session and identifies nobody across visits."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"example","__idx":4},"children":["Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"consent:\n  mode: auto\n  privacyPolicyUrl: https://example.com/privacy\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mode: auto"]},", a visitor in an opt-in country sees the banner on the first visit."," ","A visitor who accepts analytics gets the Google Analytics script at once, on the same page, with no reload."," ","Google Tag Manager, Segment, and Heap record the page the visitor accepted on."," ","Google Analytics and Rudderstack record from the next page view."," ","A visitor who rejects it never loads the script."," ","A ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cookie preferences"]}," link in the footer reopens the dialog."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"opt-out-mode","__idx":5},"children":["Opt-out mode"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-out"]}," mode for a site whose visitors live where the law requires a way to refuse, not a question up front."," ","The US state privacy laws work this way."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"consent:\n  mode: opt-out\n  privacyPolicyUrl: https://example.com/privacy\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The visitor sees no banner."," ","Analytics and marketing load on the first page view."," ","A ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cookie preferences"]}," link in the footer opens the settings dialog, with every category on."," ","When a visitor turns a category off, Realm reloads the page, so scripts that already run stop."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If your visitors live in both opt-in and opt-out places, use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mode: auto"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"global-privacy-control","__idx":6},"children":["Global Privacy Control"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Some browsers send the Global Privacy Control signal, which asks the site not to sell or share the visitor's data."," ","Realm treats the signal as a refusal of the marketing category, in both modes."," ","Marketing scripts do not load, the settings dialog shows the marketing toggle off, and the dialog says the browser asked for it."," ","The visitor cannot change the marketing toggle while the browser sends the signal."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"use-your-own-consent-provider","__idx":7},"children":["Use your own consent provider"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use a provider mode when your company already has a consent manager."," ","The provider shows the banner, keeps the decision, and selects the visitors who see the banner."," ","Realm reads the state from the provider."," ","Then Realm gates its analytics integrations and your scripts on that state."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add the provider script to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scripts"]}," config."," ","Do not add the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["consent"]}," property to it, because the provider must load on each page view."," ","Realm adds no provider script and needs no provider settings."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"consent:\n  mode: onetrust\nscripts:\n  head:\n    - src: https://cdn.cookielaw.org/scripttemplates/otSDKStub.js\n      data-domain-script: 0190abcd-1234-7000-8000-000000000000\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each provider has its own category names."," ","Realm maps them to the analytics category and the marketing category."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Provider"},"children":["Provider"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"mode value"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mode"]}," value"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Analytics category"},"children":["Analytics category"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Marketing category"},"children":["Marketing category"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["OneTrust"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onetrust"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The Performance group, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["C0002"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The Targeting group, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["C0004"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Cookiebot"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cookiebot"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The statistics category"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The marketing category"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["TrustArc"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["trustarc"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The functional and analytics bucket, number 2"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The advertising bucket, number 3"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["IAB TCF"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tcf"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Purpose 1 and one of the purposes 8, 9, or 10"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Purpose 1 and one of the purposes 2, 3, or 4"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tcf"]}," with a consent manager that supplies the IAB TCF version 2.2 API, such as Didomi, Usercentrics, or Sourcepoint."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A provider mode changes what Realm does:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Realm shows no banner and no settings dialog."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cookie preferences"]}," link opens the preference center of the provider."," ","Before the provider script loads, the link writes a warning to the browser console and does nothing."," ","With ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tcf"]},", the link opens the Didomi or Usercentrics preference center."," ","The TCF API has no command that shows a preference center, so with another TCF consent manager, add your own trigger."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Realm keeps no consent cookie, because the provider keeps the decision."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Realm pushes no Google consent mode command, because the provider pushes its own."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Analytics and marketing stay off until the provider reports a grant."," ","If the provider script does not load in 15 seconds, Realm writes one warning to the browser console."," ","Analytics and marketing stay off."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"auto-mode","__idx":8},"children":["Auto mode"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mode: auto"]},", visitors in places that require consent up front get the banner."," ","Visitors in places that require a way to refuse get the footer link."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"consent:\n  mode: auto\n  privacyPolicyUrl: https://example.com/privacy\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Realm finds the visitor's country from the browser's time zone."," ","The browser reports a zone name such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["America/Chicago"]},", and Realm maps the zone to its country with the tz database's country table."," ","This finds the country, not the state or province."," ","The table lists one country for each zone, and that country decides."," ","A visitor in a place that shares a zone with a neighboring country gets the mode of that country."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The country then picks the mode:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Visitor's country"},"children":["Visitor's country"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Mode"},"children":["Mode"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A country whose law requires consent before non-essential cookies."," ","The EEA, the UK, Switzerland, Brazil, Japan, South Korea, China, Turkey, South Africa, Thailand, Saudi Arabia, India, Israel, Argentina, and Canada."," ","The territories and microstates of the EU and the UK count as opt-in too."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-in"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Every other country"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-out"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unknown"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-in"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["auto"]}," never picks ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["none"]},"."," ","Realm changes the list only in a release, with a changelog entry."," ","If you disagree with the choice for a place, set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mode: opt-in"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mode: opt-out"]}," for every visitor."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"gate-your-own-scripts","__idx":9},"children":["Gate your own scripts"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["consent"]}," property to a script in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scripts"]}," config."," ","The script loads only while the consent state allows that category."," ","In ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-in"]}," mode the visitor must accept first."," ","In ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opt-out"]}," mode the category starts on and stays on until the visitor refuses."," ","Possible values: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["analytics"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["marketing"]},"."," ","A script without the property loads on every page view."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"scripts:\n  head:\n    - src: https://connect.facebook.net/en_US/fbevents.js\n      consent: marketing\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A returning visitor who granted the category gets the script on the first page view."," ","Gated scripts load in the order of the config."," ","A pixel inside a Google Tag Manager container follows Google consent mode and needs no ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["consent"]}," property."," ","That pixel loads only when the visitor grants the analytics category, because the container itself waits for analytics."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"place-the-settings-link-yourself","__idx":10},"children":["Place the settings link yourself"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["settingsLink: none"]},", or hide the footer."," ","Then open the dialog from any element of your own."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"document.querySelector('#cookie-settings').addEventListener('click', () => {\n  window.redocly.consent.open();\n});\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this when you want the link on a specific page."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["window.redocly.consent.close()"]}," closes the dialog."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"read-the-state-from-a-script","__idx":11},"children":["Read the state from a script"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A script that is more than one tag can read the state and wait for a category."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"window.redocly.consent.on('change', (state) => {\n  if (state.analytics) {\n    loadMyAnalytics();\n  }\n});\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"resources","__idx":12},"children":["Resources"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/realm/config/analytics"},"children":["Analytics configuration"]}]}," - The integrations that wait for the analytics category"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/realm/config/scripts"},"children":["Scripts configuration"]}]}," - How to add your own scripts and the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["consent"]}," property that gates them"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/realm/config/l10n"},"children":["Localization"]}]}," - How to translate the banner text"]}]}]},"headings":[{"value":"consent","id":"consent","depth":1},{"value":"Options","id":"options","depth":2},{"value":"Categories","id":"categories","depth":3},{"value":"Which integrations wait for which category","id":"which-integrations-wait-for-which-category","depth":2},{"value":"Example","id":"example","depth":2},{"value":"Opt-out mode","id":"opt-out-mode","depth":2},{"value":"Global Privacy Control","id":"global-privacy-control","depth":2},{"value":"Use your own consent provider","id":"use-your-own-consent-provider","depth":2},{"value":"Auto mode","id":"auto-mode","depth":2},{"value":"Gate your own scripts","id":"gate-your-own-scripts","depth":2},{"value":"Place the settings link yourself","id":"place-the-settings-link-yourself","depth":2},{"value":"Read the state from a script","id":"read-the-state-from-a-script","depth":2},{"value":"Resources","id":"resources","depth":2}],"frontmatter":{"products":["Redoc","Revel","Reef","Realm"],"plans":["Enterprise+"],"description":"Show a cookie consent banner and load analytics only after the visitor agrees.","seo":{"title":"consent"}},"lastModified":"2026-09-25T14:05:50.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/realm/config/consent","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}