Fix issues with privacy settings

This commit is contained in:
Jai A
2021-04-10 21:54:16 -07:00
parent 03b2d02742
commit 7d3ad5a639
7 changed files with 40 additions and 23 deletions

View File

@@ -9,6 +9,9 @@ function isAnalyticsOn(ctx) {
// Rely on the client
cookies = document.cookie;
}
if(!cookies) return true;
let processed = {}
cookies.split(';').forEach((e) => {
let val = e.trim().split('=');
@@ -27,14 +30,13 @@ export default async function (ctx, inject) {
const tag = config.tracking_code ?? '<%= options.tracking_code %>';
const enabled = config.enabled ?? <%= options.enabled || false %>;
// Check if the parameters are not changed by runtime config:
const UNAMI_LIB_TAG_ID = '<%= options.UNAMI_LIB_TAG_ID %>';
if (!enabled) {
console.log("Analytics are not enabled.")
return;
}