Tagged: ,

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #1143803

    Dear Enfold-Team/Community,

    a project website has been upgraded to Enfold 4.6.3.1. After configuring the new privacy options and settings (user must accept and user must opt in) I found that Google Tag Manager/Analytics-Code is active even after opting out from tracking (the corresponding cookie aviaPrivacyGoogleTrackingDisabled has been set to true) and also before opting in.

    The Google Tag Manager Code is only used in via Google Services → Google Analytics Tracking Code field.
    I also tried deactivating plugins and resetting server- and client-side caches.

    #1144174

    After checking the file functions-enfold.php I think I found the origin of the behaviour. Enfold is only looking for an Google Analytics Tracking ID and ignoring Google Tag Manager Container IDs which is in a format like GTM-XXXXXX instead of UA-XXXXXXX.
    Maybe you want to include support for Google Tag Manager Container IDs as well?

    Regardless of opting in/opting out or using Google Analytics/Google Tag Manager, wouldn’t it be good _not_ to output the Analytics tag at all when a user didn’t opt in or a user did opt out? When the script is loaded from googletagmanager.com (which you are using in your code) personal data (in this case the ip address of the user) is transmitted to Google servers regardless the window[‘ga-disable-UA-XXXXXXX’] setting, right?

    Btw. I think the ip anonymization on kriesi.at isn’t active: gtag(‘config’, ‘GA_TRACKING_ID’, { ‘anonymize_ip’: true });
    GA_TRACKING_ID needs to be replaced with the actual tracking code I think.

    #1145605

    Hi,

    Thank you for the inquiry.

    Did you include the Google Analytics code in the field? If you want to prevent the tracking code from rendering when “aviaPrivacyGoogleTrackingDisabled” cookie is set, edit the functions-enfold.php file and look for this code around line 956:

    echo $extra_code . $avia_config['analytics_code'];
    

    Above it, add this code:

    if(isset($_COOKIE['aviaPrivacyGoogleTrackingDisabled']) && $_COOKIE['aviaPrivacyGoogleTrackingDisabled'] == true) return;
    

    You can add a condition for the tag manager code in this block.

    $match = array();
    			preg_match( "!UA-[0-9]+-[0-9]+!", $avia_config['analytics_code'], $match );
    
    			if( ! empty( $match ) && isset( $match[0] ) ) 
    			{
    				$UAID = $match[0];
    			}
    

    Best regards,
    Ismael

    #1148156

    Is there a fix scheduled for this? This contravenes legal requirements. ie a user opts out but a cookie is still being set AND data sent to Google.

    #1148455

    Hi,

    Thank you for the update.

    Where we can we reproduce the issue? The tracker should not go through once the “aviaPrivacyGoogleTrackingDisabled” cookie is enabled or when the user opt out, so the modification above is not really necessary. It just prevents the tracking snippet from being rendered when tracking is disabled.

    // https://developers.google.com/analytics/devguides/collection/analyticsjs/user-opt-out

    The ga-disable property is added to the script once the user opt out.

    Best regards,
    Ismael

    #1149909

    hi folks,

    similar problems here, i want to disable tagmanager until “accept all” is clicked by the user.
    tag manager is loaded before, so it does not work with the privacy settings.

    i post more information as private…

    greez
    rene

    #1150396

    Hi,


    @isee
    : How did you add the tag manager snippet? Did you include it in the theme’s Google Analytics field? If so, then you can try the modification to prevent the tag manager snippet from rendering when tracking is disabled.

    // https://kriesi.at/support/topic/privacy-settings-google-tag-manager-analytics-active-even-after-opt-out/#post-1145605

    Best regards,
    Ismael

    #1150897

    hi ismael,

    i tried both, for now i have the JS in the themes settings.
    i also implemented the change above, but not this part:

    $match = array();
    			preg_match( "!UA-[0-9]+-[0-9]+!", $avia_config['analytics_code'], $match );
    
    			if( ! empty( $match ) && isset( $match[0] ) ) 
    			{
    				$UAID = $match[0];
    			}

    as im not sure where or why 8-)

    can you help me what to do? google’s script is still executed

    greez
    rene

    • This reply was modified 5 years, 1 month ago by isee.
    #1151749

    Hi,

    Thank you for the update.

    You should add the tag manager script in the Google Analytics field in the Theme Options > Google Services panel. You can then follow the first modification that we suggested in our previous reply above.

    // https://kriesi.at/support/topic/privacy-settings-google-tag-manager-analytics-active-even-after-opt-out/#post-1145605

    Both snippets will not be added to the page when the “aviaPrivacyGoogleTrackingDisabled” is set.

    Best regards,
    Ismael

    #1151754
    This reply has been marked as private.
    #1152027

    Hi,

    Thank you for following up.

    You don’t need to add the second block of the code. All you need is the if statement, which checks for the presence of the “aviaPrivacyGoogleTrackingDisabled” cookie. This is the line:

    if(isset($_COOKIE['aviaPrivacyGoogleTrackingDisabled']) && $_COOKIE['aviaPrivacyGoogleTrackingDisabled'] == true) return;
    

    Place it above this line as suggested previously.

    echo $extra_code . $avia_config['analytics_code'];
    

    // https://kriesi.at/support/topic/privacy-settings-google-tag-manager-analytics-active-even-after-opt-out/#post-1145605

    Best regards,
    Ismael

    #1152054

    hi ismael,

    i tried like so but….
    still get the cookies

    #1153468

    hi ismael,

    it’s the same with me too. we would be happy to receive a solution here.

    Tobias

    #1154409

    Hi,

    Please do create your own topic so we can be able to manage better.

    Thank you very much

    Best regards,
    Basilis

    #1250086

    hi again @all,

    here is my solution finally. it executes the GTM Tag only if needed so you don’t have problems with Facebook Pixel and other stuff.

    add to functions.php

    // Google Tagmanager einbinden
    function add_custom_gtm_head() {
    ?>
    <!-- Google Tag Manager --><script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-XXXXXXX');</script><!-- End Google Tag Manager -->
    <?php
    }
    function add_custom_gtm_after_body() {
    ?>
    <!-- Google Tag Manager (noscript) --><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><!-- End Google Tag Manager (noscript) -->
    <?php
    }
    if (isset($_COOKIE['aviaPrivacyEssentialCookiesEnabled']) && $_COOKIE['aviaPrivacyEssentialCookiesEnabled'] == true && !isset($_COOKIE['aviaPrivacyGoogleTrackingDisabled'])) {
    	add_action('wp_head', 'add_custom_gtm_head');
    	add_action('ava_after_main_container', 'add_custom_gtm_after_body');
    }

    If you use caching please don’t forget to set these cookies-IDs as an exception!

    aviaPrivacyGoogleTrackingDisabled
    aviaPrivacyGoogleMapsDisabled
    aviaPrivacyGoogleReCaptchaDisabled
    aviaPrivacyGoogleWebfontsDisabled
    aviaPrivacyVideoEmbedsDisabled
    aviaPrivacyMustOptInSetting
    aviaCookieSilentConsent

    greez
    R

    • This reply was modified 4 years, 2 months ago by isee.
    #1250810

    Hi,


    @isee
    : Thank you for sharing the code. This will surely help a lot of users.

    Best regards,
    Ismael

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