Google Analytics & Wordpress

by 7 replies
8
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:

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.
#programming #analytics #google #wordpress
  • 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
    • [1] reply
    • 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



      Code:
      #container { 
      
      background: #ffffff;
      
      
      
      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.
  • 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
    • [1] reply
  • 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!
  • 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
  • Best way is to add it on your footer.

Next Topics on Trending Feed