How to Add Google Analytics to WordPress

How to Add Google Analytics to WordPress Website

How to Add Google Analytics to WordPress

Introduction

Google analytics is a powerful tracking and web analytics tool designed for website owners. With this tool, powerful site traffic data such as the number of visitors to your site, your most visited pages, the amount of traffic your campaigns are bringing in, and so much more, can very easily be tracked.

Unfortunately, many web owners don’t utilize this tool. The truth is, if you are not actively tracking your website visitors and behavior, you are leaving money on the table!

Google Analytics does more than just tracking – it gives your eyes and ears to your website. In this WordPress tutorial, you will see what Google Analytics can do for you, and also learn how to add it to your website.

 

In this Article

  1. What Google Analytics Can Do for You
  2. How to Add Google Analytics to WordPress Site

 

What Google Analytics Can Do for You

Tells you what kind of people visit your website

With Google Analytics, you can check the countries where your visitors are coming from. But it goes beyond that. Google tracking also helps you determine your visitor’s language, the kind of browser they use, the size of their device screen, and lots more.

As a web owner, these data are very useful, especially for marketing. If you are looking to target particular demographics of users, your website should fit their preferences.

Say 80% of your visitors are mobile-only users and with browsers that support Javascript. Designing a highly responsive website is an absolute necessity.

 

Shows you what visitors do on your site

Google Analytics helps you understand the behavior of people on your site. You will be able to see the most visited pages, how users navigate from page to page, pages where users exit the site, etc. Even more, it checks the average amount of time users spend on every individual page.

With this data, you can reduce your website’s bounce rate, hence improving SEO.

 

Reveals how visitors locate your website

From the marketing point of view, it’s important to know how visitors locate your website. There are many ways visitors reach a website: social media, search engine, referral links, or direct visit. This data is available in Google Analytics.

Google Analytics report is very detailed. If most of your visitors come from social media, it tells you which exactly: Facebook, Twitter, LinkedIn etc. Using this data, you can easily decide which campaigns to increase and which to discard.

 

Tells you time when visitors are most active

From your Google Analytics report, you can determine what hour of the day traffic to your website increases. With that data, you will know exactly when to publish contents so as to get maximum views.

That said, let’s see how to set up Google Analytics on a Website.

 

How to Setup Google Analytics on WordPress

Signing up for a GA account is the very first step. To do this, head over to Google’s marketing page. Click “Sign in to Analytics”

sign in to analytics

You would see the following page

google analytics login

Put in your Google account details(which is your Gmail account), and click Next. You would be taken to the Analytics sign up page.

google analytics account signup page

Click the Sign-Up button. On the next page, you would be asked to provide your website details.

In the account name section, put in the name you want GA to save your account with. It can be the same as your website name. Put in all required information.  Don’t forget to select the reporting time zone.

Once you are done, click “Get Tracking ID”. It’s at the bottom of the page. Accept the terms and condition and proceed.

If all goes well, you would be presented with your GA tracking ID on the next page. Do well to keep it safe.

 

google analytics tracking info javascript code

Copy the tracking code because you will need it shortly. The tracking code consists of both the Javascript snippet and your unique tracking code which starts with UA.

Now you have your tracking code, it’s about time you added GA to your website. There are two ways to go about this: with a plugin, and without a plugin.

 

How to Setup Google Analytics with a Plugin

Plugins are there to make life on WordPress easy. There are quite a good number of analytics plugins that can handle this task. One of the best – due to its intuitive interface – is Google Analytics by MonsterInsights. And that’s what we shall be using in this guide.

When using this plugin, you will not be needing the tracking code you copied above. Monster insight connects automatically. Let us help you install Google Analytics in WordPress.

First, log into your WordPress Dashboard. Scroll down to plugins, mouse over and click “Add New”. Search for “Monsterinsights”

ga wordpress plugins

Install and activate the plugin. Select your website’s category and continue.

monsterinsights plugin

connect monsterinsights to your website

Upon clicking “Connect Monsterinsights”, you would be asked to sign into your Google account. If you have multiple accounts, select the one you had initially used for creating the account. Next, click on the “Allow” button.

allow google analytics tracking id

On the next page, click “Complete connection”. You are almost done. For the next two pages, leave things at default settings. Skip things that aren’t necessary.

The last and final page is this.

finish setup and exit

Click “Finish Setup & Exit Wizard”

So here’s how the dashboard on Monsterinsight will look like.

wordpress dashboard analytics

If you noticed, the data here is flat. This is because it’s a fresh installation. It takes about 24 hours for Google Analytics to pick up meaningful statistics.

You can track your website stats here or do it directly from your Google Analytics account.

 

How to Setup Google Analytics without a Plugin

How to Setup Google Analytics without a Plugin

Another technique for adding Google Analytics is by inserting the tracking code in the header.php file. To do this, on the dashboard in WordPress click Appearance >>Editor.  Drag down the scroll bar on the right side till you locate “Theme Header (header.php)”. Click on this file to open it in the editor.

wordpress theme editor in appearance

Scroll down. Just before the closing tag of the head, insert your GA tracking code. This should include the Javascript tag (<script>).

insert code to theme header

Click the update button. You are done!

 

To be sure analytics is properly working, open a page on your website. Then log into your Analytics account. Go to Real-time >> Overview. If you see 1 profile visit, your tracking code is working

test google analytics real time data

 

Conclusion

The importance of accurately tracking your website’s visitors can’t be overemphasized. Not only does it help you make better marketing decisions it also helps you make a better design decision.

This guide has shown you how to add Google Analytics to your website. If you are a pretty advanced user, we encourage you to do this without a plugin. Either way, ensure you set this up and get it working. Analytics give you the insight you need to build a successful online presence.