How To Add Google Analytics To Your WordPress Website (With Or Without A Plugin)


Integrating or adding Google Analytics to WordPress website is one of the most crucial steps in our website design process.  We start with setting up the site on our development server and once the site is reviewed and finalized by the client, we go ahead and migrate the site to the production server. There are a lot of steps involved in this process  and setting up Google Analytics is one of the most important steps in the series.

What is Google Analytics?

Google Analytics is a web analytics service offered by Google. It is a powerful platform that helps you in tracking and measuring the success of your website. It helps you in analyzing the site traffic, understanding how users interact with your website and helps you in identifying how conversions happen on your site.

In short, Google Analytics is a report card of your website. It tells you how your website performs.

The customer experience is written in data and Google Analytics drives this data. It helps you in finding the answer to the most common questions like:

  • Who is visiting your website and from which part of the world?
  • What do people do when they are on your website?
  • When do people visit your website?
  • How do people find your website?
  • How do people interact with your content?

It keeps the guesswork out of the scene by providing interesting insights into your site’s KPIs (Key Performance Indicators), including sessions, pageviews and bounce rate.

How to signup with Google Analytics?

Here’s a quick video tutorial to help you with signing up for Google Analytics in 5 minutes.

After signing up for Google Analytics, you will be presented the Google Analytics tracking code. You will need to copy this code for manually adding Google Analytics to your WordPress website.

How to add Google Analytics to your WordPress website?

Here are three simple ways to add Google Analytics code to your website.

  1. Adding Google Analytics code to your theme’s functions.php.
  2. Installing Insert Headers and Footers plugin and adding the Google Analytics code.
  3. Using Google Analytics for WordPress by MonsterInsights plugin.

Add the Google Analytics code via functions.php

Edit your theme’s functions.php and add the following code:


function bt_add_google_analytics() {
	// Paste your Google Analytics code here 

Add the Google Analytics code via “Insert Headers and Footers” plugin

  1. Install and activate Insert Headers and Footers plugin.
  2. Go to Settings > Insert Headers and Footers.
  3. Paste your Google Analytics code under “Scripts in Header” box on the plugin’s settings page.
  4. Save the settings and Google Analytics is successfully added to your site.

Using Google Analytics for WordPress by MonsterInsights

Google Analytics for WordPress by MonsterInsights is a WordPress plugin which allows you to connect your WordPress website with Google Analytics. While you can easily add Google Analytics code to your website without using a plugin, Google Analytics for WordPress by MonsterInsights has its own advantages.

  1. It enables you to view the analytics data directly in WordPress dashboard. This means you can get a quick overview of the analytics without logging into your Google Analytics account.
  2. While tracking the user data, it allows you to select the user roles which should not be tracked. For example, website administrator frequently visits the site for maintenance and updates; tracking this user role is of no use and thus should be excluded. When we manually add the code, we easily skip this dimension.

Here are 3 simple steps to set-up Google Analytics for WordPress by MonsterInsights

  1. Install and activate Google Analytics for WordPress by MonsterInsights. Go to Insights > Settings from your WordPress admin menu and configure the plugin settings.
  2. Follow the wizard to authenticate the plugin with your Google Account.

    monsterinsights set-up wizard

  3. Visit Tracking tab under plugin settings and specify the user roles which you want to exclude from tracking under Engagement menu.


Pro Tip: Set-up Quill Engage

Once you have integrated Google Analytics to your WordPress website, the next step is to sign-up for Quill Engage.

Understanding the Google Analytics reports can be a daunting task. Quill Engage comes in handy if you find it difficult to understand Google Analytics data.

Quill Engage explains Google Analytics data in plain English and delivers custom reports directly to your inbox.

Quill Engage analyzes your Google analytics data and presents it in the simplified form which even a layman can understand. It presents a complete overview of your analytics data broken down into consumable chunks of data like traffic sources, new referrals, traffic by device, locations, average time spent by users on the site, pageviews, sessions, etc — all presented in words.

Need help with setting up Google Analytics for your website? Leave a comment and we will be happy to help you.

Divi WordPress Theme