Created
June 25, 2019 13:01
-
-
Save JeroenSormani/af26582d26aef2184a3bb5f2990642f6 to your computer and use it in GitHub Desktop.
EDD Enhanced Ecommerce Tracking 1.2+ - (Re)move tracking script to the head
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Copy from here | |
if ( function_exists( 'EDD_Enhanced_Ecommerce_Tracking' ) && edd_get_option( 'eddeet_implementation_method' ) == 'measurement-protocol' ) { | |
remove_action( 'wp_footer', array( EDD_Enhanced_Ecommerce_Tracking()->implementation, 'output_script' ) ); | |
// Add to header -- Remove/comment the below if you want to completely remove the tracking script. | |
add_action( 'wp_head', array( EDD_Enhanced_Ecommerce_Tracking()->implementation, 'output_script' ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code doesn't work, it won't be removed if it uses the measurement protocol as that's hooked into
wp_head
, gtag and analytics.js usewp_footer
.Surely this would be better as a filter