How to Install Google Analytics in WordPress

  • Blog
  • How to Install Google Analytics in WordPress

Do you own a website? If yes, you should track your visitors' interaction on the website. If you are looking for an effective way to track your website audience? Then give a try to Google Analytics. You will know where your website visitors are coming from, how long they stay on your website, what devices they are using, and much more with the help of Google Analytics. This article is about how to integrate your WordPress website with Google Analytics. At the end of this article, you will understand what, why, and how you can configure Google Analytics with your website.

What exactly is Google Analytics?

It is a free and best website analytics tool. Google Analytics provides real-time statistics about your website traffic and user interaction. Small and Medium businesses use it to track traffic sources and website performance. In addition, it gives complete demographics of your site visitors to analyze them more deeply.

With google analytics, you can find your marketing efforts' effectiveness or success rate by analyzing the quality of traffic you're receiving and tracking goal completions. For example, if you want to know who comes to your website, what they are doing after landing on pages inside your website, how long they stay, and what content gets more traffic, you can try google analytics. In short, analyzing your customer behavior with GA helps you develop enhanced marketing campaigns, gain website traffic and retain your site visitors.

Why do you need Google Analytics for your website?

You need Google Analytics to know how your site is performing. There are many benefits to using Google Analytics. Google Analytics can be able to track any kind of WordPress website.

It gives you complete user demographics and their location details. That is, you can know your visitors' details like where they come from, which channel they use (like search, paid, etc.,) and more. You can track the behavior of your customers after landing on your website. You can see the pages they visit, files downloaded, and more. GA helps you track the conversions and revenue your store makes and Pages & Posts visits. It shows which devices your site visitors use most. So you can improve your site experience by adapting to the device your users use.

Significant Metrics to track in Google Analytics

All the reports generated inside Google Analytics for your website are built with dimensions and metrics. Metrics typically are quantitative measurements. Therefore, the results will be in numbers. For example, the total number of visitors viewed a particular page. Here we have listed the top key metrics that you need to track in Google Analytics to measure the strengths and weaknesses of your site.

Install Google Analytics to WordPress using Plugins

Many plugins are developed for adding Google Analytics to WordPress. Adding Google Analytics in WordPress using a plugin is an easy process. If you are a non-developer WordPress user, you can give it a try to any one of the plugins listed below.

Before installing any plugins, make sure you have a google analytics account. If you don't have one, follow the upcoming steps below.

How to Sign Up in Google Analytics

Initially, log in or sign in to your google account. If you have no Google account, sign up for a new one immediately. Undergo the steps listed below to configure Google Analytics for your website.

Method 1: Install Google Analytics using the MonsterInsights plugin

MonsterInsights is a popular WordPress plugin that lets you easily connect Google Analytics with your WordPress website. Install and activate the MonsterInsights plugin. Download the accessible version of this plugin from your WordPress dashboard by navigating to Plugins > Add New. In the search area, type ‘monsterinsights,’ the plugin will be shown first in the result. Select ‘Install’ and then activate the plugin. Check our article to know how to install a WordPress plugin.

If you have installed the plugin, you can view the plugin menu 'Insights' in the left sidebar of your dashboard. It will show the launch setup wizard popup. Select it to configure the plugin.

It will show the welcome page to set up MonsterInsights. Firstly, choose your website category to see categories like Business Website, Publisher, and ECommerce. Then, click 'Save and Continue.

The next page connects google analytics with your WordPress site using the MonsterInsights plugin.

Secondly, provide your license key to activate the pro pack of the plugin. Click 'Connect MonsterInsights'. This will bring the 'sign in with google window'. Select your google email account. Then choose ‘Allow’ to allow the MonsterInsights plugin to access your Google Analytics account.

Pick a profile from the dropdown that you want to monitor and click 'Complete Connection.' Google Analytics will be installed on your website.

It will ask you to configure the recommended settings. Here you can add affiliate links paths. It will help you to track those affiliate links in Google Analytics. Then click ‘Save and Continue.

The page shows paid addons that you can use if you are using the paid version on the next page. You can skip this section by clicking the ‘Save and Continue button. Otherwise you will be asked next to install the WPForms plugin. The same author of MonsterInsights creates the WPForms plugin.

Directly install the WPForms plugin using the ‘Continue & Install WP Forms’ button. Otherwise just skip this section. That’s it, you have successfully installed Google Analytics inside your WordPress. You will be notified on the screen that it can take a few hours to display reports about your website. Read it and click the ‘Finish Setup & Exit Wizard’ button to complete the plugin setup.

Now you can view the reports inside your WordPress website. First, visit the page ‘Reports’ listed from the Insights menu. Then, simply navigate to the Insights > Reports. You will get a quick outlook of your website analytics.

You can get a quick overview of your website stats inside the separate widget named ‘MonsterInsights’.

Without leaving the WordPress website, you can see how your site performs. In its dashboard, you can view stats about page views over time, top-performing posts & pages, top traffic sources, top countries, and real-time stats. Moreover, you can avail of additional tracking features in the free versions like demographics, enhanced link attribution, file downloads, eCommerce tracking, and custom dimensions.

The premium version offers enhanced tracking options like Ads tracking, Youtube google analytics, Vimeo Google Analytics, HTML5 Video tracking, Custom Post Type Tracking, Email summaries, GA for AMP, GA for Facebook Instant Articles, Google Analytics GDPR Compliance, Form Conversion Tracking, and lot more. Get MonsterInsights Pro here.

Method 2: Using Google Site Kit

