Library Technology - Reviews, Tips, Giveaways, Freeware

Library Technology – Reviews, Tips, Giveaways, Freeware

How to Add Google Analytics Tracking Code to your WordPress Blog without a Plugin

Posted In Webmaster, WordPress, Wordpress tips - By Techtiplib on Thursday, January 3rd, 2013 With No Comments »

Plugins can introduce bugs, security issues, and degrade performance. This tech-recipe demonstrates the most simple and secure way to add Google Analytics to your WP blog (see Step by Step to Install WordPress Manually).

If performing a simple task, do not compromise your site’s security by stacking plugin on-top of the plugin. Adding the Google Analytics tracking code to your blog is very easy to do manually.

Since WordPress creates a dynamic site that is always changing with new content, we need a way for the tracking code to appear on every single page and post. All pages generated within WP are built from some variety of the header.php file. Thus, if we put our tracking code in this header file, we can be assured it will trigger on every view of any part of our WP site.

Step 1: Log in to your WordPress Backend and navigate to Appearance -> Editor

Add Google Analytics Tracking Code 4

Step 2: On the right of the screen you will see all the files used within the theme of your current site. We are looking for the header.php file. If you are using a custom theme, it is possible that it might not be named this exactly. This is rare, however, as most theme designers use common standards to maintain compatibility. Click the file when you find it and it will open in the editor on this page.

 tech tips, tips, web master, wordpress, wordpress tips, google analytics

Step 3: Take the tracking code snippet from your Google Analytics admin area. Paste it into the top of your header.php file immediately before the closing </head> tag

 tech tips, tips, web master, wordpress, wordpress tips, google analytics

Step 4: Click the Update File button to save this file. Refresh some of your WordPress generated pages and see if the tracking code appears in the source code.


 tech tips, tips, web master, wordpress, wordpress tips, google analytics

Note: Your Google Analytics will take about 24 to 48 hours to config.

Via tech-recipes

About - Hey, this blog belongs to me! I am the founder of TechTipLib and managing editor right now. And I love to hear what do you think about this article, leave comment below! Thank you so much...