Usage

Checking for 3rd party cookies dynamically

Warning

Deprecated since version 0.5.0.

This approach does not work well with page-level caches and (strict) content security policies. Instead, use the new Javascript approach with <template> nodes.

Using js_type_for_cookie_consent templatetag for script type attribute would set x/cookie_consent thus making browser skip executing this block of javascript code.

When consent for using specific cookies is given, code can be evaluated without reloading page.

{% load cookie_consent_tags %}
<script type="{% js_type_for_cookie_consent request "social" "*:.google.com" %}" data-varname="social">
  alert("Social cookie accepted");
</script>