Install Google Analytics in WordPress

How to Install Google Analytics in WordPress (The Easy Way)

Google Analytics is a powerful analytics tool that allows website owners to monitor who visits their site, which pages they’ve been looking at, and how they got there. Tracking these metrics (in addition to a number of others) makes it possible to boost your site’s conversion rates, increase product sales, and grow traffic.

Having some insight into how your target audience interacts with your site is vital. Fortunately, integrating Google Analytics with WordPress is a cakewalk – all you have to do is install a plugin, configure its settings, and you’re good to go.

With this in mind, in this post, we’ll show you how you can integrate Google Analytics to your WordPress site – the easy way – and cover some essential metrics that you should be tracking. But before we begin, let’s take a look at why it’s a good idea to have Google Analytics in the first place.

Let’s get started.

Why Should I Use Google Analytics?

As a webmaster wanting to grow your online business, Google Analytics is one of the most essential tools available to you. It paves the way for allowing you to optimize your website to boost conversions, increase traffic, and generate user engagement.

There are a number of reasons why you might want to start using Google Analytics on your WordPress website. To name a few:

  • Gives you insight into user behavior. Google Analytics lets you track all kinds of metrics that define user behavior on your website. This includes information about how users find your site, how long they stay on it, which device they’re using, if they’re returning visitors, and much more.
  • Helps you make informed, data-driven decisions. Since the tool gives you detailed information about how your audience interacts with your site, it puts you in a better position to make informed decisions about the layout of your site and the content you publish on it.
  • Allows you to identify problem areas. Some of the metrics that Google Analytics allows you to track (such as Exit Pages) can help you identify your worst performing pages. You can use this information to improve the problem areas through A/B testing and monitor your progress along the way.

In addition to this, Google Analytics offers a great way for webmasters to set up goals (such as the number of subscriptions, product sales, or e-book downloads) and measure their site’s performance against them. And when you have all this data on hand there’s no telling what you can do to optimize your website.

In the next section, we’ll show you how you can get started with Google Analytics in WordPress in three easy steps.

How Do I Install Google Analytics in WordPress?

Getting up and running with Google Analytics in WordPress is a simple three-step process. We’ll start out by signing up for Google Analytics (if you haven’t done so already), then move on to adding the analytics tracking code to WordPress, and finally, checking for analytics data.

Step #1: Sign Up for Google Analytics

Start off by heading over to Google Analytics. If you’re not already logged in to your Google account, then you’ll want to click Sign In in the top left corner and select Analytics.

Google Analytics Solutions

Sign in to Google Analytics

Once you’ve signed in to your Google account, you’ll be able to sign up for Google Analytics. Click the Sign up button on the following screen to proceed.

Sign up button for Google Analytics

Click the Sign up button to create a Google Analytics account.

On the next screen, you’ll be prompted to select a property to track and configure its settings. You can choose to track either a website or mobile app. Since we’re integrating Google Analytics into our WordPress site, choose Website and fill out the required fields in the form. Once you’re done, click the Get Tracking ID button.

Set up New Account

Select Website and set up your new Google Analytics account.

Next, you’ll be asked to accept the terms and conditions in a pop-up window. Click I Agree to continue. Finally, you’ll be redirected to a screen that contains your Tracking ID in the format UA-XXXXXXXX-X and a tracking code in the Website tracking box.

Tracking Information

Copy and paste the tracking ID and code into a text file.

Copy-paste both the tracking ID and the code in a text file – you’ll need it in the following steps. At this point, your website is added to Google Analytics and you can start receiving user data once you add the tracking information to your WordPress site.

Step #2: Add Analytics Tracking Code to Your WordPress Website

If your website wasn’t powered by WordPress, you’d be stuck adding the tracking code to every single page you’d want to receive data for. Fortunately, WordPress offers a better solution – or more accurately – three different solutions.

Add Code Manually

If you’re the least bit technically inclined, you can avoid having to install a plugin to integrate Google Analytics into your WordPress site. Start off by heading over to Appearance > Editor from your WordPress admin panel. On the right side of the Edit Themes screen, select Theme Header (the header.php file of your active theme) from under the Templates section.

Edit Themes screen.

Find your active theme’s header.php file from the Templates section.

Next, find the closing head tag i.e. </head> and paste the tracking code right above it in the header.php file.

head tag in the header.php file.

Add the tracking code right above the closing head tag.

Click the Update File button at the bottom of the screen to update the changes.

Use a Plugin

If you’re not comfortable with editing your WordPress site’s files directly, you can just as easily install a lightweight plugin – Google Analytics for WordPress by MonsterInsights – to automatically insert the tracking code in your site.

Google Analytics for WordPress by MonsterInsights

