{"result":{"depiction_url":null,"edges":{"observes":{"objects":[{"created":"2026-09-09T13:47:40Z","object_id":{"id":2361,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_media_viewer_consent","title":"observe_media_viewer_consent\/2","uri":"https:\/\/zotonic.com\/id\/2361"},"seq":1}],"predicate":{"id":2550,"is_a":["meta","predicate"],"name":"observes","title":{"_type":"trans","tr":{"en":"Observes"}},"uri":"https:\/\/zotonic.com\/id\/observes"}},"subject":{"objects":[{"created":"2026-09-09T13:47:40Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-09T13:47:40Z","object_id":{"id":2562,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_site_administrator","title":"Site administrator","uri":"https:\/\/zotonic.com\/id\/2562"},"seq":2},{"created":"2026-09-09T13:47:40Z","object_id":{"id":2583,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_user_interface_and_interaction","title":"User interface and interaction","uri":"https:\/\/zotonic.com\/id\/2583"},"seq":3},{"created":"2026-09-09T13:47:40Z","object_id":{"id":2593,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_privacy_and_consent","title":"Privacy and consent","uri":"https:\/\/zotonic.com\/id\/2593"},"seq":4},{"created":"2026-09-09T13:47:40Z","object_id":{"id":2635,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_module","title":"Module","uri":"https:\/\/zotonic.com\/id\/2635"},"seq":5},{"created":"2026-09-09T13:47:40Z","object_id":{"id":2673,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_javascript","title":"JavaScript","uri":"https:\/\/zotonic.com\/id\/2673"},"seq":6},{"created":"2026-09-09T13:47:40Z","object_id":{"id":2686,"is_a":["categorization","keyword","keyword_quality"],"name":"zotonic_topic_privacy","title":"Privacy","uri":"https:\/\/zotonic.com\/id\/2686"},"seq":7}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":2362,"is_a":["text","documentation","reference","module"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2362"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_module_mod_cookie_consent","page_url":{"en":"https:\/\/zotonic.com\/docs\/2362\/mod_cookie_consent","x-default":"https:\/\/zotonic.com\/docs\/2362\/mod_cookie_consent"},"preview_url":null,"resource":{"version":745,"pivot_location_lat":null,"title":"mod_cookie_consent","is_authoritative":true,"body":"<p>Wrap external content in such a way that it is only loaded if the user consented to the inclusion of the content (and\nsubsequent cookies).<\/p>\n<p>The consent is one of:<\/p>\n<ul><li><code>functional<\/code> this is always allowed<\/li><li><code>stats<\/code> if consent for statistics tracking is given<\/li><li><code>all<\/code> for any other kind of cookies<\/li><\/ul>\n<p>For elements this defaults to <code>all<\/code>. This means that they are only rendered if all consent is given.<\/p>\n<h2>How to use<\/h2>\n<p>Ensure that your base template has an all-include of <code>_html_head.tpl<\/code> and <code>_html_body.tpl<\/code>.<\/p>\n<p>Also, if you are using IFRAMEs, JS or CSS that sets non-functional cookies, check the changes below.<\/p>\n<h2>HTML<\/h2>\n<p>Media embedded via mod_oembed or mod_video_embed are automatically wrapped according to this method:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">&lt;figure class=&quot;cookie-consent-preview do_cookie_consent mediaclass-...&quot; data-cookie-consent=&quot;all&quot;&gt;\n    &lt;img src=&quot;...&quot; alt=&quot;Media preview&quot;&gt;\n    &lt;figcaption&gt;Please consent to cookies to display external content.&lt;\/figcaption&gt;\n    &lt;script type=&quot;text\/x-cookie-consented&quot;&gt;\n        {% filter escape %}\n        &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https:\/\/www.youtube.com\/embed\/IdIb5RPabjw&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;\/iframe&gt;\n        {% endfilter %}\n    &lt;\/script&gt;\n&lt;\/figure&gt;\n<\/code><\/pre>\n<p>If there is no script tag then the page is reloaded after cookies are accepted.<\/p>\n<h2>IFRAME<\/h2>\n<p>Use the <code>data-cookie-consent-src<\/code> attribute to define the <code>src<\/code> if the cookie consent has been given:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">&lt;iframe width=&quot;560&quot; height=&quot;315&quot; data-cookie-consent-src=&quot;https:\/\/www.youtube.com\/embed\/....&quot;&gt;&lt;\/iframe&gt;\n<\/code><\/pre>\n<h2>JAVASCRIPT<\/h2>\n<p>Use the special <code>type=&quot;text\/x-cookie-consent&quot;<\/code> and optionally the <code>data-cookie-consent=&quot;...&quot;<\/code> attribute:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">&lt;script type=&quot;text\/x-cookie-consent&quot; data-cookie-consent=&quot;stats&quot; src=&quot;https:\/\/...&quot;&gt;&lt;\/script&gt;\n<\/code><\/pre>\n<h2>CSS<\/h2>\n<p>Use the special <code>type=&quot;text\/x-cookie-consent&quot;<\/code> and optionally the <code>data-cookie-consent=&quot;...&quot;<\/code> attribute:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">&lt;link type=&quot;text\/x-cookie-consent&quot; data-cookie-consent=&quot;stats&quot; href=&quot;https:\/\/...&quot;&gt;&lt;\/script&gt;\n<\/code><\/pre>\n<h2>Accepted Events<\/h2>\n<p>This module handles the following notifier callbacks:<\/p>\n<ul><li><code>observe_media_viewer_consent<\/code>: Render the cookie-consent placeholder shown before tracking-sensitive media is displayed.<\/li><\/ul>","slug":"mod_cookie_consent","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"db8e7c0f1658ac933eb500fa5ed750af2b6e90e0c84d8773392a709df26bc186","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":320,"is_a":["meta","category"],"name":"module","title":"Modules","uri":"https:\/\/test.zotonic.com\/id\/320"},"doc_source_path":"apps\/zotonic_mod_cookie_consent\/src\/mod_cookie_consent.erl","publication_start":"2023-06-24T08:17:57Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_mod_cookie_consent\/src\/mod_cookie_consent.erl","pivot_location_lng":null,"doc_source_kind":"module","name":"doc_module_mod_cookie_consent","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2023-01-23T08:59:08Z","uri":null,"doc_status":"current","is_dependent":false,"erlang_app":"zotonic_mod_cookie_consent","publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"b8c4b2ccdc223257f311968fbd17b2d66f0c4156\n","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"modified":"2026-09-30T09:39:35Z","title_slug":"mod_cookie_consent"},"uri":"https:\/\/zotonic.com\/id\/2362","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2362"}},"status":"ok"}