Where do I put Google Analytics code?


I’ve installed WordPress at the root of my domain and I want to use Google Analytics to monitor traffic, etc.

What file should I put Google code in to get data for my whole site?


Your main index template, at least … maybe also in your pages or other special templates, depending upon your site’s design and theming. :wink:



in post-template.php
all of the above?

(thank you for your help)


Well, it all depends upon your site. You might actually have a lot better luck just using one of the many Google analytics plug-ins that are available for WordPress.

I don’t know why I didn’t think of that earlier when I first responded; it should be a lot easier than embedding the code in your templates.

Check via Google or on the WordPress Extensions site (maybe "Google Analytics For WordPRess"?), and you should find something you like that will make life a lot easier. :wink:



will do rlp, thanks again.


No Problem, and you are welcome! Good luck, and post back letting us know which one you chose! :wink:



I use Google Analyticator.

3 extra lifetime domains and $52 off with code [color=#CC0000]3DOM52[/color] or use [color=#CC0000]LM97[/color] for $97 off. More Dreamhost coupons