GDPR Cookie遵从性Javascript回调

GDPR Cookie遵从性Javascript回调,javascript,cookies,callback,addeventlistener,Javascript,Cookies,Callback,Addeventlistener,这与在Joomla 3.9.13网站上实现GDPR合规性有关,但我相信无论平台如何,它都是类似的 我一直在看,它似乎符合所有的法律要求,而且看起来不错。他们的网站上有一个可用的弹出窗口,它非常容易使用,问题是需要额外的代码才能使弹出窗口真正执行除弹出窗口之外的任何操作 他们的文档涵盖了禁用Cookie需要实现的功能。。我在这方面没有经验 我的理解是,在用户明确同意之前,页面上的所有cookie都应该被阻止。因此,查看浏览器控制台>页面加载上的cookies,它应该是空的,直到我单击accept,

这与在Joomla 3.9.13网站上实现GDPR合规性有关,但我相信无论平台如何,它都是类似的

我一直在看,它似乎符合所有的法律要求,而且看起来不错。他们的网站上有一个可用的弹出窗口,它非常容易使用,问题是需要额外的代码才能使弹出窗口真正执行除弹出窗口之外的任何操作

他们的文档涵盖了禁用Cookie需要实现的功能。。我在这方面没有经验

我的理解是,在用户明确同意之前,页面上的所有cookie都应该被阻止。因此,查看浏览器控制台>页面加载上的cookies,它应该是空的,直到我单击accept,cookies才会出现。我不能让这个部件工作。每当我的页面加载所有cookie时,我都会尝试,我的代码如下

<script>
window.addEventListener("load", function() {
    window.cookieconsent.initialise({
        "palette": {
            "popup": {
                "background": "#000"
            },
            "button": {
                "background": "#f1d600"
            }
        },
        "position": "bottom-left",
        "type": "opt-out",
        "content": {
            "href": "cookie-policy.html"
        },
        onInitialise: function(status) {
            var type = this.options.type;
            var didConsent = this.hasConsented();
            if (type == 'opt-in' && didConsent) {
                // enable cookies
                window['ga-disable-GA_TRACKING_ID'] = false;
            }
            if (type == 'opt-out' && !didConsent) {
                // disable cookies
                console.log('cookies disabled');
                window['ga-disable-GA_TRACKING_ID'] = true;
            }
        },
        onStatusChange: function(status, chosenBefore) {
            var type = this.options.type;
            var didConsent = this.hasConsented();
            if (type == 'opt-in' && didConsent) {
                window['ga-disable-GA_TRACKING_ID'] = false;
            }
            if (type == 'opt-out' && !didConsent) {
                // disable cookies
                window['ga-disable-GA_TRACKING_ID'] = true;
            }
        },
        onRevokeChoice: function() {
            var type = this.options.type;
            if (type == 'opt-in') {
                // disable cookies
                window['ga-disable-GA_TRACKING_ID'] = true;
            }
            if (type == 'opt-out') {
                // enable cookies
                window['ga-disable-GA_TRACKING_ID'] = false;
            }
        },
    })
});
</script>

addEventListener(“加载”,函数(){
window.cookieconsent.initialise({
“调色板”:{
“弹出窗口”:{
“背景”:“000”
},
“按钮”:{
“背景”:“f1d600”
}
},
“位置”:“左下角”,
“类型”:“选择退出”,
“内容”:{
“href”:“cookie policy.html”
},
初始化:功能(状态){
var type=this.options.type;
var didaconsent=this.hasaconsensed();
如果(类型=‘选择加入’&&D同意){
//启用Cookie
窗口['ga-disable-ga_跟踪_ID']=false;
}
如果(类型=='opt out'&&&!didApprove){
//禁用Cookie
console.log(“禁用cookies”);
窗口['ga-disable-ga_跟踪_ID']=true;
}
},
onStatusChange:函数(状态,chosenBefore){
var type=this.options.type;
var didaconsent=this.hasaconsensed();
如果(类型=‘选择加入’&&D同意){
窗口['ga-disable-ga_跟踪_ID']=false;
}
如果(类型=='opt out'&&&!didApprove){
//禁用Cookie
窗口['ga-disable-ga_跟踪_ID']=true;
}
},
onRevokeChoice:function(){
var type=this.options.type;
如果(类型==“选择加入”){
//禁用Cookie
窗口['ga-disable-ga_跟踪_ID']=true;
}
如果(类型==“选择退出”){
//启用Cookie
窗口['ga-disable-ga_跟踪_ID']=false;
}
},
})
});
除了用我上面设置的文本/颜色显示弹出窗口外,这段代码实际上没有做任何事情

我需要改变什么才能让它工作


如果您有任何建议,我们将不胜感激。

我知道这有点旧,存储库已经更新,但这是否适合您?我需要为所有内容添加法规遵从性,因此我正在寻找“一刀切”的解决方案。是的,我阻止了所有cookie,直到用户明确同意,然后才启用它们。