How to Add Google Analytics to WordPress without using Plugins

Do you want to add Google Analytics to your WordPress Website without using Plugin? This article will help you to install Google Analytics to WordPress via Theme Header (header.php) file. Google Analytics is the most popular and free analytics service available for website owners to track their visitor’s behavior.


Google Analytics is important to your site as it helps you to track your Website visitors, which page is getting more traffic, and which keywords are getting traffic to your website. You can also track total page views, sessions, real-time users and total no. of users.

Adding Google Analytics to WordPress site is a simple process. You just have to submit your site to Google Analytics, and it will provide a Unique tracking Id or an Analytics Code. You need to add this code to your WordPress Theme header file or you can use a WordPress plugin to add Google analytics to your site. Follow the below step by step guide to add Google Analytics without using Plugin.

Important: How to submit Sitemap to Google Webmaster tool

How to Add your Site to Google Analytics

Step #1: Sign up to Google Analytics – First, go to Google Analytics page, and sign in using your Google (or Gmail ) account. If you don’t have a Google Account, create one for using Google Analytics services. Now sign up for Google Analytics.

Step #2: Setting up your Account – Now you need to add your website details. Fill all the details such as Account name (Analytics account), Website name, URL, category, and time-zone. Once you have filled all the information, click on Get Tracking ID.add-site-google-analytics

Step #3: Get the Tracking Code from Analytics – In the next screen, you will see your website Tracking

You need to copy that code and add it into your WordPress website. You can do so with or without the help of WordPress Plugins.

Choose any of the below-mentioned methods to add Google Analytics code to WordPress.

Also Read: How to uninstall WordPress Themes permanently

How to Add Google Analytics to WordPress without Plugins

This is the simplest method to add Google Analytics code to WordPress. You have to paste the code into your WordPress Theme Header file. Just remember your code will disappear if you update or change your WordPress Theme. You have to add the code again if you use this method.

  • Login to your WordPress Dashboard.
  • Go to Appearance > Editoropen-editor-wordpress
  • At the right side, you will see Theme Header (header.php). Click on
  • Now paste the Tracking code (snippet) which you copied from the Google Analytics right after the <body> tag.add-tracking-code-to-theme-header

OR– You can paste the code right before the </head> tag.

  • Now click on Update File to save the changes.

That’s it. You have successfully added Google Analytics to your WordPress site.

Note: You can also verify if you have added the code properly and if it is tracking all your posts or not. Just open any of your pages in a new browser tab. Press Ctrl + U to view the source code. Then use Ctrl+F to open search bar and type analytics, you will find your Analytics tracking code.

If you have any difficulty in setting up Google analytics to your WordPress site, let me know by leaving a comment below.

If you liked this article, please follow and subscribe HowToArticle on Facebook, Twitter and Google Plus.

Add a Comment

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

How to record Android Screen?Learn here