Google Analytics and WordPress–Where to put the Script?

google analytics logoI just started using Google Analytics (GA) to monitor my Web site, and I had a problem knowing where to put the Google script code on the site.

I was originally putting it inside each individual post. But that was causing a problem with having to remember to maintain it for each post. It also didn’t cover some of the generated content such as my Category pages, Search pages, my subscription pages, and a few others. I also found that my pages weren’t showing up under GA analysis.

I started researching and found that for WordPress, a good place to put the GA script is in the footer.php file, right in front of the /body statement at the bottom of the code. Once I put the script in footer.php, my Web pages started showing up in Google Analytics tracking.

wordpress wtwitter iconjoe hertvik linkedin button

About Joe Hertvik

Joe is the owner of Hertvik Business Services, a service company providing written white papers, case studies, and other marketing content to computer industry companies. He is also a contributing editor for IT Jungle and has written the Admin Alert column for the past ten years. Follow Joe Hertvik on Twitter @JoeHertvik. Email Joe for a free quote on white papers, case studies, brochures, or other marketing materials.
This entry was posted in Blogging & Publishing. Bookmark the permalink.

Leave a Reply

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