How to Install Google Analytics in WordPress

Home - Best WordPress Plugins - How to Install Google Analytics in WordPress
Google analytics

Are you a beginner who wants to install Google Analytics on your WordPress website? Here is your guide to do so. Understanding how your audience is interacting with your website is vital for your success.

Further, the best means of knowing your traffic is via your traffic stats. Google Analytics offers this for free. In this article, you will learn the importance of Google Analytics, as well as an easier step-by-step process to install it.

Why is Google Analytics vital for Bloggers?

Getting high traffic and subscribers is your number one objective when you start blogging. So, Google Analytics assist you in making decisions based on data. So, you will see:

  • Who visits your site?

This section of analytics gives answers about the geographical area of your visitors, and the kind of browser they used when visiting your website. Also, you get vital information like language, Flash support, JS support, screen resolution, and others.

This data is so important, and it may assist in many ways. For example, you can utilize the user data when purchasing a custom design to ensure your website suits your audience.

In case many of your users lack Flash support, ensure your website does not have the flash element. Also, if any of your users are using 1280 screen resolutions, ensure your custom design is smaller or suits that resolution.

  • What are visitors doing when on your site?

It is possible to trace where the users visit on your site, the time they take on your website, and the bounce rate.

As a result, you can use this information to reduce the bounce rate and grow your page views. Also, you can know your most popular articles, and the type of content your users are searching.

  • At what time do people visit your site?

By knowing the pick hours of the day on your website, you will see the time you will be publishing your posts. But, if the time zone does not fit yours, then scheduling your post at that hour is the best option.

  • How do people locate your site?

This part of analytics indicates where your users are from — for example, Referral links, Direct links, and Search Engines.

Besides that, it displays the percentage of visitors from every source. Further, Google Analytics provides you with a breakdown of every category. For instance, in the search engine category, it displays the search engine that gave you the most traffic, like Google, Bing, and Yahoo.

Moreover, the breakdown of referral sources indicates the websites you should work with the most. For example, if Facebook is your top referral, ensure you have unique Facebook content that will make your audience feel appreciated.

Information about interaction of people with your content

Google Analytics indicates how your users are interacting with the content of your website. Also, it displays the percentage of users who clicked on every link on your website and other things.

Also, you can perform A/B split tests by doing content experiments in Google Analytics. In turn, you can know what is working the best to achieve your objectives.

How to Sign-up with Google Analytics

A Google or Gmail account is what you need to sign-up for Google Analytics because it is available for free. Besides that, the sign-up procedure is easier. Here is a step-by-step guide to making your Google Analytics account:

Step 1: Visiting Google Analytics sign-up page

On this page, you will be requested to login using your Google account. However, in case you have a Gmail or Google account, use it to sign-in. Or, go ahead and make your preferred Google account.

Step 2: Google Analytics sign up

After signing-in using your Gmail account, you will get subjected to another screen. You will sign-up for your Google-Analytics on this screen using your Gmail account.

Step 3: Choosing a mobile or website app

On the following screen, you will have the option of choosing between a website or mobile app. Ensure you select website.

The next thing will be entering your account name, country, time zone, website name, and URL of the site.

After entering this information, hit the “Get Tracing ID button.” The Google Analytics terms and service will be presented to you. Click the “I Agree” button to continue.

Step 4: Provision of Google Analytics tracing code

This is the last step. Google Analytics tracking code will get provided to you. Ensure you have copied this code somewhere because you will be required to enter it in your website based on the method you used.

Even so, we suggest that you leave the analytics browser tab open because you might need to revisit it after adding the code on your website.

How to Install Google Analytics in WordPress?

There are many different methods of setting up Google Analytics on your WordPress site. But, this article covers three methods, with the first being easier, and the least difficult.

So, you are free to select a method that best fits your requirements.

1. Google Analytics using MonsterInsights Plugin

Among the most popular WordPress Google Analytics plugins is MonsterInsights. Further, it is used by more than one million websites, which includes Zillow, PlayStation, and Bloomberg, and others.

Apart from being the easiest, it is also the best method of adding Google Analytics on your WordPress for both beginners and experts.

