How To Add Google Analytics to WordPress without Plugin

Monitoring your WordPress website traffic regularly plays the vital role towards success.

There are several plugins including the Google Analytics plugin in the WordPress official page.

But, If you don’t like to use a plugin to tracking your WordPress website, then you can do it without a plugin as well.

Why should you add Google Analytics to WordPress website

Understanding the traffic or users coming to your website has a huge role to play.

You will understand how your readers are

  • interacting with your content,
  • The amount of time spending on a page
  • from where the audience coming from
  • Page getting the maximum views or fewer views.
  • you social, organic, referral and direct traffic too and more

And these statistics should be measured, to work on the things which are going wrong.

This step by step tutorial will help you add Google Analytics to WordPress without a plugin.

Add Google Analytics to WordPress without Plugin

Make sure you have signed up and created a Google Analytics account for your website.

Step 1. Login to your Google Analytics account.

Step 2. Click on Admin button, which can be located at the bottom left. (It will look like a gear icon)

Step 3. Now Click on the domain on which you want to add the Google analytics, and then click on All Web site Data.

Google Analytics Website Data

Step 4. Here, you would be able to see one more dashboard, for tracking that domain.

Step 5. Among the columns, choose tracking Code from the Property column, better insights show in the image.

analytics tracking code

Step 6. This will give a website tracking code, along with the unique ID for tracking it. (Starts with UA-)

ga website tracking

Step 7. Copy the entire code from the Google Analytics and switch back to your WordPress Admin Panel.

Add Google Analytics to WordPress Theme

Now we are here, about to add the Google Analytics code to your WordPress theme.

Note: It’s better to backup your content and theme, just in case if anything goes wrong.

Step 8. Navigate AppearanceEditor from your WordPress dashboard.

wordpress theme editor

Here you would be able to see all the themes files with .php extensions on the right side of the WordPress Dashboard.

Step 9. Scroll down and find header.php (Theme Header), click on it to open

According to the themes, the Theme header title might vary, but the name header.php would be the same.

header php

Step 10. Find </head> tag in the header.php file and finally paste the copied Google Analytics tracking code above it.

Step 11. Click on the Update button, and you were done.

Now Google Analytics will start tracking your WordPress website traffic. This process would be useful if one doesn’t want to install a plugin for tracking the website.

Note: If you update or change your theme, you might want to do this process again, as we have installed the GA code directly in the theme itself.

What others are reading!
Authored by Navin Rao

A blogger and with a go-getter attitude Navin is a web geek and loves to write about WordPress. Able to guide even a non-techie to maintain a WordPress website through his walkthrough tutorials on WordPress.

Enough right? Let's join hands on Facebook and Twitter

3 thoughts on “How To Add Google Analytics to WordPress without Plugin”

  1. Hello Navin,

    Google analytics is one of my favorite tools. It helps me to monitor my site traffic and also help me to track my conversions. Google analytics help you to take vital decisions about your website marketing strategies. Thanks for sharing this beautiful post.

    • Yes Vishwajeet, it should be the primary tool for any blogger. Monitoring the website traffic closely and working on the things which are going wrong, can make one closer towards the success.
      Thanks for and leaving your valuable thoughts!


Leave a Comment