最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

cookies - Block Google tracking on refuse consent of the user with plugin

programmeradmin10浏览0评论

I use a plugin to display Cookie Notice and I try to block google tracking on refuse content. In the plugin description says that

USAGE: If you’d like to code a functionality depending on the cookie notice value use the function below:

if ( function_exists('cn_cookies_accepted') && cn_cookies_accepted() ) { // Your third-party non functional code here }

So I placed on the given box of the plugin, the following:

<script>
if ( function_exists('cn_cookies_accepted') && !cn_cookies_accepted() ) {
    window['ga-disable-UA-XXXXXX-1'] = true; 
}
</script>

where UA-XXXXXX-1 is my Google Analytics Id

However, I get on the console that:

ReferenceError: function_exists is not defined

I am thinking that the above code is not Javascript... (may be php ?). So I am stuck... How I proceed?

发布评论

评论列表(0)

  1. 暂无评论