Nexcess Logo

Google Analytics & WordPress: Viewing Traffic Data

Knowledge Base Home

Notice anything different?

We've enhanced the appearance of our portal and we're working on updating screenshots. Things might look different, but the functionality remains the same.
January 18, 2022



Add Google Analytics to WordPress and use the data to take your website to the next level! Analyze visitors, locations, pageviews, bounce rates, and more!

Google Analytics & WordPress: Better Data for Better WordPress Site Performance

Why some websites are always successful, and others never are, can seem like a mystery. Poor marketing may be the reason. However, the ideas offered here are not related to advertising or promoting, but instead to gaining more insight into your site's visitors and related details. 

Information about your visitors, trends, volumes, and locations will help you guide prospective visitors to your site. Gathering information and performing analysis is easier than ever with Google Analytics (GA).

Google Analytics

Google Analytics is a free web analytic solution from Google. This tool creates detailed statistics based on the visitors to a website. All site activities are tracked, including visits, page views, pages per visit, and bounce rates, along with average time spent on site.

All the WordPress plans at Nexcess include Google Analytics Integration.  

Why Do Analytics Matter for WordPress Websites?

Enhancing your visitor's experience is easy with Google Analytics. First, you can achieve a more fundamental level analysis of your site performance. Many aspects can be analyzed such as:

  • Who is visiting your site
  • What they are searching for
  • If this site is useful to them
  • How often visitors leave your site without navigating any further
  • Which sites send the most traffic your way
  • Where the traffic is coming from
  • How long they stay on your site
  • Etc. 

How to Sign Up with Google Analytics?

Google Analytics is available for free, and all you need is a Google or Gmail account to sign up. Follow these steps in this article to get started.

First, you need to visit the Google Analytics website and sign up. You will be prompted to log in using your Google account. You can sign in with your Gmail or Google account if you have one. Otherwise, create a Google account.  




After signing in with your Gmail account, you will be taken to a screen like the one below. You can sign up for Google Analytics with your Gmail account here.





An account name will be requested. This name will be used internally, so it can be anything you want.




Then you will have a screen to enter details about your business, such as business size and how you intend to use GA with your business. 




Click the 'Next' button after entering this information. Then click on the ‘I Agree’ button when you have read and agree to the Google Analytics terms and services.



Here you will be given the options to choose between a web, apps, or apps and web. First, make sure you select ‘Web’. After that, you need to enter the website name, website’s URL, country, and time zone.

The Google Analytics tracking code will now appear on the screen. The tracking code can be copied because, depending on the method you use; it needs to be entered into your WordPress site.

How to Add Google Analytics to WordPress


The Three Ways to Get Google Analytics Connected to Your WordPress Site article is a great place to start to understand the options available. Furthermore, below we will cover the most common method you can employ to gather data about your users using Google Analytics.  

  • Install a Google Analytics plugin for WordPress

  • Insert Headers and Footers Plugin

  • Install Google Analytics in WordPress Theme

  • Use Google Tag Manager to Integrate Google Analytics and WordPress

  • Manually Connect Google Analytics and WordPress with Code

Install a Google Analytics Plugin for WordPress

The easiest way for WordPress users to add Google Analytics to their sites is through a Google Analytics WordPress plugin. In this way, you do not have to modify your website's code.

Here are some best of the Google Analytics plugins for WordPress:

  1. MonsterInsights

  2. ExactMetrics

  3. Analytify

  4. Enhanced Ecommerce Google Analytics Plugin

  5. Google Analytics by 10Web

  6. GA Google Analytics WP Google Analytics Events

  7. WP Google Analytics Events

Insert Headers and Footers Plugin


Install and activate Insert Headers and Footers plugin. Go to Settings >> Insert Headers and Footers page and paste the Google Analytics tracking code into the Scripts in Header section. 


Save the changes. 

Insert Google Analytics in WordPress Theme

Advanced users who are familiar with code can use this method. However, you will lose your code if you switch or update the theme. This method is not recommended very often.

You will first need to copy the Google Analytics tracking code you found earlier in the step after signing up for Google Analytics.


You can choose any method below (but not both) to add this code to your WordPress theme file. 

1. Add code in header.php file

Edit the header.php file in your WordPress theme and paste the tracking code from Google Analytics right after the <body> tag. 

Then save your changes! 

2. Add code via Function file 

Add the Google tracking code to the functions.php file, and then it will automatically be added to every page on your website. 

You can add the below code to your functions.php file. 

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


Insert Google Tag Manager to Integrate Google Analytics and WordPress

Create your first container in Google Tag Manager after signing up for an account. Then download the Google Tag Manager plugin from WordPress. Navigate to the Admin tab of the Google Tag Manager dashboard, look for a series of characters beginning with GTM, and copy it.



Then paste your Google Tag Manager ID on the plugin settings page. Navigate to Settings > Google Tag Manager:


It’s all set now!

Manually Connect Google Analytics and WordPress with Code


This method needs a child theme so that your tracking code won’t be overwritten every time you update your WordPress theme.


Once you activate the child theme, you will need to paste your Google Analytics tracking code right before the closing </head> in your header.php file.


Navigate to Appearance > Theme Editor to add it to your WordPress site. If your child theme inherits template files from its parent, you won’t see header.php here. Instead, you can click on the name of your parent theme in the file list to access it:





Once you’ve located and selected header.php file, paste the Google Analytics Tracking Code right before the </head> tag in the Editor.



Analyzing Reports on the Google Analytics Website


Data collected by Google Analytics can be viewed in the Google Analytics dashboard. 



On the left sidebar, you will find the built-in Google Analytics reports. There are different sections on each page and clicking on the tabs will expand them to show more options.

  • Real-Time: This tab and set of reports display your traffic in real-time.

  • Audience: This tab and set of reports help you understand your users.

  • Acquisition: This tab and set of reports explore Users' origins.

  • Behavior: This tab and set of reports provide an overview of what your users do when visiting your site.

  • Conversion: This tab and set of reports show how well you’re doing against your goals.


If you own an eCommerce site, refer to our Google Analytics for eCommerce article for more information. 

Additional Benefits of Using Google Analytics


Google Analytics has a wide range of metrics that are tracked in real-time. With this data, you can analyze the visitor’s behavior. Here are a few benefits of using GA:

Pageviews


The number of times visitors have viewed your website is displayed here. You can also see which posts are most popular by breaking them down.

Bounce Rate 


Knowing the bounce rate of certain pages can help you develop a strategy to engage visitors before they hit the back button on the browser.

Session Duration


The duration is in regards to how long someone is at your website. This metric can be broken down to see how long people are viewing specific posts you create.

Page per Session

The number of pages per visitor session can help you determine if people are exploring your site or if you need internal links to more of your content.


24-Hour Assistance

If you need any assistance with the above-mentioned, don't hesitate to reach out. For 24-hour assistance any day of the year, Nexcess customers can contact our support team by email or through your Client Portal.

Useful YouTube > Nexcess Channel Links

Resources for More Information

Need more help? The Applications and WordPress sections within the Nexcess Knowledge Base are important resources for those seeking additional knowledge. Or, check out our related articles below.

New Customers: Fully Managed Hosting Solutions

Not a Nexcess customer yet? Check out our fully managed hosting solutions. The option to chat with an expert is also available.

Related Articles

Rosna Sudhakaran
We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.