-
AuthorPosts
-
April 20, 2018 at 9:03 am #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
April 20, 2018 at 6:35 pm #944701Hi 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,
NikkoApril 21, 2018 at 9:07 am #944850Allright, and how do i add this to a button or text link?
What is the link aim?
Thanks
April 21, 2018 at 10:36 am #944869Hi 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, 7 months ago by Nikko.
April 22, 2018 at 2:09 pm #945035How 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 SimonApril 23, 2018 at 3:41 am #945199Hi,
Can you try checking the solutions on these posts:
https://stackoverflow.com/questions/47776687/how-to-create-an-opt-out-option-for-facebook-pixel-in-a-website
Hope this helps.Best regards,
NikkoJune 19, 2018 at 7:49 pm #974897Hi 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?
June 19, 2018 at 7:52 pm #974902Or is it correctly working with this?
<script>if(document.cookie.match(/aviaPrivacyGoogleTrackingDisabled/)){ window['ga-disable-UA-56378302-1'] = true; }</script>
June 19, 2018 at 10:06 pm #975004Hi,
Yes, the code is working just fine and as it should be.
You can always try it by testing in icognito :)Best regards,
BasilisMarch 7, 2019 at 6:52 am #1075798Hello. 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!March 12, 2019 at 5:20 am #1077628Hi Jeepkid99,
Try adding this code at the bottom of your functions.php:
remove_action('wp_footer', 'avia_print_tracking_code', 100);
Best regards,
NikkoApril 9, 2019 at 11:30 pm #1088923Sorry 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);
April 13, 2019 at 4:53 pm #1090393Hi 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-regulationBest regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.