Google Site Kit is another excellent WordPress plugin that you can connect Google Products with your WordPress site. Install this plugin to know where your visitors are coming from and how they are using your website. The site kit plugin integrates and fetches data from Google Products like Google Analytics, Google Search Console, Google Adsense, and PageSpeed Insights.

With the analytics integration, you can track your visitor's navigation through your website and their completed goals. It shows stats for the entire website and every individual post. Use this plugin to set up multiple Google Products inside WordPress without code on your site.

This plugin is available for Free. First, get the Google Site Kit plugin for free from wordpress.org. Then, install the plugin in your WordPress. The menu ‘Site Kit’ will appear on the left side menu.

Once the plugin is installed, you can see a ‘Start setup’ button visible on the plugins menu page. Simply click the button. You will need to connect to your Google Analytics account. Then undergo a few simple steps to authenticate you’re the domain owner. Provide access to your Google Accounts data for the plugin and set up the Google service you want to add to your site. After you connect and set up the plugin, you can track Google Analytics data inside our WordPress dashboard. If you want more features for Google Analytics, you can look for other popular plugins mentioned in this article.

Method 3: Add Google Analytics with the Google Tag Manager plugin

Google Tag Manager or GTM is a tag management WordPress plugin. It is helpful if you have more than one site and want to add tags(or tracking codes) to those websites for different purposes. Google Analytics is one of the tracking codes where Google Tag Manager manages all tracking codes. It lets you easily add, edit or delete tags or Google Analytics tracking code on the website.

Rather than editing your website code, it’s just easy to add or update scripts inside the Tag Manager plugin interface. This saves you from getting errors and time-wasting in looking for developer help. Download Google Tag Manager free plugin. Sign up for a new GTM account. Create the first container and copy the container ID. Navigate to the manager dashboard → Admin. Search for a series of characters starts with the letter ‘GTM’.

Paste the GTM ID into the required related field on the settings page inside your website dashboard. Then, visit it by moving to Settings > Google Tag Manager. The tags you set up in Google Tag Manager will now work on your website.

Method 4: Using GA Google Analytics

This plugin provides the quickest way to add tracking codes to your website pages. It also includes a tracking code inside the header and footer of your website. Install the ‘GA Google Analytics’ plugin on your WordPress site. The plugin supports tracking options such as Universal Analytics, Google Site Tags, and Legacy. We have to add a Google Analytics tracking ID in the plugin settings to activate Google Analytics for the website.

Install and activate the plugin on your website. Next, we need to add a tracking code. Visit the Google Analytics account for your website and click Admin. Choose Data streams and select any one data stream. There you can see the Measurement ID. You can copy and use this measurement ID in the place of tracking ID.

Further move back to your WordPress dashboard, visit Settings → Google Analytics, and scroll down to visit the Plugin Settings section. Paste the copied tracking code in the GA Tracking ID field. Configure other details and click Save changes. Google Analytics is now activated for your WordPress site.

Method 5: Using Insert Headers and Footers Plugin

This plugin doesn't have any advanced tracking features. Similarly you can't view your Google Analytics data inside your website. It just lets you paste the tracking code to enable Google Analytics for your website.

In your WordPress dashboard, install and activate the plugin. Get the FREE version of the Insert Headers and Footers Plugin here. After you activate, navigate to the Settings menu and select ‘Insert Headers and Footers.’ Paste the copied Google Analytics tracking code inside the ‘Scripts in headers’ section. Once done, click Save changes. That’s it, you have installed Google Analytics on your website.

To get tracking code in Google Analytics 3, follow these steps below:

Follow the steps to get tracking code in Google Analytics 4

Install Google Analytics in WordPress Themes (Not using any plugin)

If you are familiar with coding or a developer, you don’t want to use any plugin to add Google Analytics to a website. You can try this method.

Get your tracking code by following any of the methods mentioned earlier. Next, login to your WordPress admin dashboard and locate the ‘Appearance → Theme File Editor’ tab.

You will see all files of your WordPress site are listed on the right side. The selected file codes will be displayed in the middle of the page.

Now add the copied code inside the header.php file. Paste the code before 'head' tag. The code will be applied to your entire site. If you want to use tracking code on particular pages, just select the specific page and add the code inside it. After that, click ‘Update File’.

Add tracking code in functions.php

You can also include the tracking code in the functions.php file. It will add the code to every page automatically. Select the functions.php file from the right-hand side and paste the code inside the code editor.

How to check GA Tracking code on your website

After you have added the code to your website, how will you confirm the Google Analytics installation is successful or not. Here we have listed some steps to verify the Google Analytics installation on your WordPress site.

View Google Analytics Reports

Google Analytics generates and shows reports based on the data collected from your website. You can view the reports directly inside the dashboard. It will offer real-time acquisition, audience, behavior, and conversion reports.

The real-time report will get and show the real-time or current view of your site traffic. The reports in the audience sections will be helpful for you to understand your users or site visitors. In the acquisition reports, you can know where the most traffic is coming from. The behavior report shows what the visitors do after they land on your site. With the conversion report, you can track your goals and how well they are going.


To sum it up Google Analytics has many more features that help optimize your site performance for your visitors. It is undoubtedly an excellent tool for business owners to know their audience and what/where they need to target to get more engagement and conversions. I hope this article explains all you need to know about installing Google Analytics on your site. Suppose you have any questions feel free to ask us at [email protected]. We'll be happy to assist you. Also, if you are looking for WordPress customization, we have expert teams to fulfill your requirements.

© 2023 | All Rights Reserved | Smackcoders, Inc

Cookies help us deliver our services. By using our services, you agree to our use of cookies.