How to Install Google Analytics in WordPress
Do you want to install Google Analytics on your WordPress site? Knowing how your audience interacts with your website is very important.
The best way to find out your audience is through traffic statistics, and a program that you can use to do this is Google Analytics. Why should Google Analytics? Because this program has complete features and of course it’s free for you to use.
In this article, we will show you how to install Google Analytics on your WordPress site and explain why Google Analytics is so important to your success.
Why Google Analytics Is Important For Bloggers
The first thing a blogger wants is to get traffic and subscribers. To achieve this goal, Google Analytics can assist you in making data-driven decisions by showing you important statistics. Some of what you can find are as follows:
Anyone who visits your website
You can track where visitors go, how long they stay on the website, and what is the total bounce rate (percentage of users leaving your site on their first visit).
Most visiting time
By looking at the most broadcast hours in one day, you can determine the right time to publish new posts. If the time zone does not match your time zone, then you can schedule posts to meet those hours.
How people find your website
In the analytics section it shows where visitors are coming from (example: Search Engines, Direct Links, Referral links from other sites).
It also displays what percentage of visitors are coming from each source. Google Analytics also gives you a breakdown of each category. For example search engine categories, it will show you which search engines give you the most traffic, like Google, Yahoo, Bing, etc.
How visitors interact with your content
Google Analytics shows how users interact with your content. It will display what percentage of users click on the links on your site and more.
How to Register Google Analytics
Google Analytics is available for free and all you need is a Google or Gmail account to register. Also the registration process is quite simple, follow the instructions below to create a Google Analytics account.
Step 1: First, you have to visit the Google Analytics registration page.
You will be asked to log in with a Google account. If you already have a Google or Gmail account, you can use that account to sign in.
Step 2: After successfully logging in with your Gmail account, you will be directed to a screen like the image below. Click on Start Measuring to start creating your Google Analytics account.
After that, you will be asked to provide a name. This name will be used internally, so you can use anything.
Step 3: In the next step, you will be asked to enter the property name, set the time zone and currency.
Once done, click Show advanced options and slide the toggle to enable Google Analytics tracking.
After that a column will appear where you have to fill in the website address and select Create both a Google Analytics 4 and a Universal Analytics property.
Note: Why don’t we use ‘Create a Universal Analytics property only’. Because ‘Universal Analytics’ will be removed, so we will create Google Analytics 4 to collect data in the future.
Step 4: Enter details of the company you manage, such as company category, number of employees, and the purpose of using Google Analytics for your business.
When finished, click the Create button. Then, the Google Analytics terms and services will appear that you must agree to, just check the box and click I Accept.
Step 5: The Google Analytics creation process is complete, you will see a popup showing the Google Analytics 4 tracking code.
If you want to see the Universal Analytics tracking code. You can close the popup and then click All Accounts at the top of the screen.
You must select the Universal Analytics property with the code ‘UA’ on the front.
On the Google Analytics dashboard, select the Admin menu in the left panel.
Now on the admin page, select Tracking Info and from the dropdown menu that appears select Tracking Code.
You will now see the Universal Analytics tracking code. You can copy this tracking code and start installing on your WordPress site.
How to Install Google Analytics in WordPress
There are several methods you can use to install Google Analytics on your WordPress site. We’ll show you three methods, starting with the easiest.
You can choose one method that you need the most.
Method 1: Using the MonsterInsights plugin
There are many plugins you can use to associate Google Analytics tracking code with WordPress, but we recommend the MonsterInsights plugin.
Why MonsterInsights? because this plugin has a user friendly interface and has features that can enhance the client experience when visiting your website.
Using the MonsterInsights plugin is the easiest way you can add Google Analytics to WordPress.
This plugin is available in a free and paid premium version. However, in this tutorial we will be using the free MonsterInsights plugin. But if you want more features, you can use MonsterInsights pro.
The first thing you have to do is install and activate the MonsterInsights plugin. For more details, you can see our guide on how to install a WordPress plugin.
After activation, the plugin will add a new menu on the left panel of the admin area called ‘Insights’. Click to run the MonsterInsights setup wizard.
In this screen, you will be asked to select a website category (business website, blog, online shop). Select one, then click Save and Continue.
On the next page, click the Connect MonsterInsights button.
A popup will appear asking you to select the Google account to use.
Next, you will be asked to allow MonsterInsights to access your Google Analytics account. Click Allow to continue.
The last step is to select the profile you want to use. You must select your website here, then click the Complete Connection button.
Now MonsterInsights will install Google Analytics on your website. After that, you will be asked to choose the recommended settings for the website.
Leaving the default settings will also work for most websites. If you are using an affiliate plugin, then you need to add a slug which is used to hide affiliate links. This allows you to track affiliate links in Google Analytics.
When finished, click the Save and Continue button.
On the next page, MonsterInsights will ask you which feature you want to enable. You can skip this page by clicking the Skip for Now button.
Now you have successfully installed and set up Google Analytics on your WordPress site. Remember, Google Analytics will take some time to start displaying your website statistics.
Click Complete Setup without Upgrading at the bottom to close the setup wizard.
The best thing about MonsterInsights is that you can view Google Analytics reports through the WordPress dashboard. Visit Insights > Reports to view your website visitor statistics.
MonsterInsights also comes with the ‘Popular Posts’ addon which lets you display top-performing content to increase traffic and page views.
Method 2: Using the WPCode Plugin
Using the WPCode plugin will not display Google Analytics data in your WordPress dashboard. But you can view the data directly from the Google Analytics dashboard.
First, make sure you’ve copied the Google Analytics tracking code that was in step 5 when creating a new Google Analytics account.
Once activated, you can visit the Code Snippets > Header & Footer page. Then paste the Google Analytics tracking code in the ‘Header’ column.
Once done, click the Save Changes button to save the settings. Now the process of installing Google Analytics on WordPress using a plugin is complete.
Method 3: Install Google Analytics in WordPress Without a Plugin
To install Google Analytics without a plugin, you can simply paste the tracking code into your WordPress theme’s header.php file.
Go to Appearance > Theme File Editor, on the right side menu you select header.php and paste the tracking code just before the
<head> tag. When finished, click Update File to save the changes.
These are some of the methods you can use to install Google Analytics in WordPress. You can choose the best method, never try to use several different methods. Because it can cause double tracking in Google Analytics reports.