Skip to content

Snippet: How To Properly Add Google Tag Manager Code

// Add Google Tag Manager Code after opening body tag
add_action( 'wp_body_open', function() { ?>
    YOUR CODE HERE
<?php } );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top