Breaking news! Last time I checked, your site received 2,519 visits last week.

And you know what? I even know that 56% of your users visit it from their smartphone, and that your content appeals to Spanish speakers: 18% of your readers speak Spanish. Olé!

I can already imagine your surprise. I wouldn't have made up this story from scratch, would I?

If you want to be sure, you'll have to install Google Analytics on WordPress.

Thanks to this tool, you will know precisely the key-performance indicators concerning your traffic, among others.

In this post, I'll show you how to take advantage of this tool on WordPress, with or without a plugin. Vamos!

What is Google Analytics?

Google Analytics is a free statistical analysis service offered by Google, which allows you to track visits to your website.

Thanks to reports and dashboards, Analytics allows you to “understand your site and app users to better evaluate the performance of your marketing, content, products, and more”.

The goal is to offer your visitors “better experiences and improve your results” in terms of SEO and webmarketing.

A guide to integrating Google Analytics to WordPress

Launched in 2005, Google Analytics (GA) is used by nearly 30 million sites. It is also the most popular traffic analysis tool among webmasters.

85.1% of them use it, compared to 13.6% for the Facebook pixel, and 7.1% for Jetpack, the famous swiss-knife plugin dedicated to WordPress.

GA stats
Source : W3Techs

That's for the front-end. I'll take you now to the engine room to see how this tool works.

How does this tool work?

Technically, a piece of JavaScript code of a few lines, added beforehand on your site – I'll show you how to do it a little later -, allows you to collect information on the actions and behaviors performed by the visitors of your site.

The Javascript code for Google Analytics
Here is what a GA tracking code looks like

Next, Google processes this data on its servers, then returns it to you in a precise manner, by classifying it according to different indicators.

In the end, it's that “sorted” version you see on the screen in your account.

An overview of the figures you'll find in Google Analytics

Don't confuse Google Analytics with the Search Console

Before moving on, I draw your attention to a rather frequent confusion: no, Google Analytics has nothing to do with the Google Search Console.

If there are common points and bridges between the two – it is possible to link them -, these two complementary tools are quite distinct.

The Google Search Console (GSC), which is also free, allows you to manage your site with a focus on your SEO.

For this, it provides you with a lot of information: errors on your site, search analysis, links, indexing status, exploration errors etc.

The Google Search Console

Globally, you have just seen that Google Analytics allows you to better understand your customers' behavior.

In the next part, I'll explain to you at which particular levels it will be (very) useful for you.

Why do you use it?

Google Analytics and the 5W rule

Do you know the 5W rule? In journalism, and in the broadest sense in the editorial field, the 5Ws designate 5 key-questions that a piece of information must answer in order to be understood.

That corresponds to :

  • What?
  • Who?
  • When?
  • Why?
  • Where?

You must tell yourself that we're getting off topic. Well, we're not.

As it turns out, our 5Ws apply in some way to Google Analytics, which provides you with statistics on the following :

  • What your visitors do on your site: you can find out which pages are the most visited, the bounce rate, the average time spent on the page.
  • Who are your visitors: find out demographics (age, gender), interests, or the devices your visitors use to navigate your site.
  • When they usually visit your site: you can access the precise time your visitors go to your site.
  • Why they use your site: Google Analytics gives access to information allowing you to know the actions carried out on your site (e.g. the links clicked by your visitors). It is also possible to know why they land on your site, by finding out which channels they used (social networks, search engine etc.).
  • Where they come from: Geographic data (spoken language, geographical area) allows you to locate the origin of your users.

Thanks to all these statistical elements, you will be able to “identify what works or doesn't work”, as Google says, and adjust your SEO strategy, content… if needed .

Don't forget to optimize what doesn't work, by being sure to make informed decisions to develop your traffic, your revenue, or the number of subscribers to your newsletter.

Discover concrete examples just below, in order to implement actions to improve the experience of your visitors.

Improve your results

Your customers can't find your website from a search engine

You have made a lot of effort to be visible on search engines, but Google Analytics tells you that the majority of your traffic comes from social networks.

Never mind: use this opportunity to double your efforts on Facebook, Twitter, YouTube and the like, or even on Google and its little friends.

It's up to you: now you know what works.

Warning: your pages don't perform !

You've spent dozens and dozens of hours optimizing the visual appearance and content of your About page.

Yes but here it is: Google Analytics is throwing you back in the face that it generates few visits.

And on top of that, you realize your bounce rate is catastrophic.

There's gotta be something wrong. Take this opportunity to correct some points that you feel are not working properly.

Thanks to the site's Speed feature, you can also check the loading time of your pages.

