How to Quickly Install Google Analytics Global Site Tag in WordPress (gtag.js)

Install google analytics in wordpress

Table of Contents

We bet you already know the famous duos like Batman and Alfred (sorry, Marvel), Tom and Jerry, Pineapple, and Pizza. But, do you know the #trending duo? It is WordPress and Google Analytics.

While they may not be familiar terms for a layman, they are the most incredible partners any developer, marketing executive, or a business owner could ever have.

One of the popular digital analytics software, Google Analytics, provides you with real-time visitor data, demographics, conversions, behaviour, and acquisition. It gives you the number of active users on the website at any given moment, for how long a visitor stays on a page, the visitors’ age, gender, location, the device they are using, and a lot to explore.

Therefore, in this blog, we help you install Google Analytics into your WordPress website (hoping you already have one. If not, what are you waiting for) to serve your customers a lot better.

Basically, you can install Google Analytics into your website either with a plugin or without a plugin. Today, we will tell you both methods and you can go ahead with whatever seems feasible to you.

Install Google Analytics With Plugin

The easiest and widely-implemented method is to take the help of the Google Analytics WordPress Plugin. For newbies, a Plugin is a software component that adds a specific feature to the existing program.

We recommend MonsterInsights – the best freemium WordPress Google Analytics Plugin that is super user-friendly and most powerful in the market. With MonsterInsights, you can get real-time statistics, page-level analytics, universal tracking, affiliate link tracking, custom dimensions, and many more. Above all, it does not require a single line of code to install.

  1. Go to the Plugins section on your WordPress dashboard and click on Add new. Searches for “MonsterInsights,” and when the right one shows up, click Install now with no doubt.
  2. Once it is installed, click on Activate.
  3. The next step is to configure it so it can communicate with your newly activated Google Analytics account.
  4. Go to the Settings tab on the Plugins page and click on the button that reads, “Authenticate with your Google Account.”
  5. Then you will see a pop-up window asking for permission to connect with your account.
  6. On the next screen, you get to a lengthy string of random numbers and characters. Do not panic. Copy and paste this code into the highlighted box on your WordPress tab.
  7. Click “Save authentication Code.”

That’s it! You have successfully installed Google Analytics into your WordPress website. It usually takes a couple of hours to start collecting user information. So, we recommend you give some time for it adjusts to the new environment. If you want to see whether it is working fine, open your website in another browser or device and click on any page to record your visit in Google Analytics. If everything is working as it is supposed to be, you would see the real-time analytics as one visitor on your site.

Install Google Analytics Manually

  1. Login to your Google Analytics account. You can sign up with the Google account email you have.
  2. Once you have logged into your Google Analytics account, you see the Admin area on the dashboard’s bottom-left corner.
  3. Upon clicking that button, you will see three columns. Slide over to the middle column that reads, “Property,” and click on “<>Tracking Info.”
    google analytics tracking code
  4. The Tracking Code window pop-ups with your unique tracking ID along with the complete Google Analytics code.
    download google analytics code
  5. Copy the full GA code. You are going to use it in a while.
  6. Login to your WordPress website’s backend and go to Appearance and then to Editor on the left sidebar.
  7. Upon clicking that, you will see all your site files displayed to the right. Assuming you would want to track the whole site, look for header.php and click on it to edit.
  8. When the code editor appears, go to the closing head tag (</head>). Place your cursor above the tag and paste the GA code you have copied earlier.
    1. Click on Update File to save your changes.

 

There you go! You just learned how to install Google Analytics into your WordPress. That is impressive!

And, you can follow the same testing method to see if it is working as it should be.

Let us know in the comments section below which method you are going to implement.

 

Join the Newsletter

Featured Posts

We Recommend