Move Google Tag Manager code snippet up higher?

Hi I am reading this thread: https://theme.co/apex/forums/topic/install-google-tag-manager/

Very helpful.

However the second code snippet does not show up immediately after the opening body tag. Here is the current source code:

<body class="home page-template page-template-template-blank-4 page-template-template-blank-4-php page page-id-322 x-integrity x-integrity-light x-full-width-layout-active x-content-sidebar-active x-post-meta-disabled pro-v1_1_1 x-child-theme-active cornerstone-v2_0_6">

  <div id="x-root"  class="x-root"  >

    
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Is there any way to modify the code given to move it above the <div id="x-root" class="x-root" > ?

Here is the PHP code from the other post for reference:

function gtm_body(){
?>

<!-- Google Tag Manager code goes here -->

<?php 
}
add_action( 'x_before_site_begin', 'gtm_body' );

Thanks!

Hi There,

Thank you for writing in! That thread you linked is when before we add the x-root div on X5. Please follow this post instead for the Google Tag Manager (noscript) code.

Cheers!