How to install Google Analytics and track User Engagement in WordPress

How to install Google Analytics and track User Engagement in WordPress

Are you able to track user engagement on your WordPress site properly?After you host your WordPress blog site,  tracking user engagement is one of the most important point to cover because it helps you strategically plan for site’s growth.For this purpose, using Google Analytics is most popular. The best way to know your target audience is through your traffic stats, and this is what Google Analytics provide and WITHOUT ANY COST.In this article, we will show you how to install Google Analytics (step by step) on your WordPress blog and how to track user engagement with it.


1.  How to Signup with Google Analytics

Step 1: First you need to create a account on Google Analytics. For this, visit Google Analytics Signup Page.

You will see a screen as show below. Or if you already have a Google or Gmail account, then you can use that to sign-in. If you do not have a Gmail account, then you would have to create an account for yourself.

Step 2: Once you finish signing-in with your Gmail account, you will be forwarded to a screen like shown below. This is the place where you will be able to signup for Google analytics with your Gmail account.

Step 3: In next step, there will be a screen with a option to choose between a website or mobile app. Make sure you select website as you are doing it for your WordPress site.

After that you need to provide a account name and that will be used as Google Analytics profile name for your website,then Website name, website’s URL, country, and the time zone.

Once you have filled all the data, click on the Get Tracking ID button. You will be shown with Google Analytics terms and service which you have agree to, so click on I Agree button.

Step 4: Now you will have a tracking code for your Google Analytics . You should copy this tracking code because you will need it further when installing Google Analytics on your site.

We suggest not to close analytics browser tab as you may need to re-visit it, once you have installed the code on your WordPress site.

Now that you have setup a Google Analytics account, lets take a look at how to install Google Analytics in WordPress.

2. Installing Google Analytics in WordPress Theme

This method is for advanced users or we can say developers who are familiar with code. It is somewhat unreliable because your code will disappear if you switch or update the theme. So, we recommend to take a back-up before doing so.

i) Adding code in header.php file

Simply, you have to edit the header.php file in your WordPress theme. Paste the code you copied in step 4 right after the <body> tag.

Save your changes and upload the file back to your server.

ii) Adding via Functions File

You have another option to add Google Analytics tracking code in WordPress functions file. It will then automatically add code to every page on your WordPress site.

You will need to add this code to your theme’s functions.php file.

add_action('wp_head', 'wpb_add_googleanalytics');
function wpb_add_googleanalytics() { ?>
// Paste your Google Analytics code from Step 4 here
<?php } ?>

Tracking User Engagement with Google Analytics

Google Analytics have number of options to show you a treasure of data collected from your stats. Which you can use to track user engagement or traffic on your site You can view this data by visiting your Google Analytics dashboard and clicking on the reporting tab.

1. Tracking Your Most Popular/Visited Blog

The first thing you want to check out is which blog posts and pages are the most popular amongst your users? These are the pages and posts on your website getting the most traffic.

Figuring out what your users like on your site can help you plan a content strategy that expands on what’s already working.

You will find your most popular content under the ‘Top posts and pages’ section.

2. Tracking Bounce Rate in Google Analytics

Bounce rate is the percentage of users who land on your website homepage and decide to leave without going to a second page and that is bad thing for a website.

To check your website’s bounce rate, you will need  to login to your Google Analytics dashboard and then visit Audience » Overview page.

What is the acceptable bounce rate for a website?

Here is a general overview of bounce rate from acceptable to non-acceptable.

An excellent bounce rate is between 30% and 50%. However, most websites lie between 50% and 70% bounce rate which is an acceptable average. Bounce rates higher than 70% are considered bad for most websites.

But not all websites are the same which means average bounce rate differ depending on the kind of website.

Take a look at the chart below to see an average bounce rate as per industry:

3. Tracking Time Spent on Your Website

Another factor that shows user engagement is session duration or average time users spend on your site.

If users are leaving your site without spending enough time to look at it, then something is wrong that needs to be solved.

Google Analytics can show you the average time users spend on your site per session. Simply go to Audience » Overview page, and you can see it among other stats.

4. Tracking Page Views Per Visit with Google Analytics

Number of Page views per visit is another great point to show how engaged your users are. Increase in number of  page views per session also enhances time users spend on your site and decreases bounce rates.

Google Analytics shows you the total page views for a given time slot on Audience » Overview page. However, to track user engagement you can also see page views per session.

This helps you see which traffic channels are resulting the best for your website, so you can judge your efforts and focus on areas that are actually showing results.

We hope this article guided  you on how to track user engagement in WordPress with Google Analytics.

Back to Top