misc: disable all tracking if browser has "Do Not Track" set (#23121)
This commit is contained in:
parent
bf72619362
commit
c519953b0c
|
@ -21,7 +21,7 @@ function get_cookie(cookie_name) {
|
|||
}
|
||||
|
||||
function has_consent() {
|
||||
return get_cookie('hasConsent') == 'hasConsent=true';
|
||||
return navigator.doNotTrack != '1' && get_cookie('hasConsent') == 'hasConsent=true';
|
||||
}
|
||||
|
||||
function purge_cookie(cookie_name) {
|
||||
|
@ -70,10 +70,12 @@ function consent_banner() {
|
|||
document.cookie = 'hasConsent=true'+ get_expiration() + path + domain;
|
||||
}
|
||||
|
||||
var consent_cookie = get_cookie('hasConsent');
|
||||
if (navigator.doNotTrack != '1') {
|
||||
var consent_cookie = get_cookie('hasConsent');
|
||||
|
||||
if (!consent_cookie) {
|
||||
window.onload = consent_banner;
|
||||
} else {
|
||||
if (!has_consent()) {purge_ga_cookies();}
|
||||
if (!consent_cookie) {
|
||||
window.onload = consent_banner;
|
||||
} else {
|
||||
if (!has_consent()) {purge_ga_cookies();}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,9 @@
|
|||
<a style="display: none" href="#" accesskey="t">Retour en haut de page</a>
|
||||
{% if cnil_compliant_visits_tracking_js %}
|
||||
<script type="text/javascript">
|
||||
{{ cnil_compliant_visits_tracking_js|safe }}
|
||||
if (navigator.doNotTrack != '1') {
|
||||
{{ cnil_compliant_visits_tracking_js|safe }}
|
||||
}
|
||||
</script>
|
||||
{% elif visits_tracking_js %}
|
||||
<script type="text/javascript" src="{{ site_base }}{% static 'js/cookie_usage_consent.js' %}?{{statics_hash}}"></script>
|
||||
|
|
Loading…
Reference in New Issue