This criterion is crucial for your SEO. Google will tend to better rank (among hundreds of other criteria) pages that load faster.

What if you were to expand internationally ?

Last practical case for which Google Analytics can be useful to you: international development. I'm talking about this specific point because it echoes the situation of WPMarmite, which has launched its english version in the end of 2019.

If you've stayed focused on what I told you before, maybe you remember what I told you about geo-data.

How is that useful? Well, if you find that a significant portion of your audience speaks French, perhaps you should take action accordingly.

For example, translate your pages to start ranking on queries in WPMarmite's beautiful (but so hard to learn!) mother tongue.

To sum it all up, studying the behavior of your visitors is very important to have a detailed knowledge of your audience, and to serve them better.

Note that Google Analytics will also be a valuable ally if you need to perform a site audit, for a client for example.

Is everything clear to you? Before going to the next step and seeing how to create a Google Analytics account, I would like to make a stop on the data collected by Google, and how it is processed.

Is this all in compliance with regulations?

The thorny RGPD issue

Since May 2018, an acronym has been in the news a lot. I'm sure you've heard of it.

This is called the RGPD, for General Regulations for Data Protection.

The purpose of this regulation is to ensure that every individual has control and protection over the personal data he or she disseminates when surfing the web.

Using Google Analytics, you fall within the scope of the RGPD since GA processes personal data, in particular:

  • IP addresses
  • Cookies

 As for Google itself, it guarantees the confidentiality and security of the data it collects. The Mountain View firm gives full details of  its privacy and usage rules on this page, if you are interested.

Concerning Analytics, you'll still find some areas of work concerning your privacy settings.

Google specifies, for example, how to anonymize IP addresses, and how to set the retention period for the data you collect.

In short, that's a lot of technical stuff… and it's pretty nebulous too, I must say.

Especially since, as detailed by this French specialist,”there is no simple solution that allows you to use Analytics in total compliance with the regulations”

Here is my advice: do your best and get ready for the next step – the creation of your GA account.

How to create a Google Analytics account?

In order to use Google Analytics, you'll have to have a Google account (a Gmail address will do).

To start off, I'll tell you how to create an account on Google Analytics.

First go to this page, choose Start for free if you don't have a Google account yet, and follow the instructions.

Personally, I already have a Gmail account, so I just have to enter my login and password to connect to the homepage of my GA account.

Then I go to the Admin menu at the bottom of the left column.

The Google Analytics menu

As I have sites tracked in Google Analytics, I clicked on the blue button Create an account – but for you it might be a little bit different.

Start by giving your account a name, for example the name of your website.

Setting up your Google Analytics account before plugin it in to WordPress

Leave the account data sharing options checked and click Next.

At the next step, select Web, Measure your website. Normally, this option will already be selected. Click Next.

Account setup

To complete the process, all you have to do is set up what Google calls a “property”, i.e. your website.

We're going to ask you to fill in four things:

  • The name of the website.
  • Its URL: be careful, remember to select HTTPS if your site uses this protocol.
  • The sector category: this helps you have statistics to compare yourself to other sites in the same category. It's up to you to choose what best suits the activity of your site. For your information, for WPMarmite, I chose “Internet and telecom”, which was the closest I could get.
  • Time zone. Here, I logically chose France. It's up to you to adapt according to your location.

Finish by clicking the blue button Create.

Create a Google Analytics account

Google will then ask you to accept its terms of use, and you will end up with a tracking ID.

This is the famous piece of JavaScript code I told you about at the beginning of the article.

The Javascript code for Google Analytics
Here it is again!

Before showing you how to integrate your Google Analytics code on your WordPress site, I suggest you to discover the main menus of GA.

Because when you come across this tool, which is quite simple to setup, it's quite easy to get lost, as there are so many options.

Some of the terms used might sound all Greek to you. I'm thinking for example of cohort analyses and others multi-channel funnels.

But don' t worry: there's no need to use some slightly barbaric indicators to get access to basic performance statistics, that will be enough to get you started. You'll see this in detail at the end of this guide.

The homepage

You can see that statistics are displayed on the capture below: they come from an existing website. On your homepage, after creating your account, you will have blank numbers.

Google Analytics homepage

On the right hand side, you can find a general overview through different dashboards. You will find stats on the number of active users, the pages they visit, the devices they use, their geographical origin or even the bounce rate.

On the left column, several menus are at your disposal :

  • Customization: to create custom reports and email alerts. To get started, you don't necessarily have to use this menu.
  • Discover: you will find tutorials to setup Google Analytics.
  • Administration: this gives you access to settings concerning your account, your property (website) and your view (custom data).
  • Reports: composed of several sub-menus that you will use most often. We detail them right below.

