Created
April 7, 2022 13:19
-
-
Save kimcoleman/0f5168d84cb23d37c780ead62f3885b4 to your computer and use it in GitHub Desktop.
Fallback to add GTM to body of page.
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 | |
/** | |
* Fallback to add GTM to body of page. | |
* | |
*/ | |
function pmpro_add_google_tag_manager_to_body() { | |
// Don't track admins. | |
if ( current_user_can( 'manage_options' ) ) { | |
return; | |
} ?> | |
<!-- Google Tag Manager (noscript) --> | |
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-YOURIDHERE" | |
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> | |
<!-- End Google Tag Manager (noscript) --> | |
<?php | |
} | |
add_action( 'memberlite_before_page', 'pmpro_add_google_tag_manager_to_body' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment