Adding Google Analytics to Customizr 75

If you’re not a developer, you can refer to this complete documentation on setting up your Google Analytics tracking code with a plugin.


Here’s a quick snippet to add Google Analytics tracking’s code to your website.

Where to copy/paste this code? => in your functions.php file of a child theme. I strongly recommend you create a child theme. Download a start-up child theme here.

Everything you need to know about child theme with Customizr here.



  • Joti Kang

    Nicolas – I’ve implemented the GA code per your snippet instructions in the functions.php file at the very end. It seems to be firing just fine. My question is that it is firing within the tag, but Google recommends we have the tag fire in the very top of the tag. How can we get the google tag we put in functions.php file to fire at the top of the tag, instead of firing in ?

    • Menaka S

      In that case, you can replace the hook.
      Change this line

      to this

      • Joti Kang

        @menakasmenakas:disqus Thanks for the help!

        add_action(‘__before_header’,’my_analytics’, 20);
        I believe this would fire the code before the . I would like to fire the code after and in very beginning of .

        Is there a hook for firing code at very beginning of ?

        • Menaka S

          Hi Joti Kang,
          Did you try it?
          The header is not the same as the head.
          The header is the top portion of the body of the page. So, __before_header is actually beginning of the body.
          Do try it and let me know.

          • Joti Kang

            @menakasmenakas:disqus – I had not tried your suggestion earlier (as you can now tell, I’m a novice. My apologies). I just tried it now and it is firing in the beginning of body just as we needed it to fire!

            Thanks you amazing help!