Google Analytics & Wordpress

7 replies
Hello,

I want to add my blog to Google Analytics but I don't know where to add the tracking code (the ga.js code).

According to google I need to:

Copy the following code block into every webpage you want to track immediately before the </body> tag.
How would I do this with Wordpress? I looked in the themes editor but didn't see where to put it in the index.php file.

Thanks.
#analytics #google #wordpress
  • Profile picture of the author mistyone
    Hi Alan

    I am not answering your above question but just asking if the analytics plugin would work for you? WordPress › Google Analytics for WordPress WordPress Plugins

    Just a thought and because you have been helpful to me in the past

    I also have a thread that I have just started asking if I can widen a wordpress theme so maybe you may have an answer to that

    Cheers
    Viv
    {{ DiscussionBoard.errors[625290].message }}
    • Profile picture of the author Alan Petersen
      Hi Viv,

      That looks like a nifty plugin! Thanks.

      As to your question...usually on most themes I've used you can control/change that in the CSS file. So go to your theme editor and click on the stylesheet CSS file: style.css

      Although it might vary depending on your theme, here is what mine looks like:

      Code:
      #container { 
      
      background: #ffffff;
      
      width: 860px;
      
      text-align: left; 
      
      margin: 20px auto 30px auto; 
      
      border: 1px solid #cccccc;
      With the CSS file you can change the font type, colors, background color, etc. Before you edit make sure you make a copy with notepad so you can revert back just in case.
      Originally Posted by mistyone View Post

      Hi Alan

      I am not answering your above question but just asking if the analytics plugin would work for you? WordPress › Google Analytics for WordPress WordPress Plugins

      Just a thought and because you have been helpful to me in the past

      I also have a thread that I have just started asking if I can widen a wordpress theme so maybe you may have an answer to that

      Cheers
      Viv
      Signature
      {{ DiscussionBoard.errors[625681].message }}
  • Profile picture of the author GeorgeO7
    Put the analytics code in the footer.php right before the </body> tag.

    You can edit this file with a text editor and FTP it to the server.

    Or you can edit it from WordPress>>Appearance>>Editor>>Footer (footer.php).

    To use the WP editor you will need to make the file writable CHMOD 666.

    George
    {{ DiscussionBoard.errors[625308].message }}
    • Profile picture of the author Alan Petersen
      Originally Posted by GeorgeO7 View Post

      Put the analytics code in the footer.php right before the </body> tag.

      You can edit this file with a text editor and FTP it to the server.

      Or you can edit it from WordPress>>Appearance>>Editor>>Footer (footer.php).

      To use the WP editor you will need to make the file writable CHMOD 666.

      George
      Thanks George, I never thought to look in the footer file for body tags but there they are!

      P.S. I see you're in Minnesota...have you seen our Warrior Forum Mastermind Group meeting thread?

      http://www.warriorforum.com/local-me...minnesota.html
      Signature
      {{ DiscussionBoard.errors[625698].message }}
  • Profile picture of the author carolwingert
    I use the Ultimate Google Analytics plugin (ftp to your site) and then click on settings, click on Ultimate Analytics, and you type the # where indicated.

    That's how I do mine!
    Signature

    Carol Wingert
    http://www.carolwingert.com
    http://www.iPhotographGod.com - Seeing the Divine in Everything!
    https://www.createspace.com/3453951 - 27 Pennsylvania Edible Plants - Full Color!

    {{ DiscussionBoard.errors[625457].message }}
  • Profile picture of the author mistyone
    Hi Alan

    I had already had a play around in the style sheet but all it did was mess with the width of the post and content but it didn't widen the whole theme. It had some wide bits and some not, so it looked as though I would have had to stretch all the boxes if I knew which ones they were. I think I would have been playing around for a while until I found all the relative pieces of code. Maybe I might see if the flexibility2 theme, that I love working with, would work for this plugin but thanks for the more detailed description, it is exactly what this NEWBIE needs
    {{ DiscussionBoard.errors[625989].message }}
  • Profile picture of the author spikyy
    Best way is to add it on your footer.
    {{ DiscussionBoard.errors[648935].message }}

Trending Topics