{% load i18n %} {% include "cookie_optin/functions/default.js" %} {% for template_path in custom_function_includes %} {% include template_path %} {% endfor %} var klaroConfig = { {% block config %} elementID: 'cookie-optin', storageName: 'cookie-optin', storageMethod: 'localStorage', cookieExpiresAfterDays: 182, {% comment %}Max legal expiration days for klaro cookies is 6 months{% endcomment %} privacyPolicy: '{{ privacy_url }}', default: true, acceptAll: true, mustConsent: false, id: 'cookie-optin', apiUrl: '{{ klaro_api_url|default:"/cookie-optin/api/" }}', /* API sync is handled by localKlaroApi in klaro-init.js via saveConsents events. The previous callback sent type 'save' on every applyConsents, causing duplicate increments when user clicked "Accept all" (accept + save). */ callback: function() {}, {% endblock config %} translations: { {% block translations %} {% get_available_languages as LANGUAGES %} {% for language_code, language_name in LANGUAGES %} "{{ language_code }}": { ok: '{% trans "Accept"|escapejs %}', save: '{% trans "Save"|escapejs %}', consentNotice: { learnMore: '{% trans "Choose the cookies I accept"|escapejs %}' }, service: { disableAll: { title: '{% trans "Toggle all services"|escapejs %}', }, }, {% for application in applications %} {{ application.camel_case_name }}: { description: '{{ application.description|escapejs }}' }, {% endfor %} purposes: { {% for purpose in purposes %} purpose{{ purpose.id }}: '{{ purpose.name }}'{% if not forloop.last %},{% endif %} {% endfor %} } }{% if not forloop.last %},{% endif %} {% endfor %} {% endblock translations %} }, services: [ {% block applications %} {% for application in applications %} { name: '{{ application.camel_case_name }}', title: '{{ application.name|escapejs }}', purposes: [{% for purpose in application.purposes.all %}'purpose{{ purpose.id }}'{% if not forloop.last %}, {% endif %}{% endfor %}], {% with cookies=application.cookie_set.all %} {% if cookies %} cookies: [ {% for cookie in cookies %} {{ cookie.prepared_name|safe }}{% if not forloop.last %},{% endif %} {% endfor %} ], {% endif %} {% endwith %} callback: callback_{{ application.function_suffix }}, onInit: onInit_{{ application.function_suffix }}, onAccept: onAccept_{{ application.function_suffix }}, onDecline: onDecline_{{ application.function_suffix }}, required: {{ application.is_required|yesno:'true,false' }}, optOut: {{ application.no_consent|yesno:'true,false' }}, onlyOnce: true }{% if not forloop.last %},{% endif %} {% endfor %} {% endblock applications %} ] }