How To Add Google Analytics to Your WordPress Site

Last Updated: March 30, 2023

So, your WordPress site is finally up and running. Now it’s time to start gathering data via analytics. This type of data can show you how your visitors interact with your website. This is important too! That’s why today I’m going to discuss the easiest way to add the most popular analytics tracking: Google Analytics.

Google Analytics on a WordPress Website

Google Analytics is a free tracking service that reports website traffic, conversions and user behavior. Most importantly. it can show you how much traffic your website receives, where that traffic is coming from and how your visitors interact with your site once they are there. As an added bonus, Google Analytics allows you to export it’s data in a variety of formats. You can even build your own custom “dashboard” that provides and updates the data you want to see.


When you set up a website, you typically have a goal in mind. Whatever the reason, it’s important to understand your site’s users. I mean, who doesn’t want to know if people are visiting, where they come from and what content on your website they enjoy most? I know I do! Basically, without this information there’s no way to measure if what you are creating is getting your closer to your end goal.

One of the best features of Google Analytics is the price. Have I mentioned that it’s free? Because it is! Aside from that, Google Analytics is easy to implement in order to for you to track and gather data. For example, your data might show that your visitors frequently go to a certain part of your site that you didn’t expect them to. As a result, this could lead to ideas in regards to new content on your website.


Implementing Google Analytics requires adding code (Javascript) to your site. This code allows your site to gather data on how your site is performing. Whenever someone goes to your website via their browser, they are tagged by the tracking code and their “session” on your website starts.

If the tracking code in properly added to your site it should be on EVERY page of your website. Well, at least on every page that you would like to gather traffic data. This guarantees that the tracking can follow every website visitor as they move through your website.

Some of the most helpful data includes:

  • Pageviews: The number of individual pages a visitor that visit your site.
  • Sessions: The number of individual visitors that your website receives.
  • Traffic Source: Where your site visitors came from (A Google search, another website, social media, etc.)
  • Bounce Rate: A measure of how many visitors came to one page on your site and then immediately left.
  • Session Duration and Pages per Session: Measurements of how long someone stayed on your site and how many pages they visited during their Session.
  • Goals (sometimes referred to as “Conversions”): This measures how many people completed an action on your site. For example, if you have a contact form, it determines how many people filled it out and where they came from, etc.

Let’s get started on how to install Google Analytics on your WordPress website.


Step 1 – Create an Account

1. The first thing you need to add Google Analytics to your website is a Google account. If you don’t already have one, you can get one here.

2. Once you have your account, go to and login.

3. There will be a prompt for you to sign up for Google Analytics. Follow the steps to set up your analytics account.

4. Then click on the “Get Tracking ID” button. This will  take you to a screen showing you a code. Copy that code.

Step 2: Install the Code

There are several ways to add the Google Analytics code to your WordPress site. However we’re going to focus on one of the easiest ways to install the code.

Both of these methods are straightforward. Although this method is the only one that requires some minor knowledge of how WordPress uses templates to manage content. Head over to WordPress to get started.

Here are the steps to add your Google Analytics tracking code manually:

1. Once you’ve copied the code, login to your WordPress website and go to “Editor” in the “Appearance” menu.

2. On the right side of the screen you will see a list of templates. Search for the template file named “header.php”. The easiest way to find this file is usually to do a CTRL + F and search for “header.php.

3. Next look for the the following tag: </head>. You can use CTRL+F to search for it. Once you’ve found the tag, paste the tracking code snippet immediately before it.

4. Once the code is pasted in, click the “Update File” button.

5. After a few minutes, go back to the area in Google Analytics where you copied your tracking code. Refresh the screen to make sure that the code is properly placed and your account is receiving data. If there isn’t any data being received, click the “Send test traffic” button to test it again.

Although, keep in mind that it usually takes 12-24 hours for the traffic data to come through to Google Analytics. Afterwards you can login to your account, head to “Reporting” in the main menu in order to see your data.


Once you’ve installed the tracking code, you’ll start to see the data appear in your personal Google Analytics interface. Once you head back into Google Analytics, click on the “Reporting” link in the top navigation to see the default data. The default reporting section is “Audience Overview”. This is what will load by default whenever you login to Analytics in the future.

The menu on the left side is how you will navigate between the different data sections. It is divided into sections based on the type of metrics presented. You can change your date range in the upper right. However, the data is only available from the date you installed Google Analytics.

To help you get a little more familiar with it, here are some areas you are going to want to check out on a regular basis:

  • Audience →Mobile→Overview: This shows you the type of devices people use to access your site.
  • Acquisition→Overview→All Traffic→Channels: This section shows you what channels are sending traffic to your site.
  • Behavior→Overview: This section shows you the pages on your site that get the most traffic.
  • Conversions→Goals→Overview: This section shows you the number of conversions that have occurred on your site, if you have set up goals.

Google Analytics is by far the most powerful AND free analytics service available. Whether you are new to WordPress or you are experienced in managing your own WordPress site, having Google Analytics tracking implemented will help you to constantly improve your website’s performance. If this all sounds a bit complicated, you can always have someone else do it for you. 

Have you tried Google Analytics before? Let us know in the comments below so we can discuss!

Want the latest marketing news? Sign up for updates!

Related Post

Subscribe to our newsletter
The latest news, articles, and resources, sent to your inbox weekly.
© 2023 Section 5 Media. All rights reserved.
Privacy Policy Contact Us Careers