Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimcoleman/0f5168d84cb23d37c780ead62f3885b4 to your computer and use it in GitHub Desktop.
Save kimcoleman/0f5168d84cb23d37c780ead62f3885b4 to your computer and use it in GitHub Desktop.
Fallback to add GTM to body of page.
<?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