How to Set up Google Analytics on WordPress?
Once we launched a blog or website, most of us will be curious to know about the website visitor’s statistics. This is the point we will start thinking about free website analytics tools. Google Analytics is one of the leading free tools to know about real-time and total visitor’s statistics on the website. In this post, let me share with you how easily we can set up google analytics on WordPress using a plugin and also the way of doing it manually.
In the first step, we will check the importance of adding Google Analytics or any other website analytics tool like Clicky Analytics to your website. Then we will learn how to make a Google Analytics Account, take the necessary codes from it, and implement analytics code on your website pages. And finally, we will view the traffic reports.
Why is Setting up Google Analytics on WordPress Important for Bloggers?
We get a lot of information about your website and understand how it actually performs on the internet through Google Analytics reports. We can see the countries or locations from which users are coming to the site and the channels they used to reach there. We will be able to check what are the landing web pages and how many web pages the visitors have opened and how long they have stayed there. We can redesign the pages and change the contents as per the details availed from the analytics as a part of the data-driven decisions. We can even create multiple landing pages and conduct A/B split tests by creating content experiments in Google Analytics to understand what will work best for our business goals.
Set Up Your Google Analytics Account
If you already have a Gmail account, you can use it to sign up for Google Analytics:
1. Go to Google Analytics and start login or sign up with a new account
2. Give an account name, eg: BookWebmaster
3. Choose which one you need to measure – in your case, it is the web.
4. Enter your website name. eg: BookWebmaster Website. Enter your website URL. eg: www.bookwebmaster.com and choose ‘Http/Https’ from the drop-down menu. Select your industry category which suits your business best. Set your time zone where you monitor the traffic.
5. Accept the Agreement for Setting up Google Analytics Account
6. Note the Tracking ID and Analytics Tracking Code
In case, you have already set up google analytics account associated with another website, and you want to add a new website into the Google Account, then here is the way to do it:
After login, look for the gear icon at the bottom left corner and then click ‘create account‘ as seen below. Then you need to follow the same steps from No. 2 stated above till you grab the analytics code.
How to Set up Google Analytics Code on WordPress Blog/Website
There are a few different ways to set up Google Analytics code on WordPress, either manually or using a plugin. First, let us use a simple plugin and install the analytics code on the site.
Using the ‘Insert Headers and Footers’ Plugin
This is a super easy method and the best for beginners. First, you need to install and activate the Insert Headers and Footers plugin. Upon activation, you need to navigate to Settings » Insert Headers and Footers page. Here, you can paste the Google Analytics code that you copied from the Google Analytics dashboard into the headers section.
Save changes button to store your settings and that’s it. You successfully installed Google Analytics on your blog.
If you’re looking for another plugin method to get a complete analytics report to be viewable on the WordPress dashboard, then consider using plugins like MonsterInsights that makes a bit more comprehensive Analytics report, though it is not recommended for beginners.
How to Set up Analytics Code on WordPress Theme Manually?
You can use method A or B to add the code manually to the theme.
A) Add into Theme Header
Log in to your WordPress Admin and move on to Appearance » Editor. Now click the header.php file on the right-hand side below the Templates section.
Paste the Google tracking code just before the closing </head> tag as seen below.
Then click Update File. Google Analytics set up on WordPress is done!
B) Add into Functions File
You can add this code to your theme’s functions.php file.
<?php
?>
add_action('wp_head', 'wpb_add_googleanalytics');
function wpb_add_googleanalytics() { ?>
// Paste your Google Analytics code here
<?php }
How to View Traffic Reports on Google Analytics of Dashboard?
Google Analytics can give you a chunk of website traffic data and you can view these reports by visiting your Google Analytics dashboard as seen below.
Google Analytics is a free web analytics tool that collects crucial website traffic information regarding your website. By gaining website traffic analytics insights, you will be able to make data-driven decisions to grow your WordPress website in the most efficient way. We hope you found this guide useful to set up Google Analytics code on your WordPress website. If you have any more questions on GA set up or installation, feel free to leave a comment down below.