Do you know how to install Google Analytics on a WordPress site? Adding Google Analytics is the best way to track how visitors interact with a website. In this article I will show you a simple way to install GA on a WordPress site via a plugin.
Before we get down to the practical part, let’s take a look at what Google Analytics is, what it does, and how it works. If you prefer, skip to the part about installing GA on WP.
What is Google Analytics?
Google Analytics is the most popular and possibly the most complete web analytics tool on the market. It is a free Google tool (also available in a premium version with differentiated features) for analyzing the behavior of a site’s visitor.
Google Analytics allows you to collect and analyze visitor browsing data providing valuable insights for your business and digital strategy.
With GA you can measure data such as number of visitors, page views, conversions, frequency and recency, sales, campaign results, events within the site, and much more.
Why use Google Analytics on WordPress?
Understanding the behavior of a site’s visitors is key to increasing traffic and conversions. This is true for all sites, regardless of the platform used.
With Google Analytics you have access to information about your site and visitor behavior. In this way, your decision making becomes data-driven and not only driven by your own “hunches” or those of the stakeholders to whom you may be offering this service.
How does Google Analytics work?
To track and collect visitor data, you will need to implement a tracking code on your site. This tracking code is obtained from your Google Analytics account. If you don’t have a GA account yet, I suggest reading this Google support article.
Every time someone accesses your site, the tracking code is triggered and starts collecting data from the visitor and his session.
If you want to understand a bit more about how GA collects data read this other Google support article.
Ways to implement GA in WordPress
There are several ways to implement the Google Analytics tracking code. Here are a few:
Directly in header.php
You can enter the tracking code directly through
header.php of the theme you are using. This is a solution that requires some technical knowledge and extra care because any slip-up when editing
header.php can break your site. Remember that you can also do this (insert the code on
header.php) using a plugin.
Perhaps the least usual way to implement Google Analytics in WordPress but it is worth mentioning. As with the
header.php editing method this method requires editing files in the theme used or using a snippet to add the tracking code to the site’s head.
Using Google Tag Manager
This is my favorite method! Not only for its ease but also for the countless customization possibilities that come with it. Through this method you ensure that your implementation will not be lost after a template update or a misconfiguration/ misuse of the analytics plugin.
Through a plugin
Possibly the most practical way and the recommended way for beginners. Beware! There are several plugins in WP for just about any functionality. Choose a well-regarded and quality plugin so as not to compromise the performance of the site and also of the Google Analytics implementation.
Installing GA on WordPress using a plugin
As mentioned earlier, there are plugins for just about any functionality in WordPress. To install Google Analytics is no different.
Explaining how to install Google Analytics on WordPress with each plugin would be very time consuming. I have also mentioned before that you should look to work with quality plugins to ensure that your site runs smoothly.
Read also: WordPress Plugins Every Website Should Use
Some people claim that the more plugins installed the lower the performance of the site. This is only true if the quality of the installed plugins is not good. Along these lines, my suggestion, among the many options available in the WordPress plugins directory, is to use the MonsterInsights plugin.
Tempo necessário para esta implementação: 5 minutes
Installing Google Analytics on WordPress using a plugin
- Installing the MonsterInsights plugin
Naturally, to install Google Analytics on WordPress via a plugin we need to add a plugin. In the plugin installation area search for “Google Analytics”, this will be enough to display the desired plugin. Do your installation and activation:
- Start the plugin configuration
Once you have activated the plugin, you can choose to start the configuration via the plugin’s own setup wizard or, from the main menu go to Insights > Settings.
- Connecting to your Google Analytics account
Regardless of which configuration you choose you will have to connect to your Google Analytics account:
- Authenticating your account
Select the account you want to use for connection and confirm the permissions required to use the plugin:
- Selecting the Google Analytics account
Select the desired account to connect to and click to complete the connection:
That’s it! Now your site has Google Analytics installed.
It should be noted that this plugin has several settings that you can make good use of. Here are a few:
- Enable or disable the capture of visitor demographic data;
- Add domains for cross-domain tracking;
- Disable tracking for some types of users (don’t track activities of site administrators for example);
- Enable or disable reports in the WordPress dashboard.
The premium version of the plugin is quite robust and can save a few hours on advanced tracking implementations. Such implementations, in most cases, can be achieved by implementing GA via GTM.
Validating the GA installation
There are a few ways for you to test that GA has been installed correctly. My recommendation is that you use Google’s own extension for this verification: Tag Assistant.
Install the extension. Go to the site and click on the extension. It will display the implemented tags:
Installing Google Analytics on WordPress using a plugin is possibly the fastest way to do GA implementation on a site.
The positive points of this implementation are that it is easy to install, requires no programming knowledge, and does not require advanced knowledge of the tools used.
Continue reading: What are sessions in Google Analytics?