Looking for a way to add Google Analytics in WordPress website?
It’s essential to understand how your website visitors are interacting with your website and which posts and pages are performing well.
You can do so by keeping track of traffic stats on your website by adding Google Analytics tracking code.
Well, today, in this post, you will learn how to install Google Analytics in WordPress? With and Without a Plugin [Step-by-Step]
But before moving directly to the installation of Google Analytics, let’s first understand what Google Analytics is and what are its benefits.
What is Google Analytics?
Google Analytics is a free web analytics tool developed by Google back in 2005. It is used to track and report the website’s traffic.
The benefits of Google Analytics include a better understanding of –
1. Type of Traffic (or Traffic Channel)
With the help of traffic channels, you can understand how your website visitors are finding your website.
Major traffic types include direct traffic, referral traffic, organic traffic, social traffic, etc.
2. Social Platforms
You must understand which social media platform is bringing maximum and minimum traffic.
You can prepare strategies for social media that bring a minimum or less amount of traffic.
3. Amount of traffic
Google Analytics helps you to track and report the amount of traffic you are getting on your website.
You can check which page or post on your website is working well and which is not.
It also lets you compare traffic with the previous month’s traffic so that you can calculate the website progress.
4. User’s Behaviour
You can check the pages a user is landing, how many pages he has visited in that session, and what amount of time he/she spent.
You can use these detailed insights to optimize your website for more traffic and conversions.
Now that know what Google Analytics is, let’s understand how to add Google Analytics on WordPress website.
Google Analytics Integration in WordPress
Google Analytics integration in a WordPress website is super-easy and doesn’t require much technical knowledge and can be done even by WordPress beginners.
The installation process of Google Analytics is divided into 3 steps –
- Create a Google Analytics Account
- Add Google Analytics code to WordPress
- Test Google Analytics Tracking Code
We will go through each of them step-by-step.
First and the last step is always going to be same regardless of the installation method.
How to Signup with Google Analytics?
The minimum requirement to create a Google Analytics account is to have a Google account.
Recommended – If you are setting up Google Account for your business or blogging website! I recommend you to opt for G Suite to keep everything professional.
So if you don’t have one, first create a Google account to get started with Google Analytics. Let’s check out the signup process.
Step 1: Visit Google Analytics sign up page.
You need to log in with your Google account.
Step 2: Post login, you will be redirected to the Google Analytics welcome screen, where you will find a “Set up for free” button.
Step 3: You will be asked to fill out the Google Analytics account details, including account name and data sharing settings.
You can use any name that represents your business or website.
Step 4: Next, you need to select the device type on you want to set up your analytics account.
Select “Web” for your website and Apps for the android app or iOS app.
There’s also a third option of selecting both web and apps, but it’s still in the beta version.
Step 5: Lastly, you need to enter the property details, including website name, URL, the industry that your website belongs to, and timezone.
Step 6: It will redirect you to the Google Analytics dashboard, where you will find the Google Analytics tracking code.
This tracking code will be used when you install Google analytics with the WordPress plugin.
How to Add Google Analytics to WordPress Website Using Plugin?
I am going to share five methods with which you can set up Google Analytics tracking code in WordPress with the help of plugins.
I am listing out three methods where you need to install a WordPress plugin to add Google Analytics tracking code to your WordPress website.
So, let’s check them out.
Method #1 – Using Google Analytics for WordPress by MonsterInsights
MonsterInsights is amongst the best Google Analytics WordPress plugins that allow you to install Google analytics code easily without having any coding knowledge.
Recommended – You can read the complete process of connecting Google Analytics with MonsterInsights in MonsterInsights Review post.
Method #2 – Using GA Google Analytics Plugin
GA Google Analytics is another plugin with which you can easily add Google Analytics tracking code to your WordPress website.
Just like MonsterInsights, you need to install and activate GA Google Analytics plugin.
After installation, you need to add Google Analytics tracking ID to the plugin settings.
For that, Go to Dashboard > Settings > Google Analytics > Plugin Settings.
Add the tracking ID we copied in step #6 of the above section and paste it in the GA Tracking ID field.
Make sure you select –
- “Universal Analytics /
analytics.js” in the tracking method, and
- “Include tracking code in page head (via
wp_head)” in the code location.
Method #3 – Add Google Analytics Code via Insert Headers & Footers Plugin
First, you need to install and activate the insert headers and footers plugin.
Upon plugin activation, Go to Dashboard > Settings > Insert Headers and Footers.
How to Add Google Analytics to WordPress Blog Without Plugin?
Method #1 – Add Google Analytics Code via Functions.php File
Another method of adding Google Analytics code is to add code to functions.php.
You need to insert the following code to your theme’s
functions.php file. Make sure you replace the “TRACKING-ID” (2 instances) string with your Google Analytics Tracking ID.
Method #2 – Insert Google Analytics Code Into Header.php File
header.php file of your WordPress theme.
Go to Dashboard > Appearance > Editor.
Once the editor opens, you need to click on header.php to open it into the editor.
Save the file and you are done.
How to Check if Google Analytics is Working?
The final step is to verify if Google Analytics is installed correctly and works well on your WordPress website.
You can check it yourself just by following the below steps –
- Open your website in the new tab.
- Open the Google Analytics Dashboard and Go to Real-time.
- If Google Analytics is connected properly to your WordPress website, it will display the number of real-time active users along with the device type.
Google Analytics FAQs
Yes. Google Analytics is free to use. Google has also introduced an advanced paid version of GA named Google Analytics 360.
Google Analytics is used to track traffic metrics, including the source of traffic, stay time, bounce rate, average session, and much more.
It is recommended to add Google Analytics tracking code to the
<head> tag of the WordPress website.
You can check google analytics data on your WordPress dashboard by installing MonsterInsights WordPress Plugin.
Which Method Should You Choose to Add Google Analytics to Your WordPress Website?
Google Analytics is a powerful tool that plays a crucial role in the improvement of your WordPress website.
It allows you to track and analyse how well your content is performing and help you to strategise and improve your content accordingly.
Talking about which method should you choose, as a beginner you can go with MonsterInsights or GA Google Analytics.
If you are familiar with code a WordPress expert, you can go with any of the above methods, including
In case, if you have any issues while adding the code to your WordPress website, you can comment them below.