• Skip to main content
  • Skip to footer
HostingWiki

HostingWiki

  • Home
  • Guides
  • About

June 19, 2019 - WordPress

How to Add Google Analytics to WordPress

Artūras B.

Trying to boost your site’s performance without the right tools is tricky. You may have already installed different plugins, re-written your content. And in order to improve performance, you must first see where your metrics are right now, to begin with. Integrating Google Analytics to your site is a fast and sure way of accomplishing just that.

This article will guide you on how to add Google Analytics to WordPress.

What Makes Google Analytics Important?

Google Analytics is a kit of free software created by Google to be used to track your site’s metrics. It provides information about all the statistics of your website, which will help you to improve your marketing campaigns, website design and content.

There are five things Google Analytics can help you with.

Firstly, you can track how your visitors find your site, otherwise known as Acquisition. Through this feature, you can check whether your visitors come directly from Google search, social media, referrals, or any other ways.

Secondly, the Behavior feature will let you assess how your visitors interact with your site. For instance, you can check the average time your visitors spend on your website or individual pages. Among other data, you can also track your total number of page views.

Thirdly, you can track the profits of your site under the Conversion section. This feature will show you how much money you’re making from your site. For instance, you will see tabs that show how many times your visitors click ads on your site.

Next, you can further learn about who your visitors are through the Audience feature. Here, you can check demographics, locations, and even the devices used to access your site.

Lastly, the Real-Time section will let you observe who is currently viewing your pages. You can see how many users are on your site, what device are they using, and what pages are currently viewed the most.

With all the data you can collect, Google Analytics is an absolute must-have. The data mentioned above will help you to asses your site and help you make decisions on what to improve.

Installing Google Analytics on WordPress

There are two ways to add Google Analytics to WordPress. You can either install a Google Analytics plugin by MonsterInsights or modify your theme’s code yourself.

If you are new to coding, this decision could be too risky. It requires technical knowledge, so you don’t mess up your website!

That’s why I recommend using MonsterInsight’s plugin. It’s much easier and it offers one major additional feature: you will have all the reports directly on your WordPress’ Dashboard.

Here’s how to add Google Analytics plugin to WordPress:

1. Signing Up to Google Analytics

The very first thing you need to do is to have a Google Analytics account.

To sign up, you will be asked to provide information such as your name, email, and password. Then, follow the instructions to verify your email.

After the verification process, you will be directed to the page below.Google analytics signing up processGo on and hit the Sign-Up button.

You will be asked to fill out your credentials.

Don’t mix up the Website and Mobile App sections, we need the Website section for this step. You will have to fill your website information including your website’s name and URL.

Make sure to fill all the required boxes and click Get Tracking ID. Your code will appear in a box.

2. Installing the Google Analytics Plugin

Follow these two steps to install the Google Analytics plugin on your WordPress site.

Click Add Plugin under the WordPress Dashboard on the left, search for Google Analytics by MonsterInsights. Install and activate it.Google analytics WordPress plugin by MonsterInsight search resultA pop-up box will appear asking you to finish the setup.google analytics registrationIt will ask you to choose your site’s category, match your code with the one you got when signing up for Google Analytics, adjust the settings, and to consider some add-ons which you may skip.

And that is it. You are all set!

3. Testing Google Analytics

Now that you have finished the setup, you can find the Google Analytics plugin on your WordPress Dashboard.testing google analytics WordPress plugin by MonsterInsightsYou will see three features you can utilize right away. The Sessions feature will show the browsing period of your visitors.

The Pageviews will show you how many views you have in total. And the Bounce Rate shows how long does a user stay on your website before leaving after a single page (doesn’t explore the site further).

Modifying Your Theme Code for Google Analytics

As I have mentioned before, adding Google Analytics to WordPress without plugins is also possible. Since you have to deal with code, I highly recommend that you backup your site before doing anything just in case.

Here’s how to add Google Analytics to WordPress by modifying your theme’s code:

Like in the first method, first you will have to sign up to Google Analytics and get your unique tracking code. After getting it, keep the tab open because you will need to move it to another page.

In your WordPress Dashboard, move your cursor on the Appearance Menu on the left side of your screen, and click Theme Editor.

Note: On some versions of WordPress, you will find an option simply called Editor. These sections are the same.Google analytics WordPress dashboard theme editor buttonIt will direct you to a new page. On the right side, find and click the Theme Header  (header.php).installing google analytics to wordpressNow, go back to the tab that has the Google Analytics tracking ID code and copy it.

In case you have closed the browser, you can still find the code in the Tracking Code section. Click Admin and find the Tracking Info. Then find the Tracking Code. It will direct you to your tracking ID code.

Go back to the Theme Header editor, and paste your Google Analytics code as shown in the screenshot below. Make sure you do not miss any characters otherwise it will not work.inserting google analytics code into theme editorDo not forget to click Update File on the bottom of the page and you are good to go.

One crucial reminder: it’s better to use a Child Theme when manually installing Google Analytics. It will prevent the code from getting erased when updating your WordPress software.

Conclusion

To have a thorough analysis of your site, Google Analytics is one of the few best software solutions you can install for free. Some of its highlighted features that will be useful for you are real-time tracking and visitors’ behavioral assessment.

You can install Google Analytics to WordPress in two ways:

  • Using a plugin
  • Manually adding in code

Using a plugin is a lot easier and beginner-friendly. What is more, you will see the tracking record on your WordPress Dashboard without having to open a separate page.

So, there you go, two ways you can do to have your site tracked and assessed by Google Analytics.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Footer

HostingWiki Logo

Site Links

  • Contact Us
  • Mission
  • About
  • Sitemap

Legal

  • Privacy Policy
  • Terms of Use
  • Cookie Policy
  • Contact Us
  • Mission
  • About
  • Sitemap

Additional menu

© 2021 HostingWiki is a Hostinger publication.