Template tags¶
cookie_consent¶
Filter returns accepted cookies varnames.
{{ request|accepted_cookies }}
Serialize all cookie groups to JSON and output them in a script tag.
Parameters: element_id – The ID for the script tag so you can look it up in JS later. This uses Django’s core json_script filter under the hood.
Filter returns if all cookies are accepted.
Assignement tag returns url for accepting given concept groups.
Assignement tag returns url for declining given concept groups.
Filter returns if cookie consent enabled for this request.
Filter returns if cookie group is accepted.
Examples:
{{ request|cookie_group_accepted:"analytics" }} {{ request|cookie_group_accepted:"analytics=*:.google.com" }}
Filter returns if cookie group is declined.
Tag returns accept cookie string suitable to use in javascript.
Tag returns decline cookie string suitable to use in javascript.
Tag returns “x/cookie_consent” when processing javascript will create an cookie and consent does not exists yet.
Example:
<script type="{% js_type_for_cookie_consent request "social" %}" data-varname="social"> alert("Social cookie accepted"); </script>
Assignement tag returns cookie groups that does not yet given consent or decline.