Skip to content
Site Under Re-Design: We're updating & improving the docs! Some layouts or content may look broken or inconsistent during this process.

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