Title: Make the script insertion optional?
Last modified: February 4, 2020

---

# Make the script insertion optional?

 *  Resolved [pako69](https://wordpress.org/support/users/pako69/)
 * (@pako69)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/make-the-script-insertion-optional/)
 * 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, 3 months ago by [pako69](https://wordpress.org/support/users/pako69/).

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

 *  Plugin Author [shulard](https://wordpress.org/support/users/shulard/)
 * (@shulard)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/make-the-script-insertion-optional/#post-12398587)
 * Hello !
 * Of course 🙂
 * We already identified this issue on the Github tracker but I haven’t found the
   time to work on it… It’ll been done ASAP in the next extension release.
 * If you have some time, I’ll be glad to review your commits ^^
 * [https://github.com/mautic/mautic-wordpress/issues/77](https://github.com/mautic/mautic-wordpress/issues/77)
 *  Thread Starter [pako69](https://wordpress.org/support/users/pako69/)
 * (@pako69)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/make-the-script-insertion-optional/#post-12463200)
 * script_location > Thank you so much!
 *  Plugin Author [shulard](https://wordpress.org/support/users/shulard/)
 * (@shulard)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/make-the-script-insertion-optional/#post-12463207)
 * You’re welcome 🙂

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

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

 * ![](https://ps.w.org/wp-mautic/assets/icon.svg?rev=3337392)
 * [WP Mautic](https://wordpress.org/plugins/wp-mautic/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-mautic/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-mautic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-mautic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-mautic/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [shulard](https://wordpress.org/support/users/shulard/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/make-the-script-insertion-optional/#post-12463207)
 * Status: resolved