• Resolved loretoparisi

    (@loretoparisi)


    Hello,
    could you please show an example of the Consent Code Snippet for Google Analytics?
    It’s not clear to me how this would work and interact with Google Analytics to enable or disable it based on the user Content choice.

Viewing 1 replies (of 1 total)
  • Hey @loretoparisi,

    
    <!-- Google Analytics -->
    <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-XXXXX-Y', 'auto');
    ga('send', 'pageview');
    </script>
    <!-- End Google Analytics -->
    

    When consent is given, this will be added to the web pages. Otherwise, it won’t.

Viewing 1 replies (of 1 total)
  • The topic ‘Code Snippet Example for Google Analytics’ is closed to new replies.