TrustPulse Marketing Blog

Actionable advice to boost your website conversions.

Featured image Add Google Analytics WordPress

How to Add Google Analytics to WordPress (Step by Step)

Do you want to learn how to add Google Analytics to WordPress?

Using Google Analytics will give you real-time data that helps you understand how people interact with your website. Oh, and Google Analytics gives you this information for free.

The problem is, it’s not always straightforward to install or use this important tool.

Fortunately, it’s incredibly easy to add Google Analytics to WordPress using a plugin.

In this article, we will share why you should be adding Google Analytics to WordPress. Plus, we will walk you through how to add Google Analytics, step-by-step, both with and without a plugin.

Here’s a quick overview of the article, so you can easily navigate where you’d like.

Why Add Google Analytics to WordPress

As someone that runs a website and online business, your #1 goal is to pull in more traffic and sales.

If you don’t understand how visitors interact with your page and who is finding you, how can you reach this goal?

Google Analytics is your best way to understand that and many other things about your site and visitors. This tool will help you identify your most popular pages, offers, and traffic sources. On the flip side, Google Analytics will help you pinpoint areas that aren’t resonating as well with your potential customers. Basically, it removes all the guesswork so you can get right into fixing the problem areas.

Google Analytics dashboard

Using Google Analytics, you can view data like:

  • Website hits
  • Conversion rates
  • Revenue
  • User demographics (age, location, gender, device used)
  • Referral sources
  • Bounce rates
  • And more…

Google Analytics insights

Google Analytics has what seems like an endless supply of data. So, chances are that if you have a question about your audience or site, Google Analytics can help you figure out the answer.

Without it, you are simply left guessing and wondering how your website marketing campaigns resonate with people.

So, you are probably wondering how you can tap into this fantastic resource and add it to your site.

With that in mind, let’s start the tutorial.

Creating a Google Analytics Account

Before adding Google Analytics to our WordPress site, we need to create an account.

If you already have a Google account, like Gmail, you’ll need to sign in to set up Google Analytics.

First, you’ll need to navigate to the Google Analytics website. There, click on the Start Measuring button.

google analytics sign up

Google Analytics will prompt you to provide some additional information. To start, you’ll need to choose an account name and choose your account data sharing settings.

Click the Next button to move to the next step when you are done.

google analytics account details

Now, you will provide Property details. This is information specific to your website, like the name, local time zone, and local currency.

property details and advanced options

Once you fill this out, click Show advanced options.

Now you need to enable the Create a Universal Analytics property option.

enable create universal analytics property

After that, enter the URL of your website and make sure to select the Create a Universal Analytics property only option. This ensures you won’t have any issues connecting to MonsterInsights or other tracking platforms.

select create a universal analytics property only

Click Next when you’re done.

Finally, you will be filling out some information about your business. This helps Google Analytics tailor the data to your specific business and goals.

When finished, click Create.

google analytics about your business

Now, you’ll need to accept Google’s terms of the agreement. Click the checkboxes and then scroll to the bottom to find the I Accept button.

accept terms google analytics

Once done, the Google Analytics dashboard will open. Here, you’ll see 3 data stream options. For this, you’ll need to select the Web button.

google analytics set up stream

Next, enter your website’s URL and a stream name. Then, click on the Create Stream button.

setup data stream in google analytics

Google will then create a measurement ID and stream ID, along with a tracking code.

You can find this tracking code under the Tagging instructions section. Open the Global Site Tag tab and copy this tracking code.

global site tag in google analytics

Now, you’ll need to add this tracking code on your WordPress site to connect Google Analytics to your website.

Depending on how you go about adding Google Analytics to your site, it can be pretty tricky. However, we will be showing you an easier alternative that requires zero coding or technical knowledge.

We recommend going with method 1, which adds Google Analytics to WordPress by using a plugin. That’s because it’s the easiest way, and you won’t have to worry about editing any codes within your WordPress theme.

Method 1: Installing Google Analytics Plugin on WordPress

We’ll start with the simplest method for adding Google Analytics to WordPress.

For that, we’ll use the MonsterInsights WordPress plugin.

monsterinsights home page

MonsterInsights is the best Google Analytics WordPress plugin on the market. Not only does it let you add Google Analytics to your WordPress site, but it also makes accessing your data significantly easier.

Now, we know Google Analytics offers a lot of data. That’s a good thing. But, it can be overwhelming to sort through endless reports to find the exact data you need. With MonsterInsights, you can view the information you need right from your WordPress dashboard.

All you need to do is simply download and install the plugin.

monsterinsights dashboard

With MonsterInsights, you also get:

  • Custom reports
  • Real-time analytics
  • Enhanced eCommerce tracking
  • Automatic EU Compliance (GDPR friendly)
  • And more…

This is why MonsterInsights has more than 3 million active installs and is the most popular Google Analytics plugin for WordPress.

