How to Install Google Analytics on WordPress?
- 252 Views
- admin
- March 29, 2022
- Digital Marketing WordPres
When you have a successful blog or website, you need to know your visitors. This will allow you to know what content interests them and thus to better touch them. The best method is to analyze your traffic. There are many tools to do this, but we will turn here to install Google Analytics.
This is free software powered by Google allowing you to track your site statistics like the number of visitors, the rebound rate etc but also to analyze their behavior in relation to your articles.
Through this tutorial, I will show you why use Google Analytics but also like installing it on your WordPress blog.
Why install Google Analytics on WordPress ?
As we saw in the introduction, to reach your visitors and bring them back to your site, you must know them. Unless you give them an appointment (which does not seem possible), you will have to analyze and understand the behavior of your visitors on your site.
So we will see the different points that push us to offer you Google Analytics.
- Understand the behavior of your visitors. Thanks to Analytics, you can find out when your visitors leave your site after reading an article, on which other page are they going etc. An excellent indicator to define which items work and how to improve your site.
- Analyze the best schedule of the day. You can determine the times when your site is most visited. This will therefore allow you to know the time slots on which you must publish your articles for maximum return !
- Know the crucial details of your visitors. Google Analytics will provide you with the smallest detail such as the medium used by your visitor, their geographic location, etc. It will also allow you to target them as best as possible in your actions. For example, if you have 60% traffic from mobiles, you have an interest in having your site responsible !
In addition to this, Google Analytics offers you different interesting features such as :
- Generation of personalized reports. You can add different parameters that interest you, so you will quickly find them on your WordPress dashboard without looking into the different functionalities. A saving of time but also a way to have everything on hand.
- Personalized alerts. You can set alerts in the form of email. Whenever there is abnormal activity on your site, you will receive an alert. (like a peak in your traffic)
- Integration of the Search Console. The Google Search Console is also a very good analytical tool. Google Analytics allows you to couple these two tools.
There are obviously many other functionalities, we have just seen the main points of why use this tool.
How does Google Analytics work ?
The Google tool works in three stages. You will first need to integrate a JavaScript code on your site. This will allow you to recover important information about your visitors.
As a result, the data collected is sent to Google servers for processing. Once the treatment is done, you will have access to it on your Google Analytics dashboard.
Are you now convinced by this magic tool ? We will now see how to install it on your WordPress blog !
How to install Google Analytics on WordPress

After theory, practice ! You will see that it is very simple to integrate Google Analytics into WordPress. It is advisable to have a Gmail account for the creation of a Google Analytics account that we will see now.
Creating a Google Analytics account
The first thing to do is obviously to create an account on Google Analytics.
1. Go to this page and click the Connection button at the top right of your screen. Then select Google Analytics.
2. Enter your Google account and do Next, if you do not have a Google account, create one by clicking on More options -> Create an account.
3. Once your email address is back, indicate your password and login.
4. Click the Registration button to add Google Analytics to your Google account.
5. You must now complete the information relating to your site.
Account name: Put your company name for example.
Website name and Url: Indicate the name of your site as well as your url (be careful to put https if your site is under https).
Dectorial category: Add the category that your site processes.
Time zone: Indicate your time zone.
6. Once you have completed the information, click the Obtain a Tracking ID button. Then accept the conditions of use.
7. So you have a code that appears in this form :
Copy this code somewhere to keep it. We will need it in the next steps.
Install Google Analytics on WordPress
There are several methods to add this code to your WordPress site. We will see how to add it with a plugin and how to add it manually in the header.php of your theme.
Installation of the AH Google Analytics plugin
1. Connect to your WordPress administration panel and install the AH Google Analytics Code plugin.
2. See you in Settings then AH Google Analytics. Enter the javascript code in the first field ()
3. Click the Save Modifications button.
And voila, Google analytics is installed on your site ! You can now access your statistics directly on your Google Analytics dashboard.
Manually integrate the Analytics code
The second method is to manually integrate your tracking code into the header.php file on your WordPress site.
It is a method that allows you not to overload your site with plugins.
1. Access your WordPress administration panel and then go to Apparence -> Publisher.
2. Open the header.php file and then insert your JavaScript code just above the tag like this :
3. Click the Update file button and voila, your code is installed on your site !
Bonus: Integrate Google Analytics into WordPress
There are a few plugins that allow you to integrate Google Analytics into WordPress. This allows you to have Google Analytics statistics directly on your WordPress administration panel.
Here are the most popular plugins that allow you to do this :