Google Analytics Code Showing Up In Header

Hi X, I’m webmastering over at https://www.ethiopiareads.org

I’ve been getting issues with the code in the HEAD displaying when it shouldn’t be, on desktop and mobile

I’ve read the other support threads and used the “Insert Headers and Footers” plugin instead of the bundled X one but that is not helping…

Can you please help?

Hello @alexgingras,

Thanks for asking. :slight_smile:

Please try adding the tracking code in child theme function.php file.

function third_party_tracking_code() { ?>

      <script>
       
      // Google Analytics.
      </script>

    <?php }

    add_action( 'wp_head', 'third_party_tracking_code' );  



Replace // Google Analytics. with the tracking code.

In case problem is still there, please share website login details in a secure note for us to take a closer look.

Thanks.

Problem solved actually it was that I put the superficial content before the SCRIPT bits into the code and thus it was displaying on screen.

Thank you :slight_smile:

You are most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.