Forum Replies Created

Viewing 15 replies - 1 through 15 (of 66 total)
  • Thread Starter Christian

    (@visualframeworks)

    Disable “asynchronous loading of JavaScript” in Cloudflare, that‘s it.

    Christian

    (@visualframeworks)

    Hat sich erledigt…

    Christian

    (@visualframeworks)

    @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 6 years, 9 months ago by Christian.
    Christian

    (@visualframeworks)

    All instruction are above!

    Christian

    (@visualframeworks)

    I mean its all “BASED” on the script above ??

    Christian

    (@visualframeworks)

    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 6 years, 9 months ago by Christian.
    • This reply was modified 6 years, 9 months ago by Christian.
    Christian

    (@visualframeworks)

    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
    In reply to: [GDPR] Privacy policy link
    Christian

    (@visualframeworks)

    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
    In reply to: [GDPR] Privacy policy link
    Christian

    (@visualframeworks)

    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.

    Thread Starter Christian

    (@visualframeworks)

    Yeah, I managed it with javascript:gaOptout() in a smart way to use the opt-out cookie. THX.

    Christian

    (@visualframeworks)

    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”.

    Christian

    (@visualframeworks)

    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 6 years, 9 months ago by Christian.
    Christian

    (@visualframeworks)

    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 6 years, 9 months ago by Christian.
    Christian

    (@visualframeworks)

    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 6 years, 9 months ago by Christian.
    Christian

    (@visualframeworks)

    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 6 years, 9 months ago by Christian.
    • This reply was modified 6 years, 9 months ago by Christian.
Viewing 15 replies - 1 through 15 (of 66 total)