By adding Google Analytics to your WordPress site, you open the door to a wealth of information about the behavior of your website visitors. Not only will you be able to see where your visitors are coming from, but also how long they stay on your website and what pages they visit. All in real time!
In addition to this, there’s a whole mountain of data that you get by linking Google Analytics to your site. In this part of the tutorial series, you will learn how to install a Google Analytics WordPress plugin on your website and link it to your analytics account.

Add Google Analytics to WordPress with a Plugin
From your WordPress dashboard, click on Plugins then Add New, and in the plugins search box, type in GA Google Analytics.
You’ll see a bunch of Google Analytics plugins, but we’re intersted in the one by Jeff Starr.
Click on Install Now. After a few seconds, click the blue Activate button. That will take you to your WordPress plugins page.
From your list of plugins, find the GA Google Analytics plugin and click on Settings.
The GA Google Analytics plugin for WordPress has a quite a few settings, but we’re only interested in the following:
- GA Tracking ID
- Tracking Method
- Tracking Code Location
1) Add Tracking ID to Google Analytics WordPress Plugin
If you don’t already have a Google Analytics account, you can sign up for one here.
Once you get an account, sign in and navigate to your Google Analytics dashboard. Notice how there are currently 0 active users on your website. This makes sense considering you haven’t linked your Google Analytics tracking code to your WordPress websites yet.
Let’s do that right now.
From your Google Analytics dashboard, click on the Admin icon in the bottom left corner. Under Property, expand Tracking Info and click on Tracking Code.
At the very top, you’ll find your Google Analytics tracking code under Tracking ID. It usually starts with a UA- followed by a series of numbers. For example, my tracking code is UA-111195121-2.
Go ahead and copy this value. Back on the settings page for the GA Google Analytics plugin, paste in your tracking code in the GA Tracking ID box.
2) Universal Analytics vs Global Site Tag
Now that you have linked your Google Analytics tracking code, you want to change the tracking method.
Here, you’ll want to click on the radio button for Global Site Tag / gtag.js (new method).
I won’t get into the technical differences between analytics.js vs gtag.js. All you have to know is that both tracking methods accomplish pretty much the same thing. In addition, the Global Site Tag (gtag.js) is the newer tracking method introduced in 2017, and many experts predict a depreciation of Universal Analytics (analytics.js) in the near future.
Similarly, unless you have a good reason, don’t even think of choosing the legacy ga.js tracking method.
3) Google Analytics Tracking Code Location
Next, change the tracking code location from the header to the footer. To do this, select the Include tracking code in page footer (via wp_footer) option next to Tracking Code Location.
By including the Google Analytics tracking code in the page footer, your website will have a faster loading time on Google PageSpeed Insights.
Test Google Analytics Is Installed Properly
Finally, after making these changes from above and clicking on the blue Save Changes button, let’s test out Google Analytics to make sure it’s installed and working.
To do this, all you have to do is simply visit any page on your website. The home page is a good choice.
From now on, when anyone visits any page on your website, the Google Analytics code will execute. The behavioral data of the website visitor is logged back to the Google servers and displayed nicely in your Google Analytics account.
You can see this working in real time by going back to your Google Analytics dashboard. Assuming you’re the only one on your website at the time, you’ll find that the Active Users right now count is no longer 0 but now 1.
Disable Tracking of Admin-level Users
Finally, you will want to disable the tracking of admin-level users. This simply means that as long as you’re logged in to your WordPress site, your page views on your own website won’t count towards your overall Google Analytics statistics.
To do this, check the box that says Disable tracking of Admin-level users near the bottom of the plugin setting page.
I find this setting to be super important, especially for newer websites and blogs with low traffic. You don’t want your personal traffic to your own website to effect your analytics.
UP NEXT: WordPress Performance and Speed Optimization
Now that you have installed and configured Google Analytics on your WordPress website with a plugin, let’s learn how to optimize your website’s speed.
In the next part of this WordPress tutorial series, we’ll be looking at improve your PageSpeed Insights score and speeding up your WordPress website. Through a series of plugins, you will learn how to optimize images and leverage browser caching in addition to so much more speed optimization techniques. By the end of the tutorial, you’ll have a nearly-perfect PageSpeed Insights score.
As always, if you have any questions about adding the GA Google Analytics WordPress plugin to your site, let me know in the comments below. I’ll be more than happy to help you out.
Hi Tony, wanted to let you know the GA plugin by jeff stars was using 273mb of physical memory as soon as i disabled it went back to 0mb. I am currently trying a shared cloud storage by chemicloud and i only have 512mb of physical memory. I just tried site kit by google and that consumed 300mb. Is this normal ? Would you have any other google analytics plugins which consume less physical memory ?
I’m not sure if this is typical memory consumption, but I’m curious what your memory usage is if you add the Google Analytics tag to your website directly. Kinsta has a good writeup on how to do this https://kinsta.com/blog/google-analytics-wordpress/#2-manually-connect-google-analytics-and-wordpress-with-code
Would you mind giving this a try and reporting back?