• Resolved pako69

    (@pako69)


    Hi

    Because of GDPR we must have the approval to insert any JS. So we use a WordPress plugin that insert 3rd party JS tracking depending on the choice of the user.

    Would it be possible to add a checkbox in the plugin options to insert or not the tracking code? That way this tracking code is injected by our GDPR WordPress plugin.

    For now I just commented out your code in the file wpmautic.php like this, but it’s not a good idea…

    function wpmautic_inject_script() {
    	$base_url = wpmautic_option( 'base_url', '' );
    	if ( empty( $base_url ) ) {
    		return;
    	}
    
    	$attrs = wpmautic_get_tracking_attributes();
    
    	?>
    	<!--
    	<script type="text/javascript">
    	(function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
    		w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
    		m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
    	})(window,document,'script','<?php echo esc_url( $base_url ); ?>/mtc.js','mt');
    
    	mt('send', 'pageview'<?php //echo count( $attrs ) > 0 ? ', ' . wp_json_encode( $attrs ) : ''; ?>);
    </script>
    -->
    	<?php
    }
    

    Thanks

    • This topic was modified 6 years, 1 month ago by pako69.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Make the script insertion optional?’ is closed to new replies.