Adding Google Analytics to Customizr 26


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.

 

 


About Nicolas

My name is Nicolas Guillaume (nikeo). I am the developer of the WordPress Customizr Theme. This website is a discussion platform, your comments are welcome!


26 thoughts on “Adding Google Analytics to Customizr

  • Reply
    ben boldt

    Can the alternative method of adding the google code in the header section be used? If it can what need to be done?

    Thank you

  • Reply
    ben boldt

    Hello again, My site using the customizr theme is a subdomain of another site. The subdomain site does not have the “function.php” file showing. Can the google meta tag still be added somewhere so that the site can be verified?

  • Reply
    Paula

    Hi,

    I had done what you put on this post and when I save the functions.php with the new code the page can not be uploaded, and I can´t access to the wp-admin. I don´t know what happenned. Please I need some quick help, I am a little bit worried.

    Thank you so much.
    Paula.

    • Reply
      Nicolas Post author

      Hi Paula, there must have been some error in the code : upload a new clean version of your functions.php to your server.
      Hope this will help.
      PS : if you still have issues :
      1) always make a backup of your files before starting to develop.
      2) please continue this discussion on the WordPress forum

  • Reply
    John

    My website is letoutsidein.com. I followed the code snippet by nikeo, and cannot seem to get tracking installed. Here is the code, placed in a functions.php child theme:

  • Reply
    Stamatis Kanatas

    Hello!Since i upload my site from localhost to internet host i cant edit the functions.php file because i dont have the permissions…What goes wrong?

  • Reply
    Sandra

    Could someone add a more detailed example of where to add the code in the functions.php file? I’m not very knowledgeable in .php. Thanks!

  • Reply
    ElectricFeet

    Hi Nicolas, could you update to say “Use the following code in the functions.php file of your child theme:”
    Someone on the forum tried adding it to the theme’s function.php.

  • Reply
    ebwally

    I”m so confused! I’m just a layman with a dream. Hi Nicolas – thanks for your beautiful theme. I love it – though I’m not using it to its full potential I’m sure. I”m writing because my site http://www.brooklynartsforkids.com does not come up when you google Brooklyn Arts for Kids – I have tried to verify and do what Webmaster Tools suggested but nothing is working. Help! I don’t know where to add tags to a page or how to easily alert Google of our whereabouts. Thanks for any and all help. With best wishes, ebwally

  • Reply
    Richard

    Thanks Nicolas I’ve spent half a day scouring the net trying work out how to get verified. I should’ve came here for advice first. ;)

    Can I use the same snippet for Bing and Alexa?

  • Reply
    Rick Cantu

    Hello. Newbie at HTML here. I added the following to header.php as Google wanted me to add (and maintain) the code below in the header section of my website for domain verification purposes. When I added the code as shown below, the text boxes in the sliders were thrown out of position (they were no longer appearing centered). Once I removed the code, everything looked normal again. What am I doing wrong? I played with some plugins that were supposed to lead to Google reading meta tags on my site but they didn’t work. Thanks for your help!

    ***CODE ADDED***

    ***THIS IS WHERE I ADDED IT***

    <?php
    /**
    * The Header for Customizr.
    *
    * Displays all of the section and everything up till
    *
    * @package Customizr
    * @since Customizr 1.0
    */
    ?>

  • Reply
    Sean Smith

    Does the same go for using the Google Webmaster Tools code for verifying ownership of a website? Should I use the same code and just replace the analytics … with the ?

    Google Webmaster Tools tells me to place the within the of my homepage. But of course the head is added to the header.php via a hook in Customizr theme so I’m not exactly sure where to put this code.

    Thanks in advance for any advice.

    Sean

    • Reply
      Nicolas Post author

      Hi Sean, I confirm that you can use the same snippet to handle the Webmaster Tools verification.

      You can just add the conditional code to display this code only on home page, with the Customizr built-in helper : tc__f(‘__is_home’).

      Best

Leave a Comment

Your email address will not be published. Required fields are marked *

Do you need to share some code? To display it in a nice looking syntax highlighter, wrap your code between the following tags (css code in this example) : <pre class="lang:css">YOUR CODE</pre> ( possible code language acronyms : css, php, xhtml, javascript, sql)

You may also use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">