Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1215303

    I’m trying to install Google Tags on a website. Previous questions to you all seemed to ask only about adding a single section of code, but now Google wants two sections of code added.
    Their instructions for the first set of code is:
    Paste this code as high in the <head> of the page as possible:
    Their instructions for the second set of code is:
    Additionally, paste this code immediately after the opening <body> tag:
    I tried to follow this forum thread to add my code, but it just broke the site…
    https://community.theme.co/forums/topic/wherehow-to-install-google-tag-manager-code-using-child-theme/
    Can you give me some idea how it should go? From the above link I understand it goes in the functions.php file in my child theme, but any further assistance would be appreciated.

    And, just out of curiosity, is there a better way of doing this than via the functions.php file in my child theme?

    Thanks.

    Site: WhidbeyCamanoIslands.com
    WP Version: 4.6.1
    X Version: 4.6.4
    Cornerstone version: 1.3.3

    #1215662
    Friech
    Moderator

    Hi There,

    Thanks for writing in!

    To place the code in the <head> of the page, add the code below on your child theme’s functions.php file.

    add_action('wp_head','my_code1', 1);
    function my_code1 () { ?>
    
    <!-- PASTE YOUR CODE HERE --> 
    
    <?php }

    Then this one is immediately after the opening <body> tag, also add this on your child theme’s functions.php file.

    add_action('x_before_site_begin','my_code2');
    function my_code2 () { ?>
    
    <!-- PASTE YOUR second CODE HERE --> 
    
    <?php }

    Hope it helps, Cheers!

    #1218435

    This worked perfectly. Thanks…. again!

    #1218592
    Nico
    Moderator

    Happy to hear that

    Feel free to ask us again.

    Thanks.

  • <script> jQuery(function($){ $("#no-reply-1215303 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>