Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #944493

    Can you give an easy and exact workaround for how to add an opt-out for Google Analytics & Facebook Tracking.

    I found this solution but i have problems getting it right:

    Best would be without the Google Tag Manager.

    How does this Code hast to look like for Google UI and FB Pixes:

    if (!localStorage.getItem(‘optout’)) {
    //beliebigen Tracking Code hier einfügen
    }

    Thanks Simon

    #944701

    Hi Simon,

    You can use this code and add it at the bottom of functions.php:

    function add_customjs(){
    ?>
    <script>
      if (! localStorage.getItem ('optout')) { 
        // insert any tracking code here 
      }
    </script>
    <?php
    }
    add_action('wp_head', 'add_customjs');

    Hope it helps :)

    Best regards,
    Nikko

    #944850

    Allright, and how do i add this to a button or text link?

    What is the link aim?

    Thanks

    #944869

    Hi simonac,

    I haven’t really tried this but the way I understand is step 1, requires this:

    function add_customjs(){
    ?>
    
    if (localStorage.getItem('optout')) {
      //
    } else {     
      //
    }
    function setOptOut() {
      localStorage.setItem('optout', 'true');
      window.location.reload(false);
    }
    function deleteOptOut() {
      localStorage.removeItem('optout');
      window.location.reload(false);
    }
    
    <?php
    }
    add_action('wp_head', 'add_customjs');
    
    then step 2 onwards is set on https://tagmanager.google.com
    
    Best regards,
    Nikko
    • This reply was modified 6 years, 8 months ago by Nikko.
    #945035

    How do i have to put in the fb pixel and google id?

    function add_customjs(){
    ?>
    <script>
      if (! localStorage.getItem ('optout')) { 
        // insert any tracking code here 
    fbq('init', '1870527669531');
    ga('create', 'UA-523734-3', );
      }
    </script>
    <?php
    }
    add_action('wp_head', 'add_customjs');

    What is the correct code for where it says: insert any tracking code here`?
    Thanks Simon

    #945199
    #974897

    Hi guys. I´m using the new privacy Module on the Website: https://kn-newskin.de/ unfortunately it isn´t working.
    The Opt-Out Button isn´t doing anything. That is dangerous!

    Any help?

    #974902

    Or is it correctly working with this?

    
    <script>if(document.cookie.match(/aviaPrivacyGoogleTrackingDisabled/)){ window['ga-disable-UA-56378302-1'] = true; }</script>
    
     
    #975004

    Hi,

    Yes, the code is working just fine and as it should be.
    You can always try it by testing in icognito :)

    Best regards,
    Basilis

    #1075798

    Hello. This is related to this previous post which is why I’m posting my issue here. I’m using a default installation of Enfold and I’m having an issue where none of my conversion tracking is working since install. It was exactly the same on the previous design, but when I moved it to Enfold it stopped tracking. I managed to find this piece of code on the page I’m working on. Is this causing the issue (I’ve x’d out my code):
    if(document.cookie.match(/aviaPrivacyGoogleTrackingDisabled/)){ window[‘ga-disable-UA-xxxxxxxx-x’] = true; }

    Is this code stopping my tracking from recording? If so, how do I fix it?
    Thank you!

    #1077628

    Hi Jeepkid99,

    Try adding this code at the bottom of your functions.php:

    remove_action('wp_footer', 'avia_print_tracking_code', 100);

    Best regards,
    Nikko

    #1088923

    Sorry but because the theme creates this rule? In other words, is it a problem with the theme or is there something wrong with the settings?

    I mean:

    <script>if(document.cookie.match(/aviaPrivacyGoogleTrackingDisabled/)){ window[‘ga-disable-UA-56378302-1’] = true; }</script>

    And then to this thing:

    remove_action(‘wp_footer’, ‘avia_print_tracking_code’, 100);

    #1090393

    Hi Mickyhood,

    We apologize for the delayed response.
    This was added to the theme in compliance with GDPR: https://kriesi.at/archives/enfold-4-4-and-the-gdpr-general-data-protection-regulation

    Best regards,
    Nikko

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