Adding Google Analytics to WordPress
Join Our Official Telegram and Youtube Channel. Telegram | Youtube

Adding Google Analytics to WordPress

Adding Google Analytics to WordPress

Adding Google Analytics to WordPress. Any user can easily install Google Analytics on a WordPress website regardless of their technical background.

Table of Contents

You’ll find how easy the steps are as I demonstrate how to set up Google Analytics on WordPress websites.

adding wordpress analytics to wordpress, adding google analytics to wordpress, add google tag manager to wordpress, add google tag to wordpress, add analytics to wordpress, add google analytics to wordpress without plugin, add google analytics code to wordpress, add ga4 to wordpress, add google analytics to wordpress site, add google tracking code to wordpress, elementor add google analytics,
Adding Google Analytics to WordPress

Also, we have covered a detailed guide on integrating Google Analytics with WooCommerce.

So, let’s get started!

While there are many ways of integrating Google Analytics with WordPress websites, the steps mentioned remain the same for all methods.

Step 1: Create a Google Analytics Account

You need to create a Google Analytics account. For this, go to From there, two cases arise:

  1. You already have a Google account: Log in with your credentials.
  2. You don’t have a Google account: Create a new account by clicking the “Create account” button. Fill up the information, including your name, email address, password, and related information (date of birth, mobile number, location, etc.).
  • Once you’ve created your Gmail account, open the Google Analytics homepage and click the Start measuring button.

google analytics

  • You will see the Account Setup screen.
  • Fill in the account name and select the Account Data Sharing options.
  • Click Next.

analytics setup

  • You will see the property setup screen that lets you choose the reporting time zone, currency, and name.
  • Fill in the information and click Next.

google analytics property setup

  • You will see the About Your Business form that asks you to select your industry category, business size, and intent to use Google Analytics.

analytics about your business

  • Once you click the Create button, the Google Analytics Terms of Service Agreement popup will appear, prompting you to accept their terms and conditions.

google analytics terms

  • In data streams, choose your preferred platform to collect the data.

select web analytics

  • Set up the data stream by adding your Website URL and Stream name, then click the Create Stream button.

google analytics data stream

  • You’ll see the Web Stream Details screen, showing that the web stream is created, but the data collection isn’t integrated and active, indicating you to install Google Tag on your WordPress site.

google tag

And here’s how you can add a Google tag:

Click the View Tag Instructions button, and you’ll see two ways to add the tag:

1) Install with a website builder or CMS.

2) Install manually.

When you add the tag to your website, Google will start tracking the data to your Analytics dashboard.

analytics installation

4 Easy Methods to Add Google Analytics to WordPress

You can install Google Analytics tracking code on your WordPress website via four different methods. I have listed all four below:

Method 1: Add Google Tag Code to Header.php

You can add Google Analytics to WordPress by simply copying/pasting the Tracking Code to your website code (in the “header.php” file).

add google tag

Follow the steps below:

  • Go to the WordPress Dashboard.
  • Click Appearance → Editor.
  • Click the “header.php” file to edit its code.
  • Copy the “Tracking Code” from Google Analytics and paste it into the header code. Ensure to paste the code right before the </head> tag.

enter code in themes function

  • Once it’s done, wait for a few hours, as the installation can take up to 48 hours to fully activate.

analytics dashboard

Method 2: Install the Google Analytics WordPress Plugin

Installing Google Analytics via a plugin is an excellent alternative if your theme restricts you from using the first method.

The process requires installing a WordPress Google Analytics plugin. And since the WordPress plugin repository offers multiple solutions, I’ve mentioned the two best Google Analytics WordPress plugins to help you do the job without any fuss.

1. Google Analytics Dashboard for WP

GA Google Analytics is a simple, well-coded, and powerful plugin. Follow the steps below to install GA on your WordPress site.

  • Go to your WordPress Dashboard.
  • Click Plugins → Add New.
  • Type “GA google analytics” in the search box.

ga analytics plugin

  • Click the “Install Now” button and then “Activate” the plugin.
  • Configure the plugin once it is activated.
  • Go to Dashboard → Settings → Google Analytics.
  • Click Plugin Settings.
  • Copy and paste the “Tracking ID” you find on the “Google Analytics Tracking Code” page (see previous screenshots).

ga tracking id

  • You must check the “Universal Analytics / analytics.js” and “Include tracking code in page head (via wp_head)” boxes that set up Google Analytics on the WordPress website.
  • Click the “Save Changes” button.

2. MonsterInsights

Google Analytics for WordPress by MonsterInsights is another popular Google Analytics WordPress plugin. It is a freemium plugin and is widely used because of its easy-to-use interface.

  • Install and activate the plugin by following the same steps shared in the previous method.
  • Navigate to the plugin’s settings page to link it with your Google Analytics account.

