How To Install Google Analytics on WordPress Sites
Looking to learn how to install Google Analytics on WordPress? We wanted to first explain the importance of Google Analytics as many business owners, communications directors, and even experienced web design firms, struggle to connect this useful analytics system to their WordPress website.
Google Analytics should be added to your WordPress site once you’re ready to launch it live on your primary domain and hosting account. Personally, we do not add the Google Analytics tracking code during the development process as the website isn’t live to the public yet.
Luckily, there are 2 easy-to-follow methods we implement when adding Google Analytics to our WordPress sites. There are obviously various tips and techniques you’ll find when it comes to Google Analytics, but these methods only take a few minutes each, and ultimately, it follows the best practices which are critical when you’re working on website-related tasks.
In this blog post, we’ll cover the benefits of Google Analytics, how to sign-up for it, and how to connect it to your WordPress site within minutes…and the best part, zero technical knowledge is required.
So, grab your cup of coffee, (don’t tell your boss or client you’re using this blog post), and let’s jump right to it!
Benefits of Adding Google Analytics to WordPress
By simply adding the Google Analytics code to your site, you’ll unlock valuable information relating to your WordPress site. Some of the benefits of utilizing the analytics data include:
- Pinpointing exactly where your visitors come from, such as organic Google search results, social media posts, news articles, blogs, etc. This is a key piece of data as you’ll be able to modify your budget accordingly based on specific marketing channels.
- Having the ability to view your most popular website pages and blog posts will allow you to build a custom content marketing strategy around the topics that are most enticing for your audience.
- Website behavior and user experience auditing will reveal both critical and minor issues with specific pages that perform poorly due to various issues, such as image resolution, broken links, non-functional buttons, and broken sign-up forms.
- Configuring conversions is typically an advanced task that will provide detailed reporting for Google Analytics Goals which can be used for e-commerce purposes, for example, when selling items online.
How to Register for Google Analytics
Google Analytics is completely free to register and run on your site, but you’ll need an active Google account to register. The initial sign-up process is fairly straightforward, please see our step-by-step instructions below to create your Google Analytics account.
Step 1: First you’ll need to visit the Google Analytics portal so you can initiate the installation process. You’ll immediately be prompted to log in with your Google account if you’re not signed in yet.
If you’re already signed in to your Google or Gmail account, then you can continue to follow the steps below to complete the process. If you don’t have a Google account then you’ll need to create one to set up and configure Google Analytics on your WordPress website.
Step 2: You’ll want to click on the blue button that says “Start measuring” which will then display the following page, Create Account, which will require you to input an account name that will be used to track your Google Analytics account.
Step 3: On the next section, you’ll need to input a property name, set your time zone, and currency (which is typically used for sites that are selling items), and then complete the about your business section.
Once you’ve completed these sections, click on the Create button. At this point, you should be presented with the Google Analytics terms of service, which you must agree to, so please read the terms and then click the “I Accept” button, if you agree.
Step 4: During this step, you’ll be prompted to choose a platform so it’s important to select “Web” if this is for your WordPress website, then you’ll need to input your website URL and complete that section.
You should now be shown the Google Analytics tracking code which you can finally get set up using one of the methods below.
(We also recommend leaving this browser tab open so you can easily access the code, as needed.)
Awesome, we’ve now set up a Google Analytics account, so let’s show you how to install Google Analytics on your WordPress site via the 2 methods listed below.
How to Install Google Analytics on WordPress
1. The Official Google Analytics WordPress Plugin
One of the easiest ways to add Google Analytics to your WordPress site is by installing and configuring the official plugin from Google’s team, which is called, Site Kit by Google.
To complete this task, we recommend installing the plugin directly from your WordPress dashboard. We will go over the steps on how to set up the plugin to ensure Google Analytics is working properly.
This plugin connects your Google Analytics account to your WordPress site with a streamlined process so you can quickly view important website data. Another huge benefit to installing this plugin is the fact that it also displays key data from Google Search Console, Google AdSense, and PageSpeed Insights, which will allow you and your team to have a quick point of reference.
(Please note, by installing the Site Kit plugin, you do not need to edit your WordPress theme’s site files.)
Steps to follow:
Login to your WordPress website and click on Plugins, Add New, and search for the Site Kit by Google plugin. Click on the install button and then select activate, which will then display a Congratulations message on the Plugin page. If you’ve done everything correctly up to this point, you should see a blue button that says, start setup.
After you’ve clicked on the start setup button, you’ll be prompted to connect to your Google account by selecting the “Sign in with Google” button.
Due to best practices and security purposes, Google will need to verify you’re the actual website owner, so Google Analytics can start tracking your website data with detailed reports.
Once Google has verified you’re the website owner, you’ll notice a message with a green checkmark that says, “You’re a verified owner”, you’ll then want to select the “allow” button to complete the configuration process.
Finally, once the entire setup process is completed, you’ll see a final page with 3 green checkmarks and a blue button that says, Go to my Dashboard, which will take you back to your WordPress dashboard.
If you’ve followed the steps and configured everything correctly, you’ll see a new tab directly on your WordPress dashboard that says, Site Kit. This will ultimately save time and resources as you’ll have the ability to view data directly from your Google Analytics account, along with Search Console data. Here’s a screenshot so you can easily locate it:
If you’re not interested in installing the Site Kit plugin, you can continue reading this post and you’ll see the alternative method listed.
2. Adding the Google Analytics Code Directly
If you’d prefer not to use the Site Kit plugin, it’s also fairly simple to add the Google Analytics tracking code directly to your WordPress theme files via manually adding it to an important file, also known as header.php (don’t worry, we’ll cover the steps on how to locate this file next).
Before you edit your WordPress theme files, in general, it’s best practice to ensure you have a full backup of your files on standby, in case you make a simple mistake. (Please note: we like to take a screenshot of the header.php file and copy the text in Notepad so we know exactly what it looks like before updating it. This is a helpful tip as it’ll eliminate any headaches if you need to revert to your previous settings.)
Typically, you can locate the file by going to your WordPress dashboard, then selecting the Appearance tab on the left sidebar, and finally, selecting the “Theme File Editor” option. Once you select this, you’ll see a new screen with your WordPress theme files, you’ll then want to select the header.php file which is typically found on the right side of the screen.
Once you’ve selected the header.php file, you’ll want to carefully place your Google Analytics code also known as the “Global site tag” within the <head> section of your file. Once you’ve added the Google Analytics code, you can select the Update File button. Please see the screenshot below to see exactly where we place it…
Congratulations, you’ve now set up Google Analytics manually, without any plugin or web development experience. Log back into your Google Analytics account and start tracking valuable analytics data!
If you’ve made it through this entire blog post and still haven’t set up Google Analytics on your WordPress site, then I’d highly recommend grabbing your second cup of coffee, and immediately starting the process.
If you’re not exactly sure how to install Google Analytics on WordPress sites and need assistance, please feel free to contact our web design agency for a consultation!
Here are useful articles we wrote that are relevant to any WordPress project: