How to Add Google Analytics on your WordPress Sitecfcsoft
Now that you have your WordPress site up and running, it’s time to start pulling in data that can show you how your visitors interact with your website. In this post we’re going to show you the easiest ways to add the most popular (and free!) website analytics tracking to your website: Google Analytics.
What is Google Analytics?
Google Analytics is a free website tracking service that reports website traffic, conversions, user behavior, and more. It is the most popular website tracking service available.
Google Analytics can show you how much traffic your website receives, where that traffic is coming from, and how visitors interact with your site once they arrive.
You can also export Google Analytics data in various formats or build your own custom “Dashboard” that easily provides and updates the data you want to see.
Why Website Analytics are Important
Everyone setting up a website has a goal in mind. Perhaps the goal is to blog about your passion, launch a small ecommerce business, or just to have a space where your friends can come together online.
Whatever your reason for creating a WordPress website, an understanding of your site’s users is crucial. You need to know if people are visiting, where they come from, and what content on your website they enjoy. Without this information you have no way to measure if what you are creating is moving you closer to achieving your goals.
One of the best features of Google Analytics is the price. Even if you are not remotely interested in see how visitors interact with your website, it is still easy to implement this tracking and start gathering data quietly in the background, all for free!
Who knows? One day you may look at your analytics data and realize that your visitors frequently go to a part of your site you did not expect them to. That could lead to ideas for new content or copy on your website.
How Does Google Analytics Work?
The tracking code (if properly implemented) should be on every page of your website for which you want to gather traffic data. This insures that the tracking can follow every website visitor as they move through your site
Some of the most helpful data provided by this tracking is:
- Pageviews: The number of individual pages a visitor goes to on your site.
- Sessions: The number of individual visitors your website receives.
- Traffic Source: Where your site visitors came from (A Google search, a paid Google ad, another website, directly to your site, a social media network, etc.)
- Bounce Rate: A measure of how many visitors came to one page on your site and then immediately left.
- Session Duration and Pages per Session: Measurements of how long someone stayed on your site and how many pages they visited during their Session.
- Goals (sometimes referred to as “Conversions”): These are a measure of how many people completed an action on your site, as stipulated by you. For example, if you have a contact form, you could measure how many people filled out and submitted that form, where they came from, etc.
Let’s get started on installing Google Analytics on your WordPress website.
Installing Google Analytics on your Site
Step 1: Creating an Account
1. The first thing you need to add Google Analytics to your website is a Google account. If you don’t already have one you are comfortable associating with your website, get one here.
2. Once you have your account ready, go to https://analytics.google.com and login.
3. You will see a screen prompting you to sign up for Google Analytics. Follow the steps to set up your analtyics account.Sign up for google analytics
4. Once you have filled out all of the required information, click on the “Get Tracking ID” button. You will be taken to a screen showing you a piece of code (called a “snippet”) that you will need to copy. The code will look like this, but the obscured part will contain your Google Analytics account number instead:
Remember to highlight and copy the entire code snippet, as shown in the screenshot above.
Step 2: Installing the Code
There are several ways to add the Google Analytics code to your WordPress site, and we’re going to focus on two of the easiest and most popular methods. As usual, WordPress makes these options easy, depending on your experience level.
Method #1: Manually Adding the Tracking Code
While both of these methods are straightforward, this method is the only one that requires some minor knowledge of how WordPress uses templates to manage content. Here are the steps to add your Google Analytics tracking code manually:
1. Once you have the code copied, login to your WordPress website and go to “Editor” in the “Appearance” menu:
2. On the right side of the screen you will see a list of templates. You are looking for the template file named “header.php”. The easiest way to find this file is usually to do a CTRL + F and search for “header.php”:
3. Next you want to look for the the following tag: </head>. You can again use CTRL+F to search for it. Once you’ve found the tag, paste the tracking code snippet immediately before it.
4. Once the code is pasted in, click the “Update File” button.
5. After a few minutes, go back to the area in Google Analytics where you copied your tracking code. Refresh the screen to make sure that the code is properly placed and your account is receiving data. If no data is being received, click the “Send test traffic” button to test.
Please Note: It usually takes 12-24 hours for actual traffic data to being coming in through Google Analytics. After that period of time has passed, you can login to your account and go to “Reporting” in the main menu to see your data.
Method #2: The Google Analytics by MonsterInsights Plugin
There are hundreds of Google Analytics WordPress plugins available. Some allow you to track more elements of your site than others, some are easy to set up, and some provide analytics data to you within your WordPress dashboard.
We are going to show you how to set up the Google Analytics by MonsterInsights plugin, formerly known as Yoast Google Analytics. This plugin is one of the most powerful of the analytics plugins that is also very easy to configure and start tracking your traffic immediately.
1. Upload the Google Analytics by MonsterInsights plugin using your preferred method (check out our “Installing Plugins” video here) and activate it.
2. Navigate to the “Settings” section under the new “Analytics” menu.
3. Now it’s time to connect your Google Analytics account to the plugin. There are two ways to do this: Authenticate with your Google account or manually enter your UA (User Account) code.
Authenticate With Your Google Account: If you are signed in to your Google Analytics account, click the “Authenticate with your Google account”, go through the prompts, and your account will be connected.
Manually Enter Your UA Code: If you prefer to manually enter your user account number, simply check the “Manually enter your UA code” box.
Then go back to your Google Analytics account, click on the “Admin” link in the main menu, and then click on “Property Settings” under the center “Property” column.
Copy the code under “Tracking ID” (be sure to include the “UA” portion) and paste the code into the field in the plugin.
Click the “Save Changes” button and your site is now tracking your visitor data! Again, allow 12-24 hours for data to populate.
What it Looks Like in Action
Once you’ve installed the tracking code properly and let 12-24 hours pass, you will begin to see data appearing in your personal Google Analytics interface.
When you head back into Google Analytics, click on the “Reporting” link in the top navigation to see the default data display. The default reporting section is the Audience Overview, and this is what will load by default whenever you login to Analytics in the future:
The menu on the left side is how you will navigate between the different data sections. It is broken up into sections based on the type of metrics presented. You can change your date range in the upper right.
Please Note: Data is only available from the date you installed Google Analytics and not earlier).
To help you get a little more familiar with it, here are some areas you are going to want to check out on a regular basis:
- Audience →Mobile→Overview: This will show you the type of devices people use to access your site. This can help you determine if you need a better mobile site.
- Acquisition→Overview→All Traffic→Channels: This section will show you what channels are sending traffic to your site (Organic Search, Paid Search, Social Media, Referrals (other websites)
- Behavior→Overview: This section will show you the pages on your site that get the most traffic.
- Conversions→Goals→Overview: This section will show you the number of conversions that have occurred on your site, if you have set up goals.
Final Tip: You can hover over any of the metric names (Sessions, Users, Pageviews, etc.) and a helpful box will pop up explaining what the metric is:
Google Analytics is by far the most powerful free analytics service available. Whether you are brand new to WordPress or you are experienced in managing your own WordPress site, having Google Analytics tracking implemented will help you to constantly improve your website’s performance.