monster insights plugin

  • Click the “Connect MonsterInsights & Setup Web Analytics” button and run the MonsterInsights setup.

welcome monster insights

  • Select your site’s category.

category monster insights

  • I’m using a free version of MonsterInsights that doesn’t require any license. You can opt for the pro version if you want to enjoy the plugin’s premium features.

connect monster insights

  • Connect & authenticate your Google account with MonsterInsights.

connect and authenticate monster insights

  • After authenticating your Google account with MonsterInsights, click Save & Continue on the recommended settings & features screen.
  • Once the setup completes, the plugin takes a few minutes to fetch tracking data and displays the live tracking data in the WordPress dashboard.

analytics data

Note that a few options are restricted in the free version. But the pro version comes with options such as forms and multiple other features.

Method 3: Using Google Tag Manager

Another method to add Google Analytics to a WordPress website is using a Google Tag Manager. Follow the steps below:

  • Go to your WordPress dashboard.
  • Click Plugins → Add New.
  • Search for “Google tag manager” in the text field.
  • Install and Activate the plugin.

google tag manager

  • Visit Google Tag Manager and click the “Create Account” button if you have not already signed up.

create account on google tag manager

  • Enter the required details, including Account NameCountry, and Container Name, and click the Create button.

tag manager for web

  • Read the Google Tag Manager’s Terms of Service Agreement and mark the agreement to continue.

google tag manager terms

  • Once you complete the signup process, you will see the Google Tag Manager snippets.
  • Click the OK button to get your Google Tag Manager ID.

gtm id

  • Return to the plugin’s settings, and paste your Google Tag Manager ID.
  • Click the Save Changes button.

gtm settings

  • Congratulations! You have successfully installed Google Analytics via Google Tag Manager.

Method 4: Hosting WordPress Google Analytics Locally

If you don’t prefer any of the three methods mentioned above, there’s another one for you: local hosting.

Google Analytics can be hosted locally on your server for better performance as it reduces external HTTP requests. To integrate this functionality, I will use a lightweight WordPress Google Analytics plugin, Complete Analytics Optimization Suite, developed by Daan van den Bergh.

Follow the steps below:

  • Head over to the WordPress dashboard.
  • Click Plugins, and search for “CAOS.
  • Install and activate the plugin.
  • Navigate to the plugin’s settings page.

caos plugin

  • Enter the Google Analytics Tracking IDe and select the location to place the tracking script.

google analytics tracking ID

Make Sure Google Analytics Works Well

Once you have integrated Google Analytics with your WordPress site, the next step is to verify the integration.

You can easily test the Google Analytics integration with your site by following the steps below:

  • Go to Google Analytics.
  • Click Real-Time → Overview.
  • Visit any page of your WordPress website.
  • If Google Analytics is connected to your website, you will see a bar indicating your website data goes back well in Google Analytics.

google analytics traffic overview

Note: It may take some time before the data is reflected in Google Analytics.

Frequently Asked Questions

How to add Google Analytics WordPress?

You can add Google Analytics to WordPress by setting up a Google Analytics account and pasting the tracking code inside your site’s header file. You can also add Google Analytics by using a plugin like GA Google Analytics or any other Analytics integration plugin.

How to add the Google Analytics WordPress plugin?

Follow the steps below to add the Google Analytics WordPress plugin: 

  1. Go to your WordPress dashboard.
  2. Click Plugins > Add New. 
  3. Search for the desired plugin. 
  4. Install and activate the plugin. 
  5. Navigate to the plugin’s setting page and connect it to your Google Analytics account.

Is there a Google Analytics plugin for WordPress?

MonsterInsights is the most popular Google Analytics plugin for WordPress. It allows you to easily add Google Analytics to your site, and you can access your reports right from your WordPress dashboard.

How to add Google Analytics to WordPress without a plugin?

Follow the steps below to add Google Analytics without the WordPress plugin
  • Step 1: Create a Child Theme. First, you'll need to create a child theme. ... 
  • Step 2: Copy the Header.php File in the Parent Theme. ... 
  • Step 3: Get the Google Analytics Code. ... 
  • Step 4: Paste the Code into the Header.php file. ... 
  • Step 5: Compress and Upload the File. ... 
  • Step 6: Check If It Works.

Wrapping Up!

Adding Google Analytics to WordPress has shared the easy steps of setting up a Google Analytics account and integrating it with your WordPress website.

You can refine your site’s data analysis by editing Google Analytics’configuration options and creating different profiles by playing with filters, creating objectives, or even setting up events/tracking e-commerce.

These configurations will allow you to analyze traffic and help improve conversion rates. In case of any questions, do not hesitate to ask us for advice in the comment section.

Post a Comment