-
AuthorPosts
-
October 1, 2019 at 4:09 pm #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.October 2, 2019 at 3:15 pm #1144174After 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.October 7, 2019 at 4:39 am #1145605Hi,
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,
IsmaelOctober 15, 2019 at 5:54 pm #1148156Is 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.
October 16, 2019 at 1:25 pm #1148455Hi,
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,
IsmaelOctober 21, 2019 at 4:50 pm #1149909hi 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
reneOctober 23, 2019 at 7:29 am #1150396Hi,
@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.Best regards,
IsmaelOctober 24, 2019 at 2:51 pm #1150897hi 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.
October 28, 2019 at 1:49 pm #1151749Hi,
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.
Both snippets will not be added to the page when the “aviaPrivacyGoogleTrackingDisabled” is set.
Best regards,
IsmaelOctober 28, 2019 at 2:13 pm #1151754This reply has been marked as private.October 29, 2019 at 11:42 am #1152027Hi,
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'];
Best regards,
IsmaelOctober 29, 2019 at 1:37 pm #1152054hi ismael,
i tried like so but….
still get the cookiesNovember 3, 2019 at 6:48 am #1153468hi ismael,
it’s the same with me too. we would be happy to receive a solution here.
Tobias
November 6, 2019 at 9:10 pm #1154409Hi,
Please do create your own topic so we can be able to manage better.
Thank you very much
Best regards,
BasilisOctober 2, 2020 at 2:20 pm #1250086hi 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.
October 6, 2020 at 11:45 am #1250810 -
AuthorPosts
- You must be logged in to reply to this topic.