• Resolved gnorro

    (@gnorro)


    Hi

    I’ts not clear for me what to place in code snipped textarea in plugin settings.

    For example I have google analytics inserted by a WP plugin called Insights that insert this code:

    
    <!-- This site uses the Google Analytics by MonsterInsights plugin v7.1.0 - Using Analytics tracking - https://www.monsterinsights.com/ -->
    <script type="text/javascript" data-cfasync="false">
    	var mi_version         = '7.1.0';
    	var mi_track_user      = true;
    	var mi_no_track_reason = '';
    	
    	var disableStr = 'ga-disable-UA-XXXXXX-X';
    
    	/* Function to detect opted out users */
    	function __gaTrackerIsOptedOut() {
    		return document.cookie.indexOf(disableStr + '=true') > -1;
    	}
    
    	/* Disable tracking if the opt-out cookie exists. */
    	if ( __gaTrackerIsOptedOut() ) {
    		window[disableStr] = true;
    	}
    
    	/* Opt-out function */
    	function __gaTrackerOptout() {
    	  document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
    	  window[disableStr] = true;
    	}
    	
    	if ( mi_track_user ) {
    		(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    			(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    			m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    		})(window,document,'script','//www.google-analytics.com/analytics.js','__gaTracker');
    
    		__gaTracker('create', 'UA-XXXXXX-X', 'auto');
    		__gaTracker('set', 'forceSSL', true);
    		__gaTracker('send','pageview');
    	} else {
    		console.log( "" );
    		(function() {
    			/* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */
    			var noopfn = function() {
    				return null;
    			};
    			var noopnullfn = function() {
    				return null;
    			};
    			var Tracker = function() {
    				return null;
    			};
    			var p = Tracker.prototype;
    			p.get = noopfn;
    			p.set = noopfn;
    			p.send = noopfn;
    			var __gaTracker = function() {
    				var len = arguments.length;
    				if ( len === 0 ) {
    					return;
    				}
    				var f = arguments[len-1];
    				if ( typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function' ) {
    					console.log( 'Not running function __gaTracker(' + arguments[0] + " ....) because you are not being tracked. " + mi_no_track_reason );
    					return;
    				}
    				try {
    					f.hitCallback();
    				} catch (ex) {
    
    				}
    			};
    			__gaTracker.create = function() {
    				return new Tracker();
    			};
    			__gaTracker.getByName = noopnullfn;
    			__gaTracker.getAll = function() {
    				return [];
    			};
    			__gaTracker.remove = noopfn;
    			window['__gaTracker'] = __gaTracker;
    					})();
    		}
    </script>
    <!-- / Google Analytics by MonsterInsights -->
    

    Do I have to put all this code inside textarea?
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey @gnorro,

    You can put that in the ‘Code Snippet’ field, make sure you select the ‘Do not wrap my code snippet’ option at the ‘Code Wrap’ setting right under ‘Code Snippet’.

    Kind regards,

    Merijn Molenaar

    Thread Starter gnorro

    (@gnorro)

    ok thanks

    so every <script> code should be removed from any wordpress page or plugin and placed only in WP GDPR Compliance contents? Is this right?

    About Google Adsense. I have a plugin where I can define some <script> that correspond to differend banner types. And I place the related shortcode inside php pages where I want these banner to appear. I shouldn’t use that plugin, but if I define those scripts in your plugin configuration I have to choose “head” or “footer”, and this is not correct because I need to place them in different part of pages. How can I manage this with your plugin?

    About contents. Is there a way to enable default one? I don’t want to make it required, mean I want, for example, Google Analytics code enabled default: So if a user doesn’t want it, it can disable.

    Thanks

    Hey @gnorro,

    so every <script> code should be removed from any wordpress page or plugin and placed only in WP GDPR Compliance contents? Is this right?

    No, when you put the code in <script> in the code snippet field you can select if you want to wrap it in <script> tags at the Code Wrap option below. So, you can put the code with script tags in yourself, and then disable the option where we wrap the code for you. Or you can leave it out, and then select the options where we will wrap the code for you. That is your own decision. This only influences the consents you added in the consent area of our plugin. The rest of your scripts will not be influenced at all.

    About Google Adsense. I have a plugin where I can define some <script> that correspond to differend banner types. And I place the related shortcode inside php pages where I want these banner to appear. I shouldn’t use that plugin, but if I define those scripts in your plugin configuration I have to choose “head” or “footer”, and this is not correct because I need to place them in different part of pages. How can I manage this with your plugin?

    This is not possible with our plugin and to be honest I am not sure if it will be added at all or any soon.

    About contents. Is there a way to enable default one? I don’t want to make it required, mean I want, for example, Google Analytics code enabled default: So if a user doesn’t want it, it can disable.

    GDPR requires that consent checkboxes are unchecked(opt-out), so this is not possible.

    Kind Regards,

    Merijn Molenaar

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Code snippet explanation’ is closed to new replies.