Where should I put the Google Analytics code in my wordpress blog?

Discussion in 'WordPress' started by adking, May 6, 2008.

  1. #1
    Can someone please tell me where to put the google analytics code in my wordpress blog using a custom theme?

    Thanks in advance....
     
    adking, May 6, 2008 IP
  2. mizaks

    mizaks Well-Known Member

    Messages:
    2,066
    Likes Received:
    126
    Best Answers:
    0
    Trophy Points:
    135
    #2
    Where do you want the ads to appear?
     
    mizaks, May 6, 2008 IP
  3. MTbiker

    MTbiker Well-Known Member

    Messages:
    2,536
    Likes Received:
    123
    Best Answers:
    0
    Trophy Points:
    170
    #3
    Put it in the footer.php file (of the theme you are using) right before the </body> tag.
     
    MTbiker, May 6, 2008 IP
  4. adking

    adking Peon

    Messages:
    593
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What are you talking about? I was asking about google analytics not adsense.. thanks newaz...
     
    adking, May 6, 2008 IP
  5. adking

    adking Peon

    Messages:
    593
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ok, will try that and let you know the results..
     
    adking, May 6, 2008 IP
  6. gotlinks

    gotlinks Notable Member

    Messages:
    2,982
    Likes Received:
    162
    Best Answers:
    0
    Trophy Points:
    245
    #6
    I put it in my footer.php file.
     
    gotlinks, May 6, 2008 IP
  7. asterix

    asterix Well-Known Member

    Messages:
    1,095
    Likes Received:
    97
    Best Answers:
    0
    Trophy Points:
    165
    #7
    check this plugins for wordpress
    h**p://wordpress.org/extend/plugins/google-analytics-for-wordpress/
     
    asterix, May 6, 2008 IP
    pipes likes this.
  8. godsofchaos

    godsofchaos Peon

    Messages:
    2,595
    Likes Received:
    124
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Simply download the Google analytics plugin, its super lite and doesnt require you to change or do anything!
     
    godsofchaos, May 6, 2008 IP
  9. themanbeast9

    themanbeast9 Active Member

    Messages:
    1,665
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    90
    #9
    If you don't download the plugin, then place it in the footer.php. You can place it in the header, but the loading times slow down.
     
    themanbeast9, May 6, 2008 IP
  10. Panzer

    Panzer Active Member

    Messages:
    381
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #10
    Header/Footer won't matter.

    Just go to your theme editor, find where it includes other javascripts (Probably in the header.php file) and just paste the code in there.
     
    Panzer, May 6, 2008 IP
  11. MTbiker

    MTbiker Well-Known Member

    Messages:
    2,536
    Likes Received:
    123
    Best Answers:
    0
    Trophy Points:
    170
    #11
    Well the problem (or the blessing) of putting it in the header instead of the footer is that it loads before the page loads. Having the code in the footer shows that the page actually loaded, while the code could load in the header without the visitor seeing the page (clicks the back button real quick, hits "stop loading page", etc)

    However, if you are planning to sell your website and want to inflate your stats slightly, you could place your tracking code in the header :rolleyes:
     
    MTbiker, May 6, 2008 IP
  12. mizaks

    mizaks Well-Known Member

    Messages:
    2,066
    Likes Received:
    126
    Best Answers:
    0
    Trophy Points:
    135
    #12

    Whoops. Misread. As most everyone said, put it in the footer.php before the </body> tag.
     
    mizaks, May 6, 2008 IP
  13. egonitron

    egonitron Well-Known Member

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #13
    Yup, just throw it in the footer. If you have other stuff in the footer (like javascript from other ad networks or other tracking software like Mybloglog or something,) I'd put it above all those to make sure it gets loaded first so you'll get more accurate results.
     
    egonitron, May 7, 2008 IP
  14. pipes

    pipes Prominent Member

    Messages:
    12,766
    Likes Received:
    958
    Best Answers:
    0
    Trophy Points:
    360
    #14
    Thanks very much for the link asterix.
     
    pipes, May 7, 2008 IP
  15. Jalpari

    Jalpari Notable Member

    Messages:
    5,640
    Likes Received:
    137
    Best Answers:
    0
    Trophy Points:
    260
    #15
    download analytics plugin or add code manually in footer.php, header.php , or index.php file <body> code goes here </body>
     
    Jalpari, May 8, 2008 IP