Skip to content

Instantly share code, notes, and snippets.

@wplit
Last active June 20, 2019 04:52
Show Gist options
  • Save wplit/632785cb975dace8d9a96806a357d842 to your computer and use it in GitHub Desktop.
Save wplit/632785cb975dace8d9a96806a357d842 to your computer and use it in GitHub Desktop.
Call function that inserts google tag manager code just after opening body tag (for use with Oxygen & Duracell Tomi's Google Tag Manager for WordPress)
add_action( 'plugins_loaded', 'lit_oxy_gtm' );
function lit_oxy_gtm() {
if( class_exists( 'CT_Component' ) ) {
add_action( 'ct_before_builder', 'lit_add_gtm_tag' );
}
}
/**
* Call function that inserts google tag manager code just after opening body tag
* See (https://wordpress.org/plugins/duracelltomi-google-tag-manager/)
*/
function lit_add_gtm_tag() {
if ( function_exists( 'gtm4wp_the_gtm_tag' ) ) {
gtm4wp_the_gtm_tag();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment