Title: Christian's Replies | WordPress.org

---

# Christian

  [  ](https://wordpress.org/support/users/visualframeworks/)

 *   [Profile](https://wordpress.org/support/users/visualframeworks/)
 *   [Topics Started](https://wordpress.org/support/users/visualframeworks/topics/)
 *   [Replies Created](https://wordpress.org/support/users/visualframeworks/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/visualframeworks/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/visualframeworks/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/visualframeworks/engagements/)
 *   [Favorites](https://wordpress.org/support/users/visualframeworks/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 66 total)

1 [2](https://wordpress.org/support/users/visualframeworks/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/visualframeworks/replies/page/3/?output_format=md)
[4](https://wordpress.org/support/users/visualframeworks/replies/page/4/?output_format=md)
[5](https://wordpress.org/support/users/visualframeworks/replies/page/5/?output_format=md)
[→](https://wordpress.org/support/users/visualframeworks/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ExactMetrics - Google Analytics Dashboard for WordPress (Website Stats Plugin)] Plugin not showing any stats on dashboard after integrating with Cloudflare.](https://wordpress.org/support/topic/plugin-not-showing-any-stats-on-dashboard-after-integrating-with-cloudflare-2/)
 *  Thread Starter [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/plugin-not-showing-any-stats-on-dashboard-after-integrating-with-cloudflare-2/#post-10364616)
 * Disable “asynchronous loading of JavaScript” in Cloudflare, that‘s it.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Analytics Germanized for Google Analytics (GDPR / DSGVO)] Opt-In: Analytics bedarf Seitenwechsel](https://wordpress.org/support/topic/opt-in-analytics-bedarf-seitenwechsel/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/opt-in-analytics-bedarf-seitenwechsel/#post-10360756)
 * Hat sich erledigt…
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Analytics Germanized for Google Analytics (GDPR / DSGVO)] Opt-In: Analytics bedarf Seitenwechsel](https://wordpress.org/support/topic/opt-in-analytics-bedarf-seitenwechsel/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/opt-in-analytics-bedarf-seitenwechsel/#post-10359369)
 * [@aherrmann92](https://wordpress.org/support/users/aherrmann92/)
    Ich weis, es
   ist viel Arbeit gewesen und unfair wenn ich nun frage, jedoch… Wären Sie so freundlich
   und würden mir die snippets zur Verfügung stellen?
 * Ich verzweifle hier um eine DSGVO-komforme Lösung zu gestallten.
 * Vielen Dank im Voraus!
    -  This reply was modified 7 years, 11 months ago by [Christian](https://wordpress.org/support/users/visualframeworks/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] How to block cookies ? Other than _ga](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/page/3/#post-10357884)
 * All instruction are above!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] How to block cookies ? Other than _ga](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/page/3/#post-10357616)
 * I mean its all “BASED” on the script above 😉
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] How to block cookies ? Other than _ga](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/page/3/#post-10357419)
 * It depends all on the script above wich is a simple script to add a opt out cookie
   for google analytics (Here my js code “JS-SCRIPT-NAME”:). You have to include
   this .js script and change the GA ID.
 * Description is simple:
    if is not is_allowed_cookie=_ga then it will put a ga-
   disable-xxx cookie. That is the default if you visit the website. So no _ga cookie
   is set.
 * If you agree to the cookies the ga-disable-xxx cookie will be deleted and after
   refresh _ga cookies will be loaded.
 * If you decide to disagree (disable) the google analytics in the privacy settings,
   the ga-disable-xxx cookie will be set again and the _ga cookies will be deleted.
 * So this will give you the option to use a cache plugin.
    -  This reply was modified 7 years, 11 months ago by [Christian](https://wordpress.org/support/users/visualframeworks/).
    -  This reply was modified 7 years, 11 months ago by [Christian](https://wordpress.org/support/users/visualframeworks/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] How to block cookies ? Other than _ga](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/page/3/#post-10357298)
 * Now I guess its nearly perfect:
 *     ```
       // GDPR WP
       add_action( 'init', 'gdpr_ga_opt_out', 1 );
       function gdpr_ga_opt_out() {
       	$cookie_name = 'ga-disable-UA-XXXXXXXX-X'; // ENTER YOUR GA ID
       	if ( ! is_allowed_cookie( '_ga' ) ) {
       		$cookie_value = 'true';
       		setcookie($cookie_name, $cookie_value, time() + (86400 * 425), '/'); // 86400 = 1 day in this case 14month
             	setcookie('_ga', NULL, time() - 3600, '/', '.yourdomain.com');
             	setcookie('_gat', NULL, time() - 3600, '/', '.yourdomain.com');
             	setcookie('_gid', NULL, time() - 3600, '/', '.yourdomain.com');
       	} else {
             	setcookie($cookie_name, NULL, time() - 3600, '/'); // 3600 = 1 hour
       	}
       }
       ```
   
 * Feel free to use and report if it fits your needs.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] Privacy policy link](https://wordpress.org/support/topic/privacy-policy-link-2/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/privacy-policy-link-2/#post-10357076)
 * Thats the “Large” text in the GDPR Settings at the bottom.
    Go to GDPR > Settings
   Down at the bottom is the section Consents Add a consent “Privacy Policy” Set
   the Page of your Privacy Policy to this Consent (by selecting) Then enter a Text
   you like even with a `<a href="link-to-privacy-policy">privacy policy</a>`
 * And done.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] Privacy policy link](https://wordpress.org/support/topic/privacy-policy-link-2/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/privacy-policy-link-2/#post-10356518)
 * If you mean that you want to link the privacy policy in your Text it is a simple
   link that you have to put in.
 * If you mean the whole block created in the popup menu, you have to insert a consent
   down at the bottom of the GDPR settings with lable Privacy Policy that includes
   also to set the privacy policy page.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ExactMetrics - Google Analytics Dashboard for WordPress (Website Stats Plugin)] Need to wrap The output code of ga](https://wordpress.org/support/topic/need-to-wrap-the-output-code-of-ga/)
 *  Thread Starter [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/need-to-wrap-the-output-code-of-ga/#post-10355497)
 * Yeah, I managed it with javascript:gaOptout() in a smart way to use the opt-out
   cookie. THX.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] How to block cookies ? Other than _ga](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/page/3/#post-10353601)
 * The only thing that I noticed so far is, that if you select _ga to be disabled
   and you recheck the settings the toggle is always set to on. The cookie works
   and it also stops tracking but it is wired. I expect to see the toggle set to
   off, if the cookie value is set to “false”.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] How to block cookies ? Other than _ga](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/page/3/#post-10351257)
 * Here my js code “JS-SCRIPT-NAME”:
 *     ```
       jQuery(document).ready(function(){
   
       jQuery('#GAOptOut').click(function() {
           gaOptout();
           GAOptOutFeedback ();
       })
   
       if (document.cookie.indexOf(disableStr + '=true') > -1) {
           GAOptOutFeedback ();
       }
   
       function GAOptOutFeedback () {
           jQuery('#GAOptOutBr').before(navigator.appName+'-');
           jQuery('#GAOptOutDom').after('<a href="'+window.location.origin+'">'+window.location.origin+'</a>');
           jQuery('#GAOptOutFeedback').remove();
           jQuery('#GAOptOutStatus').after().html(translations.gap_label);
       };
   
       });
   
       var gaProperty = 'UA-XXXXXXXX-X';
   
       // Disable tracking if the opt-out cookie exists.
       var disableStr = 'ga-disable-' + gaProperty;
       if (document.cookie.indexOf(disableStr + '=true') > -1) {
         window[disableStr] = true;
       }
   
       // Opt-out function
       function gaOptout() {
         document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/;';
         window[disableStr] = true;
       }
   
       function _gaLt(event){
       	var el = event.srcElement || event.target;
   
       	/* Loop up the tree through parent elements if clicked element is not a link (eg: an image in a link) */
       	while(el && (typeof el.tagName == 'undefined' || el.tagName.toLowerCase() != 'a' || !el.href))
       		el = el.parentNode;
   
       	if(el && el.href){
       		if(el.href.indexOf(location.host) == -1){ /* external link */
       			ga("send", "event", "Outgoing Links", "Click", el.href, document.location.pathname + document.location.search);
       			/* if target not set then delay opening of window by 0.5s to allow tracking */
       			if(!el.target || el.target.match(/^_(self|parent|top)$/i)){
       				setTimeout(function(){
       					document.location.href = el.href;
       				}.bind(el),500);
       				/* Prevent standard click */
       				event.preventDefault ? event.preventDefault() : event.returnValue = !1;
       			}
       		}
   
       	}
       }
   
       /* Attach the event to all clicks in the document after page has loaded */
       var w = window;
       w.addEventListener ? w.addEventListener("load",function(){document.body.addEventListener("click",_gaLt,!1)},!1)
         : w.attachEvent && w.attachEvent("onload",function(){document.body.attachEvent("onclick",_gaLt)});
       ```
   
 * html code:
    `<p>text, <a id="GAOptOut" href="javascript:void(0);" onclick="ga('
   send','event','outbound','click','Google Analytics Opt Out');">Click to Opt Out
   </a>. <span id="GAOptOutStatus" class="hiding"></span>&nbsp;<span id="GAOptOutDom"
   class="hiding"></span></p>`
 * function code for translation:
 *     ```
       function theme_scripts()  { 
       wp_register_script( 'JS-SCRIPT-NAME', get_stylesheet_directory_uri().'PATH-TO-SCRIPT/SCRIPT');
       	$translation_array = array(
       		'gap_label' => __( '<span id="GAOptOutFeedback">Opt-Out-Cookie set for:</span>', 'text-domain' )
       	);
       	wp_localize_script( 'JS-SCRIPT-NAME, 'translations', $translation_array );
       	wp_enqueue_script( 'JS-SCRIPT-NAME, get_stylesheet_directory_uri().'PATH-TO-SCRIPT/SCRIPT', array(), '1.0.0', false );
       }
       add_action('wp_enqueue_scripts', 'theme_scripts');
       ```
   
    -  This reply was modified 7 years, 11 months ago by [Christian](https://wordpress.org/support/users/visualframeworks/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] How to block cookies ? Other than _ga](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/page/3/#post-10351152)
 * I think I got it (but need more testing, please help!)
    There are some js.scripts
   to manualy set the disable cookie for google analytics. This is what is the base
   of my choice.
 * I do not set the window disable ua via functions.php, I only set the exact cookie.
   And if the _ga is set to true, it will change the value of the cookie from true
   to false.
 * So cache plugin YEAH!
 * But like I sad, please need some more testing on this if it really works in every
   enviroment. THX!
 *     ```
       add_action( 'init', 'gdpr_ga_opt_out' );
       function gdpr_ga_opt_out() {
       	if ( ! is_allowed_cookie( '_ga' ) ) {
       		$cookie_name = 'ga-disable-UA-XXXXXXXX-X';
       		$cookie_value = 'true';
       		setcookie($cookie_name, $cookie_value, time() + (86400 * 30), '/'); // 86400 = 1 day
       	} else {
       		$cookie_name = 'ga-disable-UA-XXXXXXXX-X';
       		$cookie_value = 'false';
       		setcookie($cookie_name, $cookie_value, time() + (86400 * 30), '/'); // 86400 = 1 day
       	}
       }
       ```
   
    -  This reply was modified 7 years, 11 months ago by [Christian](https://wordpress.org/support/users/visualframeworks/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] How to block cookies ? Other than _ga](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/page/2/#post-10349834)
 * I am trying to solve it in this way. To set a cookie – but it will not work.
   
   Could someone gimme a hand? I need to delete the cookie. That does not work.
 *     ```
       add_action( 'init', 'gdpr_ga_opt_out' );
       function gdpr_ga_opt_out() {
       	if ( ! is_allowed_cookie( '_ga' ) ) {
       		$cookie_name = 'ga-disable-UA-XXXXXXXX-X';
       		$cookie_value = 'true';
       		setcookie($cookie_name, $cookie_value, time() + (86400 * 30), '/');
       	}
       }
       add_action( 'init', 'gdpr_ga_opt_in' );
       function gdpr_ga_opt_in() {
       	if ( is_allowed_cookie( '_ga' ) ) {
                       $cookie_name = 'ga-disable-UA-XXXXXXXX-X';
                       unset($_COOKIE[$cookie_name]);
                       $res = setcookie($cookie_name, '', time() - 3600);
               }
       }
       ```
   
    -  This reply was modified 7 years, 11 months ago by [Christian](https://wordpress.org/support/users/visualframeworks/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GDPR] How to block cookies ? Other than _ga](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/)
 *  [Christian](https://wordpress.org/support/users/visualframeworks/)
 * (@visualframeworks)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/how-to-block-cookies-other-than-_ga/page/2/#post-10349535)
 * Tried it with several browsers and devices and all the same. If you visit the
   website and you decide to allow _ga (or other cookies), the second person wich
   descides to NOT allow these cookies will be trackable (visit the same pages as
   the first one). And vice versa.
    -  This reply was modified 7 years, 11 months ago by [Christian](https://wordpress.org/support/users/visualframeworks/).
    -  This reply was modified 7 years, 11 months ago by [Christian](https://wordpress.org/support/users/visualframeworks/).

Viewing 15 replies - 1 through 15 (of 66 total)

1 [2](https://wordpress.org/support/users/visualframeworks/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/visualframeworks/replies/page/3/?output_format=md)
[4](https://wordpress.org/support/users/visualframeworks/replies/page/4/?output_format=md)
[5](https://wordpress.org/support/users/visualframeworks/replies/page/5/?output_format=md)
[→](https://wordpress.org/support/users/visualframeworks/replies/page/2/?output_format=md)