• Hi,

    I installed the plugin, added the cookies and now I’m stuck on how to enable/disable functionality based on consent. I read the article where it says ‘Every functionality that is not essential should be disabled on the first landing.’ I have the Endurance caching plugin (from Bluehost) enabled. Visitors cannot register or login to my site. I only have a handful of cookies, but don’t know how to disable them prior consent. Can you please help?

    For GA for example… I used if ( is_allowed_cookie( '_ga' ) { before the GA code and ended with } But the code gets printed at the tip of my page on the front end. Plus the cookie is still loaded prior consent.

    Thanks,
    Laura

    • This topic was modified 6 years, 10 months ago by lauratraveler.
    • This topic was modified 6 years, 10 months ago by lauratraveler.
    • This topic was modified 6 years, 10 months ago by lauratraveler.
Viewing 3 replies - 1 through 3 (of 3 total)
  • In your browser console can you type is_allowed_cookie('_ga'), does it return true? If so, clear your cookies for your site and run that command again. It should return false now.

    View post on imgur.com

    • This reply was modified 6 years, 10 months ago by solvitieg.
    Plugin Support Anthony Moore

    (@amooreto)

    Hi @lauratraveler, are you able to paste the full code you are using?

    Thread Starter lauratraveler

    (@lauratraveler)

    @amooreto Yes, here’s the GA code wrapped up in if ( is_allowed_cookie( '_ga' ) {

    <!-- Global site tag (gtag.js) - Google Analytics -->
    if ( is_allowed_cookie( '_ga' ) {
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxx"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'UA-xxxxx', { 'anonymize_ip': true });
    </script>
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to enable/disable functionality based on consent’ is closed to new replies.