After you’ve installed and activated the plugin, head over to Insights > Settings. From the General tab, click the Authenticate with your Google account button.

Plugin settings page.

Once you click the button, you’ll see a pop-up wizard that will walk you through the authentication process. Click Next to continue.

Authentication Step 1

The following screen will prompt you to enter the Google code. Click the Click To Get Google Code button to get your Google code and then paste it in the box below. When you’re done, click Next.

Authentication Step 2

Finally, the last screen will ask you to select the profile (property) you created when signing up for Google Analytics from a drop-down list. Its tracking ID should match the one you saved in your text file. Click Next to proceed.

Authentication Step 3

Once you’ve completed the wizard, you’ll be redirected back to the plugin’s settings screen. Be sure to click the Save Changes button at the bottom.

Use Built-in Theme Options

If you’re using a theme that has been developed recently, then chances are that it has some built-in options for adding Google Analytics code. Since theme options vary from theme to theme, you’ll have to look around for it on your own. If your theme does support this option, then you’ll likely find a section labeled Additional Code or Custom Code, where you can insert the tracking code.

Step #3: Check for Analytics Data

Once you’re all set up with Google Analytics on your WordPress site, you can view visitor data from the Google Analytics dashboard or by navigating to Insights > Dashboard (if you used the Google Analytics for WordPress by MonsterInsights plugin).

It’s important to keep in mind that the Google Analytics tool will start gathering data from when you add the tracking code to your website. For best results, wait a few days before checking for analytics data. Once it’s gathered enough data, it will automatically generate reports for you.

Google Analytics' Audience Overview

Google Analytics gives you all kinds of information such as traffic reports over a period of time, the total number of sessions, page views, bounce rate, and much more.

Which Google Analytics Metrics Should I Be Tracking?

The Audience Overview section in your Google Analytics dashboard gives you access to a number of key metrics that you should monitor.

  • Sessions. This number determines the number of interactions that took place on your WordPress website within the specified time frame.
  • Users. Defines the number of users who accessed your website during the time frame. If your number of users is less than the number of sessions, then that indicates that you have returning visitors.
  • Pageviews. This number represents the total number of pages that were viewed during the time frame by all of the users.
  • Bounce Rate. This is the percentage of visitors who landed on your site and left after viewing only one page. A lower bounce rate indicates that your site’s visitors are navigating to other pages on your site.

In addition to these primary metrics, there are several other key metrics that you should be monitoring to optimize your site. For instance, if you want to get a better idea of where your traffic is coming from you can navigate to Acquisition > Overview to see which marketing strategy is working best for your site. Digging deeper into the traffic sources will let you know how visitors are making their way to your site – directly, organic search, through referrals, or via social media.

Depending upon the nature of your website you can track all kinds of key metrics. For instance, an online shop owner might want to track their customer’s lifetime value or keep an eye on conversions by traffic source. Or perhaps a blogger would like to know which web pages on their site perform the best in terms of traffic volume.


Google Analytics is a powerful tool that allows webmasters to monitor their WordPress site’s growth while they work towards optimizing it. If you’re serious about understanding your audience and want to make data-driven decisions to improve your website, then Google Analytics is a must-have.

Let’s quickly recap the main steps you need to take to install Google Analytics in WordPress:

  1. Sign up for a Google Analytics account to set up your WordPress website as a property.
  2. Add the analytics tracking code to your site manually, using a plugin, or through the theme’s built-in options.
  3. Check for analytics data through the Google Analytics dashboard or through the plugin’s dashboard.

Once you have it all set up, it’s up to you to take necessary steps to fine-tune your WordPress website and monitor the results in real-time.

Has Google Analytics helped you grow your WordPress site? Which key metrics do you plan on monitoring? Let us know by commenting below!

This post may contain affiliate links, which means Nimbus Themes may receive compensation if you make a purchase using these links.

Written exclusively for

Nimbus Themes Publishing Logo

About the Author

From C++ to PHP, the language Maria thinks in is code, and translates it to English for humans to understand. She has a degree in Computer Science and is the writer of choice for many organizations. She is also The Big Boss at BloggInc, calling all the shots and personally supervising every word and piece of content. In her spare time you can find her playing GTA V, lounging at the farm, or trying to beat her husband at indoor badminton.

Read all posts


  1. Doug Bascom Avatar

    Doug Bascom

    March 31, 2017 at 2:02 pm

    Do you have a printable version of this article?

    • Sarah Bishop Avatar

      Sarah Bishop

      April 3, 2017 at 6:00 pm

      Hi Doug, sorry we do have a printable version of this article.


Leave a Reply

Your email address will not be published. Required fields are marked *