The Reports menu

The Reports menu consists of 5 tabs :

  • Real time: As its name suggests, find real-time information on the number of Internet users visiting your site, their geographical location, the pages they are browsing, or the sources of traffic.
  • Audience: contains data about your visitors, whether it is geographic data, demographic data, the browsers used or the number of users. You can have a preview of your visits thanks to this kind of graph:
Google Analytics reports
  • Acquisition: allows you to see where your traffic comes from to identify the sources that bring you the most visits. GA mainly separates into 4 channels: organic search (search engine), direct, social (social networks) and referral.
  • Behaviour: gives you access to the actions carried out by your visitors on your site, in particular the pages they visit. You will also find the average loading time of your pages.
  • Conversions: you will only be able to take advantage of this tab if you activate goals, which are used to measure specific actions, called conversions (e.g. buying a product). In general, a conversion is a specific action you want a user to perform.

I hope you find the Google Analytics interface less intimidating now.

Until now, you have discovered the interest of this tool and how it works.

Now, you'll see how to install Google Analytics on WordPress, and find out what your visitors are up to when they come to visit you.

Speed up your website with WP Rocket

Turn your site into a rocket with the most powerful caching plugin recognized by WordPress experts.

How to install Google Analytics on WordPress with a plugin ?

To link Google Analytics to WordPress, you need to add your famous tracking code on your site.

For that, there are two ways to proceed:

  • Use a plugin that will do it for you – sort of
  • Add it manually

Let's start with plugins. Here are 3 that caught our attention.

3 Google Analytics plugins for WordPress

Tell me, Thibaut, what's the point of using a plugin if you can do it all manually?

First of all, a plugin will help you if you don't want to mess up by adding your tracking code at the wrong place in your theme.

With a Google Analytics plugin, you avoid a little stress, and the process is a bit easier. To simplify, let's say that it will be in charge of integrating your Google Analytics code into your WordPress pages.

Besides, a pluin often gives you access to your statistics directly on your website's dashboard. You don't have to go to Google Analytics to see them.

Finally, when doing this manually, you have to think about incorporating the tracking code into your new theme, if you need to change it over time. With a plugin, you don't have to worry about that.

Monster Insights: the heavyweight

Monster Insights: a great plugin to plug in Google Analytics to WordPress

Active installations: 2 million+

With over 2 million active installations, this is the most popular plugin of the official directory to integrate Google Analytics on WordPress.

So it's hard not to mention it here.

For the record, Monster Insights is one of many tools created and developed by Syed Balkhi and his team, along with Optin Monster, the maintenance plugin SeedProd, or WPForms.

Balkhi is also the man behind the famous american website WPBeginner, that specializes on WordPress (like WPMarmite !).

But let's go back to one of his babies: Monster Insights. This plugin is simple to use and to set up. A wizard guides you step by step through adding your tracking code, and does almost everything for you.

We also appreciate the access to statistics (including real-time figures) directly on the dashboard.

Monster Insights reports

On the other hand, the free version has a rather limited access to stats. The basic data is there (sessions, page views, bounce rate, type of device used, new visitors, geographical origin of users), but that's all.

Let's just say that, for an overview of the traffic, that's fine. But for further study, this will not be enough. Most of the features are only available in the Pro version, which goes much further.

It allows for example real-time traffic monitoring, form conversions, or data on which post types have the best stats. On the other hand, it represents a rather significant investment (from 199$/year, or about 178€), even if there are often promotional offers.

Note : Syed Balkhi and his team also develop and maintain the Google Analytics Dashboard for WP by ExactMetrics plugin, acquired in 2018. It has more than 1 million active installations and is 100% free of charge; with options only available in the Premium version of Monster Insights… But that was before an update in mid-February, that turned a lot of free features into paid features. As a result, there has been an outcry from users who have gone wild by publishing 1-star reviews, which are now  the overwhelming majority. Basically, I don't recommend this plugin anymore, especially since its dashboard is less pleasant and less easy to use than its big brother Monster Insights, from my point of view.

GA Google Analytics: featherweight

Another plugin to plug in Google Analytics to WordPress

Active installations: 300,000+

With over 300,000 active installations, GA Google Analytics is not lagging behind.

The plugin is developed and maintained by Jeff Starr, one of the most renowned WordPress developers in the US.

He notably designed, with Chris Coyier, the excellent book Digging into WordPress. If you want to know all the meanders of your favorite CMS, go for it.

GA Google Analytics is a plugin known for its performance (it is light) and can be set extremely easily.

