Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #20439
    Irken
    Participant

    Hi,
    When I accept the cookie policy of my site, I get this message:

    if ( function_exists('cn_cookies_accepted') && cn_cookies_accepted() ) { }

    at the bottom of the page.
    That’s how I surrounded my call to googleAnalytics function in the script blocking function.

    Is it a bug, or should I modify something? You can see the behaviour at: https://www.pvalue.io

    #20440
    Irken
    Participant

    Nevermind, I did something stupid…

    #20442
    Irken
    Participant

    Actually, I wrote:

    if ( function_exists('cn_cookies_accepted') && cn_cookies_accepted() ){
    <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
    
    ga('create', 'UA-XXXXXXX-Y', 'auto');
    ga('send', 'pageview');
    </script>
    }

    I thought that I had to put the script tag outside the ‘if’. But it didn’t work :(

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.