Also, it comes as both free and paid pro versions. However, we shall use the free version in this tutorial.

Nonetheless, if you are need of advanced features such as Author tracking, Ads tracking, E-commerce tracing and others, get the MonsterInsights premium version. Both the free and paid version has the same setup process.

Need SEO help? Take the SEO optimization services by experts.

Here is how to do it:

You should start by installing and activating the MonsterInsights plugin. After activating it, the plugin adds a new menu item on your WordPress admin menu that is labeled “Insights.” Click the item. As a result, the MonsterInsights setup wizard will appear.

You will first be requested to select your website’s category (online store, blog, or business site). Once you choose one of the categories, click the “Save and Continue” button.

After that, click the “Connect MonsterInsights” button.

In turn, a popup will appear, asking you to sign in or choose a Google account if you are signed in.

After that, you will be requested to let MonsterInsights access your Google Analytics account.

To continue, click the “Allow” button.

Finally, choose the profile you would like to trace. Ensure you choose your website. After that, continue by clicking the “Complete authentication.”

As a result, MonsterInsights will install Google Analytics on your site. Now, you will be requested to choose the suggested settings for your site.

Even so, the default settings might work for many websites. In case you are using an affiliate link plugin, you should add the path you will be using to cover affiliate links. This lets you use Google Analytics to track your affiliate links.

Now, save your settings by clicking the “Save and Continue” button. Next, the MonsterInsights will display paid add-ons, which you access when using the premium version. But, you can skip this step by clicking the “Save and Continue” button.

You will then be requested to install WPForms plugin, the best WordPress contact form plugin. However, you can either fix it or skip this step.

Google Analytics is now installed and set on your WordPress website. But, keep in mind it will take some time to display stats.

The best thing about MonsterInsights is the ability to see your Google Analytics report on your WordPress dashboard. Just go to the Reports page.

2. Using The Insert Headers & Footers Plugin

Although this technique is in the list, it is not good compared to the use of MonsterInsights as you cannot perform higher tracking configuration. Also, you cannot see Google Analytics data on the website dashboard.

Here is how to do it:

Start by installing and activating the Insert Headers & Footers plugin. After activating, go to Settings>> Insert Headers and Footers page. There is a Google Analytics code which you copied in step 4 above. Paste it the headers section.

To store your settings, remember to click the save changes button. You are done.

3. Installing Google Analytics in WordPress Theme

Expert users who are used to the code are fit to use this technique. However, it somehow undependable, because switching or updating the theme leads to the code disappearing. In fact, we do not recommend the use of this technique.

Adding code in header.php file

Go to your WordPress theme and edit the header.php file. Next, paste the code you had copied in step 4 above right from the <body> tag.

Remember to save your changes. Also, uploading the file back on your server.

Adding through functions file

In addition, you can add the Google Analytics tracking code on your WordPress functions file. As a result, it will automatically add the code on each page of your WordPress website.

Here is the code which you must on your theme’s functions.php file:

<?phpadd action(‘wp_head’, ‘wpb_add_googleanalytics’);function wpb_add_googleanalytics() { ?>

// Paste your Google Analytics code from from Step 4 here

<?php } ?>

Seeing Reports on Google Analytics Website

Google Analytics can display all data gathered from your stats. To see this data, go to the dashboard of your Google Analytics.

On the left column, you will have a view of reports from built-in Google Analytics. Every part is divided into various tabs. So, a tab will expand to show additional options when you click it.

The reports include:
  • Conversion– indicates your performance versus your objectives.
  • Behavior– gives a summary of what your users do when on your website.
  • Acquisition– shows where your users were from.
  • Audience– helps you know your users.
  • Real-time- displays an actual view of your traffic.


Without any doubt, Google Analytics is a reliable tool with many amazing features. However, some of the features are easier to use, while others need some extra setup. Further, Google Analytics functions significantly with Google Search Console. It gives you the ability to see the performance of your website in search results.

If you have any comment, suggestion, or question about how to install Google Analytics on your WordPress website, use the comment section.

If you are facing any WordPress related issues, contact WordPress experts.