Look at its settings menu, which pretty much says it all:

GA Google Analytics settings

Even if the settings are voluntarily reduced to the congruent portion, there are some nice options, such as the possibility to anonymize IP addresses, as you saw when studying the RGPD.

Beyond that, it is important to know that the plugin is also very well-rated by its users (5 stars out of 5), which is a guarantee of quality.

Personally, I like it a lot. On the other hand, you have to know that it does not show your statistics on your WP dashboard.

To view them, you'll need to continue to go to your GA account.

For further options, there is a Premium version (starting at 15$ for use on 1 site) which allows, among other things, to setup several tracking codes, or to disable tracking by content types (posts, pages etc.).

Site Kit by Google: the made in Google

Google Site Kit is the official Google Analytics WordPress plugin

Active installations: 100,000+

Available since October 31, 2019, Site Kit is one of the last “big” GA plugins to have appeared on the official directory.

It's totally free and it's actually a swiss army knife. We can say it's a kind of official Google Analytics plugin… without being one, since it's not only dedicated to it.

In reality, it gives access to 4 analysis tools on your WordPress Dashboard :

  • Google Analytics
  • Google Search Console
  • AdSense, Google's ad network
  • Page Speed Insights, to measure the loading time of your pages

The Dashboard is quite minimalist and rather clear, which makes it easier to understand.

Google Site Kit dashboard

The data it gives you access to is quite basic (users, sessions, bounce rate, session duration, traffic origin, best performing content) but the essential is there to start with.

However, for more advanced statistics, you will have to go back to your GA interface. Note that Site Kit also offers a link on its dashboard to go there directly, which is convenient.

To be noted moreover: the plugin is rather badly rated (3.5 stars out of 5). I don't use it on sites in production so I can't give you a long-term feedback. However, on my test site, there's nothing problematic to report.

Other plugins you could use

There are dozens and dozens of plugins specific to Google Analytics, and we couldn't talk about each of them here.

I haven' t tested them, but be aware that to integrate Google Analytics on WordPress, you can also look at Google Tag Manager for WordPress, Analytify, or 10WebAnalytics.

But that's not all. Here are other plugins to consider, depending on your usage:

  • If you use WooCommerce, the extension Enhanced Ecommerce Google Analytics Plugin for WooCommerce will allow you to take advantage of the enhanced ecommerce functionality of Google Analytics, called enhanced ecommerce feature. It allows you to better understand the behavior of your users on your site.
  • If you use the free version of the Jetpack extension, you will have access to the “site stats” (number of visits on your site, number of clicks, or the search terms most used by your visitors). It's pretty basic, and if you want to integrate Google Analytics, you will have to opt at least for the Premium plan (108.90€/year).
  • If you want to enjoy event tracking options, WP Google Analytics Event should suit you. The plugin allows you to follow a specific action performed by a user (downloading a document, for instance).
  • If you're looking for an alternative to Google Analytics, I'll end this part by telling you about Matomo (ex Piwik). It is a free and open-source tool, and has many advantages concerning the protection of collected data. For example, Matomo stores the data of your visitors on your own server, not on Google's server. A plugin exists on the official directory (WP-Matomo) but you must have a Matomo account to use it.
WP Matomo, to link WordPress to Google Analytics

Well, as for the plugins, I think we've covered all the bases.

If you don't mind, let's switch right now to the second method to add GA on WordPress.

Which plugin is the right one for you?

  • If you want to find a good part of your stats on your WordPress dashboard, without going to Google Analytics: choose Monster Insights.
  • If finding your key-metrics on WordPress is not your priority, but you're looking for a lightweight plugin that does the bare minimum (adding the tracking code) very well: go for GA Google Analytics.
  • If you're a fan of all Google tools and want to find them all on your site administration in addition to your Analytics stats, activate Google Site Kit.

Install Google Analytics on WordPress without plugin

You prefer to do without an plugin and diving into the WP code doesn't scare you?

The manual method is made for you. To install Google Analytics on WordPress without a plugin, you must first get your tracking code from your GA account.

Step 1: retrieve the tracking code from your Google Analytics account

To do this, click on the Admin menu at the bottom of the left column.

Then, in the middle column Property, select Tracking Info > Tracking Code.

Copy and paste the tracking code present in the insert called Global Site Tag:

Find your tracking code in GA

Step 2: add the code in functions.php 

Once you've copied the code, all you have to do is add it in the right place. Hence my question: do you know where to place the Google Analytics tag on WordPress?

Come on, I'll give you the answer: in the functions.php file of your child theme.

Warning, I did say your child theme, it's very important!

