Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 13 additions & 19 deletions main/static/main/js/mixpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,14 @@ function checkUserConsent() {
mixpanel.opt_out_tracking();
// disable google analytics
window["ga-disable-UA-139926191-1"] = true;
showOptOutSettings();
} else {
// enable mixpanel tracking
mixpanel.opt_in_tracking();
// enable google analytics
window["ga-disable-UA-139926191-1"] = false;
// show settings
showOptInSettings();
}
showConsentSettings();
}
}

Expand All @@ -95,36 +94,31 @@ function hideConsentBanner() {
function setConsentTrue() {
localStorage.setItem("user_consent", "true");
hideConsentBanner();
showOptInSettings();
showConsentSettings();
}

function setConsentFalse() {
localStorage.setItem("user_consent", "false");
hideConsentBanner();
showOptOutSettings();
showConsentSettings();
}

function showOptInSettings() {
function showConsentSettings() {
showTrackingSettings();
let user_consent = localStorage.getItem("user_consent");
user_consent = JSON.parse(user_consent);

let opt_in_settings = document.getElementById("consent-settings-opt-in");
if (opt_in_settings != null) {
opt_in_settings.style.display = "block";
}
let opt_out_settings = document.getElementById("consent-settings-opt-out");
if (opt_out_settings != null) {
if (user_consent === true) {
opt_in_settings.style.display = "block";
opt_out_settings.style.display = "none";
}
}

function showOptOutSettings() {
showTrackingSettings();
let opt_in_settings = document.getElementById("consent-settings-opt-in");
if (opt_in_settings != null) {
} else if (user_consent === false) {
opt_in_settings.style.display = "none";
}
let opt_out_settings = document.getElementById("consent-settings-opt-out");
if (opt_out_settings != null) {
opt_out_settings.style.display = "block";
} else {
opt_in_settings.style.display = "none";
opt_out_settings.style.display = "none";
}
}

Expand Down