How to Install Google Analytics on WordPress without a Plugin

Goolge Analytics is a free and powerful tool to analyse your website visitors.  Google Analytics tracks your website traffic and is rich in info about how your visitors move around on your site. It also can be used to do other things such as keyword research. You can install Google Analytics on WordPress site by intalling a plugin such as Google Analytics by Yoast.

But everyone konws too many plugins slow down your website. In order to speed up your site, you should install as less plugins as possible. In this tutorial, I will show you how to install Google Analytics on your WordPress site without a plugin. If you have already add Google Analytics to one of your website, then I also explains how to integrate additional websites with Google Analytics as well.

Set Up a Google Analytics Account and Site Property

If you have never set up a Google Analytics account before, then go to https://www.google.com/analytics and sign in with your Gmail account. You will see the following signup botton.

analytics-signup-step2

Click the Sign up botton to start using Google Analytics. Then you need to fill out the information about your new account.  In What would you like to track section, select Website. Give your account and website a name and fill in your website URL. If your website uses https connection, then be sure to select https in the Website URL section. Choose an industry category and time zone. Finally click the Get Tracking ID button.

Selection_237

In the past there’re two tracking method: Universal Analytics and Classic Analytics. users have a option to select a tracking method. The former has many more features than the latter. Now Google has got rid of classic analytics and all users have Universal Analytics by default and you don’t have to choose it yourself. Next, a Google Analytics terms of service agreement will pop up. Accept it and you will get a tracking ID and a tracking code.

Selection_235

Add Google Analytics Tracking Code to WordPress Site

Navigate to your WordPress theme folder, and open up footer.php file. Copy your Google Analytics tracking code and paste it above the </footer> html tag like below.

<footer class="mh-footer">
 <div class="wrapper-inner">
 <p class="copyright"><?php printf(__('Copyright %1$s | LinuxBabe.com %2$s'), date("Y")); ?></p>
 </div>
<script>
 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'Your Tracking ID', 'auto');
 ga('send', 'pageview');
</script>
</footer>

Save and close the file. Now your Google Analytics tracking code is inserted into every webpage of your site and it will start to track your visitor’s information and activity. Notice it will take 24 hours for you to see the result in your Google Analytics account.

Add Google Analytics to Your Other Websites

If you have additional websites and want to integrate Google Analytics with all your websites then Go to https://www.google.com/analytics, and login with your gmail account.

Click on the Admin tab

Selection_232

Then in the property section, select create new property. A property means a website.

Selection_233

In the next page, since you want to add Google Analytics to your WordPress site, choose Website in What would your like to track? section. Give your website a name and fill in your website URL. If your website uses https connection, then be sure to select https in the Website URL section. Choose an industry category and time zone. Finally click the Get Tracking ID button.

Selection_236

You will get a tracking ID and a Javascript tracking code which contains your tracking ID.

Selection_235

Check if Google Analytics is Properly Installed

Go to one of your webpages, and right click on a blank area, choose view page source or view source denpending on what browser you are using. Then press CTRL+F or CMD+F if you are using Mac, search analytics. If your see the Goolge Analytics Javacript tracking code like below, then it is properly installed.

Selection_238

Delete a Property

If for some reason you don’t want to track a website property anymore, then you can delete the property in the admin tab. In the property section, select one of your properties and click on Property Settings. On the right corner of the page, you will see a Move to Trash Can button.  Click on that button and you should be able to delete that property.

Rate this tutorial
[Total: 0 Average: 0]