A child theme is a sub-theme that inherits all the functionality and style of the main theme, also called parent theme.

By using a child theme, you make sure you don't lose your tracking code when you next update your theme.

All right, is your child theme ready to go? Continue by copying the functions.php file of your parent theme (in wp-content > themes > folder of your theme), in your child theme's folder:

Manually insert your GA tracking code in your child theme

Then open the functions.php file of your child theme, and paste the code below at the end of the file. Remember to paste your GA script instead of the text /* GOOGLE ANALYTICS SCRIPT */, of course:

function wpm_google_analytics() { ?> /* GOOGLE ANALYTICS SCRIPT */<?php}add_action( 'wp_head', ' wpm_google_analytics ' );

Be careful not to forget a tag or character. Finish by saving the file and that's it: you're done.

All you have to do is wait for Google Analytics to do its part and detect your code to take advantage of your statistics 😉

Your best WordPress projects need the best host!

WPMarmite recommends Bluehost: great performance, great support. All you need for a great start.

How to check if GA is working properly

Your site has had your tracking code for a few minutes and you can't wait to learn more.

Which pages get the most hits? How many visits have you had already? Is your content getting famous in Spain (olé!) and the United States?

To begin with, you may have to be patient. It can take up to 24 hours to process the code, so don't panic if you don't see anything coming after a few hours.

To check that your tag is correctly configured, you can check user activity in real time on your site.

To do this, go to the Real-Time menu > Overview from the Reports section, located in the left column of your Google Analytics account.

If the Dashboard displays 0 active users on your site, this is normal.

Visit a page of your choice on your site and return to your Analytics dashboard. If all goes well, you should now see 1 visit in real time.

Realtime overview in GA

On what KPIs do you need to focus once GA is installed?

As you just saw, Google Analytics is relatively simple to install on WordPress.

To use it and take advantage of it is another story, as it offers so much possibilities!

First, I suggest you stop on 5 KPIs that will allow you to start identifying what works or doesn't work, so that you can make the appropriate changes, if necessary.

Your traffic

Let's start with the basics, which is probably what interests you first: does your site attract visitors? And more importantly, how many?

To find out, go to Audience > Overview.

A graph shows you the number of users over the period of your choice, which you can refine using a calendar in the top right of the page.

Traffic in Google Analytics

You will then have a detailed overview of several stats:

  • Sessions: the total number of visits received.
  • Users: people who have visited your site once or several times.
  • Bounce rate: this indicator should be watched closely, without getting obsessed by it either.

Your audience

Now that you know how many visitors your site has received over a given period of time, you'll surely want to know who are the individuals who view your content.

Everything's still going on in the Audience section. You can see the age and gender of your visitors through the Demographics tab, or their geographical location in the Geo tab.

Audience in Google Analytics

Your traffic sources

In your opinion, is your traffic coming from search engines or social networks?

Stop making vague assumptions and check it out by going to Acquisition > Overview.

Traffic sources in GA

Basically, you will find a diagram with the percentage of use of your main channels:

  • Social: share of users coming from social networks.
  • Organic Search: visitors coming from a search engine.
  • Direct : refers to users who typed the address of your site in their browser.
  • Referral: refers to users who arrived on your site after following an external link.

Most visited pages

Once your users are done, do you know which pages they visit first? To find out, use the menu Behaviour > Site content > All Pages.

A summary table shows you the articles that perform best. You can discover the topics that your readers like, and thus take the opportunity to (re)orient your content strategy, for example.

Most visited pages in GA

Devices used

Finally, it is very useful to check what kind of devices your users have used to visit your site.

Go to Audience > Mobile > Overview to find that out.

In the example above, you see that 7.25% of the total site traffic over the chosen period comes from smartphones.

So you might as well tell you that your site better be responsive (adaptable to all types of media) and adapted to mobile navigation. Otherwise, you know what you have to do 😉

Here's for this first quick overview of some basic Google Analytics features.

Of course, it is possible to go much further in the analysis.

Don't forget that it is also possible to set your own conversion targets (via the menu Conversions) to find out if your visitors perform specific actions you want them to do (e.g. download a PDF, buy a product etc.).

Don't forget the custom reports and alerts (menu Customization) in order to be warned in case of changes in your traffic, for example.

Finally, I recommend you to browse through all the links proposed by Google Analytics to discover new features.

You can also enjoy the online help offered by Google at this address.

Debrief: end of Analytics

In this post, you've discovered how to install Google Analytics on WordPress, its advantages and how to enjoy its functionalities.

Do you use it in your daily webmastering? Did you choose a particular plugin to add to your site ?

Share your feedback by posting a comment.