Plus, MonsterInsights seamlessly integrates with both Universal Analytics and Google Analytics 4 (GA4). You can track whichever version you’re using or track both at the same time with the Dual Tracking feature.

Now, let’s dive right into how to add it to your site.

MonsterInsights is simple to add, and you’ll start by downloading the plugin.

First, you will need to either create or log in to your MonsterInsights account on the MonsterInsights website.

monsterinsights login

Then, click on the MonsterInsights Downloads tab.

download monsterinsights

Now, you’ll need to download MonsterInsights. So, click on the large blue Download MonsterInsights button next.

download monsterinsights button

Next, we’ll add it to your WordPress site. But first, you’ll need to remove any tracking codes or Google Analytics plugins that may already be installed on your WordPress site.

Go ahead and log in to WordPress and make sure you are on the admin dashboard.

Navigate to Plugins > Add New and click on Upload Plugin at the top of the screen.

upload new WordPress plugin

Now, you’ll click on Choose File to select the zip file you downloaded from the MonsterInsights site. Then, click on Install Now to both upload and install MonsterInsights.

upload and install wordpress plugin

Once the MonsterInsights plugin is installed, you’ll need to activate it on your site. So, go ahead and click on Activate Plugin.

activate monsterinsights

Finally, you’ll need to enter your license key from the MonsterInsights My Account page. Once you find it, copy the key.

monsterinsights my account page

Moving back to your WordPress dashboard, navigate to Insights > Settings and paste your key in the License Key. Finally, click on the Verify Key button.

verify monsteinsights license key

We’re now ready to connect Google Analytics to WordPress.

After activating the plugin, you’ll see the Insights tab in your dashboard.

Select it to open up the MonsterInsights dashboard, and inside, you’ll see the option to Launch Setup Wizard.

Start Monsterinsights wizard

MonsterInsights will now guide you through the process to connect Google Analytics.

You’ll be asked which category best describes your site on the next screen. Once you select a button, click on Save and Continue.

Monstersinsights welcome screen

Now, you’ll have a prompt to connect MonsterInsights, Google Analytics, and WordPress. Click on the blue button to proceed.

Connect to Monsterinsights

A Google sign-in screen will pop up. Be sure you sign in to the same Google account you used to sign up for Google Analytics earlier in the tutorial. Click Allow to continue.

All that’s left to do is select your website from the next screen’s drop-down menu and click Complete Connection.

complete connection in monsterinsights

And that’s all there is to it. Google Analytics is now running on your website.

If you have both a Universal Analytics property and a Google Analytics 4 property, you can also set up dual tracking with MonsterInsights. This will let you bring in all of your historical data and the familiar reports from Universal Analytics while giving you the benefits of GA4.

To set up dual tracking, go to the man Settings page. Scroll down to the Google Authentication section and find the Dual Tracking Profile box.

dual tracking profile monsterinsights

Simply enter in either your Universal Analytics Tracking ID or your GA4 Measurement ID, whichever one you didn’t authenticate in the setup wizard.

Ready to start tracking your site’s data and get a better understanding of how it’s performing? Get started with MonsterInsights today!

Method 2: Adding Google Analytics to WordPress Without a Plugin

You can also add Google Analytics to WordPress without a plugin if you’d like. However, proceed carefully with this step, especially if you are unfamiliar with website coding. You’ll be editing your website theme, which could break your website.

You’ll also need to reenter the code any time you switch WordPress themes.

Any misstep here could lead to a blank or malfunctioning site. So before adding the Google Analytics code to your site, we highly suggest that you backup your site.

First, make sure you’ve copied the tracking code in your Google Analytics account.

Google analytics tracking code

Now, head over to your WordPress dashboard.

From the dashboard, click Appearance. Next, click Theme Editor. If you don’t see this option, your security plugin or developer may have disabled it for you to secure your site from hackers. You’ll need to contact them to enable it.

Choose Theme editor

Inside the Theme Editor, from the left-hand menu, select Theme Header.

Choose Theme Header

Now, just before the closing head tag, paste the tracking code. Make sure you leave everything else as is.

Closing head tag

Exit the editor, and that’s it. You’ve added Google Analytics to your site.

Now, you’ll be able to track your site visitors and how they engage with your WordPress site.

And that’s all we have for you in this tutorial. We hope you’ve found this article helpful.

If you’d like even more resources to help you grow your business using your website, check out these articles:

Author Photo
Published by Deana Weinheimer
Deana Weinheimer is a writer with deep experience in marketing and WordPress with a focus and passion in educating her readers. In her free time, she enjoys writing for a minor league hockey news site, traveling with her husband, playing with her dogs and gerbils, or paddle boarding the many waterways of Ohio.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. We only recommend products that we believe will add value to our readers.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Increase Trust, Conversions and Sales NOW
Try TrustPulse 100% risk-free for 14 days!