Google Analytics is one of the best ways to monitor the traffic and user behavior of any website including WordPress based. It helps you in understanding the needs of visitors. However, first, you need to set up your account with Google Analytics and then only it can analyze your the WordPress Website traffic. It provides a dashboard to quickly track the visitors, pages, posts or network behavior.
To enable the free analytics tool of Google you need to implement the tracking generated by it on the website either manually or using a plugin called Google Analytics for WordPress. In this tutorial, we are going to show both the methods: Manually and by using Plugin.
How to Setup Google Analytics Account on WordPress
First of all, we create a Google Analytics account:
- Go to Analytics Google page- Click here
- Sign up for Google Analytics
- Give some name to your account
- Add your website name and URL
- Select your Website Category
- Click on Get Tracking Code and If you already have an account then move to next step
- Open Analytics click on Admin tab at the top -> select account
- Under property, section clicks Tracking info->tracking code
- You will get the Tracking ID and Script
How to Add Google Analytics to WordPress using Plugin MonsterInsights
- Go to your WordPress Admin Dashboard-> click on Plugin
- Now click on Add new Plugin
- Search for Google Analytics by MonsterInsights
- Install and Activate the Plugin
- Click MonsterInsights from Admin Dashboard and go to settings
- To configure Google analytics for the plugin, click on the option Authenticate with Google Account
7. You can also paste your UA-XXXXX code manually in the box given below the option Authenticate with Google Account. Once you install it, the Google Analytics will start tracking your traffic after some time.
How to Add Google Analytics to WordPress without a plugin
If you want to add Analytics Google code manually to your WordPress Website or blog then follow this tutorial. If you want to add Analytic’s Google code manually then there are three methods:
- Method 1# Paste code manually in theme header or footer script option if you have.
- Method 2# Insert it in your theme’s header.php right after the <body> tag.
- Method 3# Functions.php Method.
Note: Choose any one process to install the code manually from the above mentioned. Don’t perform all the methods.
In the theme setting option, if your theme has a built-in option for Header and footer script like I have in my Genesis theme framework. As shown in the screenshot. Just copy the code, generated from the Google Analytics account in the beginning of this article and paste in the Header script.
Second Method: Insert code in header.php
If you do not have the header and footer script option in your theme setting then add the plugin Insert Header and Footer to enable the header and footer script option. You can also insert the script code in your theme’s header.php right after the <body> tag. You will find the file header.php by clicking the WordPress admin Dashboard-> appearance ->editor, select your theme and edit the header.php file.
The script code looks like this :
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXX', 'auto'); ga('send', 'pageview'); </script>
Third Method: Using Function.php
The third method is inserting the code in Fucntion.php file . Under the Apperance->Editor select the theme and clilk file funtion.php as shown in the screenshot.
Note: only use this if you know what you are doing.
Add this code…
add_action('wp_footer', 'add_googleanalytics');
function add_googleanalytics() { ?>
// Paste your Google Analytics code from Google Analytics Account which is UA-XXXXXX'here and also remove this line
<?php } ?>
so, these are some simple methods to add Google analytics code to your WordPress website.
How to check WordPress website traffic on google analytics
After performing any one above tutorial to enable google analytics for your WordPress, now the question is how to see or track the visitor’s traffic. The Google will start to track your website and gathered the information in near about 12-24 hours after inserting the code. Forgetting the view of traffic follows the given steps:
- Go to the Google Analytics page and sign in.
- Click on the All website option under your website name.
- On Analytics Dashboard click on Report tab.
- Now you get a reporting dashboard from where you check the coming traffic.
- You get the Real-time tab to see real-time visitors on your website.
- Audience tab to know, from where your audience is coming such as country, network, devices, technology and more.
- Behavior tab is for the information about what type of pages and post driving the traffic to your website including the bounce rate.
Here is the Video Tutorial to Install Google Analytics on WordPress
I hope this article would be helpful in solving your problem. If you need any other help please comment and we take it forward. Thanks, and Enjoy!!
Other Articles you may interest in:
- How to Remove WordPress Admin Page Traffic From Google Analytics
- How to Add Google Analytics Dashboard for WordPress
- Step By Step Guide To Clone WordPress Website Manually
- How to Add Google Analytics Dashboard for WordPress
- How to Add and Use Disqus WordPress Comments on Your Website
- How to Change the Color of Address Bar for WordPress Site in Mobile Browser
Related Posts
How to setup and Activate Google Analytics on WordPress