Do you want to install Google Analytics in WordPress?
Knowing how your audience interacts with your website is crucial for your success. The best way to know your audience is through your traffic stats, and this is what Google Analytics provides for FREE.
In this article, we will share why Google Analytics is important, and how you can easily install Google Analytics in WordPress (step by step).
First, we will explain why Google Analytics is important and how it can help you grow your website.
After that, we will show you how to sign up for a Google Analytics account and different methods to install it on your WordPress site.
Finally, we will explain how to view your traffic reports in Google Analytics.
Here is a quick overview of what you’ll learn in this article.
- Why is Google Analytics Important
- How to Sign up with Google Analytics
- How to Install Google Analytics Using MonsterInsights (Recommended)
- How to Set Up Dual Tracking with both Google Analytics 4 and Universal Analytics
- How to Install Google Analytics Using Insert Headers & Footers Plugin
- How to Install Google Analytics in WordPress Theme (Advanced)
- Viewing Reports in Google Analytics
- Making the Most out of Google Analytics
Ready? Let’s get started!
Why is Google Analytics Important for Bloggers?
Who visits your website?
This data is extremely useful, and it can help in numerous ways. When creating a custom website design, you can use the user data to make sure that your site will be compatible with your audience.
If most of your users don’t have Flash support, then you should avoid adding the flash element to your site. If most of your users are on 1280 screen resolutions, then make sure that your design is compatible with that resolution or smaller.
What do people do when they are on your website?
You can track where the users are going on your website, how long do they stay on your website, and what is the bounce rate (the percent of users who exit your site on the first visit).
By using this information, you can decrease the bounce rate and increase your pageviews.
You can also find your most popular articles, articles that are not doing so well, and what kind of content your users are looking for.
When do people visit your website?
By looking at the hottest hours in the day for your site, you can pick the best time to publish your post. If that time zone is not compatible with yours, then you can schedule your post to meet at that hour.
How do people find your website?
This section of the analytics shows you where did the users come from. For example, do they use search engines, enter direct links, or click on referral links from another site.
It also shows you what percentage of your visitors came from each of these sources. Google Analytics gives you the breakdown of each of these categories. If it is the search engine category, then it shows you which search engine got you the most traffic, Google, Yahoo, Bing, etc.
The breakdown of referral sources shows you which sites you need to work with the most. If your top referral source is Facebook, then you need to have exclusive Facebook content to make your Facebook audience feel special.
If your top referral source is an external website, then you might want to consider having a partnership with that website (guest post exchange or something else).
How do people interact with your content?
Google Analytics shows how your users interact with your site’s content. It shows you what percent of the user clicked on which link on your site and much more.
You can run A/B split tests by creating content experiments in Google Analytics to understand what works best to meet your goals.
By seeing the user interactivity, you can work your content around your users. By seeing the answers to the questions above, you can focus on the strategies that work for your site and avoid strategies that don’t work.
Simply put, eliminate the guesswork and focus on stats that matter, so you can make data-driven decisions.
How to Signup with Google Analytics
Google Analytics is available for free and all you need is a Google or Gmail account to sign up. The signup process is quite simple, follow the step-by-step instructions below to create your Google Analytics account.
Step 1: First you need to visit the Google Analytics website to sign up. When you’re on the website, simply click the ‘Get started today’ button.
Next, you will be asked to login with your Google account. If you already have a Google or Gmail account, then you can use that to sign in. Otherwise, you can go ahead and create a Google account for yourself.
Step 2: Once you sign in with your Gmail account, you will be prompted to a welcome screen like the one below.
This is where you will signup for Google analytics with your Gmail account. Go ahead and click the ‘Start measuring’ button.
After that, you will be asked to provide an account name. This name will be used internally so you can use anything like your business name.
Google Analytics will also show multiple account data sharing settings. These settings give you control over sharing your Google Analytics data. You can keep the default settings and move on to the next step.
Step 3: On the next screen, you will need to create a Google Analytics property.
Google introduced a new version of Analytics called Google Analytics 4 or GA4. It’s the latest version that tracks your website and mobile apps in the same account. Plus, you get new features, metrics, and a different interface for your reports.
Important Note: If you already have a Universal Analytics account, then it’s critical to start tracking data in Google Analytics 4 (GA4) as well. That’s because Google will sunset Universal Analytics on July 1, 2023. After the sunset date, Universal Analytics will not receive any data and will eventually stop working.
Setting up a Google Analytics 4 property after the sunset date will mean starting from scratch. However, you can start sending data into GA4 today while still using Universal Analytics. This way, you’ll have historical data in Google Analytics 4 for comparison and analysis when Universal Analytics closes.
To start, go ahead and enter a property name, select your reporting time zone, and currency. Then click the ‘Next’ button.
On the next screen, you’ll need to select an ‘Industry category’ from the dropdown menu for your website and choose a ‘Business size’ from the given options.
Next, you’ll need to scroll down and select how you intend to use Google Analytics with your business, like measure engagement, optimize advertising cost, increase conversions, and more.
You can choose multiple options or all of the given options that meet your needs. When you’re done, simply click the ‘Create’ button.
Once you click on the Create button, a popup window will open with Google Analytics terms of service agreement.
Simply click the checkbox for ‘I also accept the Data Processing Terms as required by GDPR’ and then click the ‘I Accept’ button.
Next, you’ll see a popup with options on which communication emails you’d like to receive from Google Analytics.
Simply click the checkbox for the updates you want to receive and then click the ‘Save’ button.
Step 4: Now you will be presented with your Google Analytics Webs stream options.
Since we’re setting up Google Analytics for a WordPress site, go ahead and select the ‘Web’ as the platform.
After that, you’ll need to enter your website URL and Stream name.
By default, Google Analytics will have an Enhanced measurement option enabled. This allows you to track page views, scrolls, outbound clicks, file downloads, and more in Google Analytics.
Next, you can click the ‘Create stream’ button.
You can now see your Stream URL, name, and Measurement ID.
It will also show different enhanced measurements that it will record.
Google Analytics will also show different ways to add Google Analytics code to your WordPress website under the ‘Tagging Instructions’ section.
If you click the ‘Global site tag (gtag.js) option, you’ll see the Google Analytics tracking code.
You can copy this tracking code because you will need to enter it in your WordPress site depending on the method you use below. You can also simply leave this browser tab open and switch back to copy the code when needed.
We suggest leaving the Analytics browser tab open as you may need to revisit it once you have installed the code on your WordPress site.
Now that you have set up a Google Analytics account, let’s take a look at how to install Google Analytics in WordPress.
How to Install Google Analytics in WordPress
There are a few different ways to set up Google Analytics in WordPress. We will show you three methods where the first option is the easiest and the last is the hardest.
You can choose the one that best suits your needs.
Note: You need to use only one of these methods on your website to avoid double tracking of page views in your Google Analytics account.
Method 1. Google Analytics for WordPress by MonsterInsights
MonsterInsights is the most popular Google Analytics plugin for WordPress. Over 3 million websites use it including the likes of Bloomberg, PlayStation, Zillow, WPBeginner, and more.
It is the easiest and by far the best way to add Google Analytics to WordPress (for all users beginners and experts alike). Plus, it offers a Dual Tracking feature that lets you add Universal Analytics and Google Analytics 4 to your WordPress website without editing code.
MonsterInsights is available as both, a paid premium plugin, and a free version. In this tutorial, we will be using the MonsterInsights free version.
Let’s get started.
The first thing you need to do is install and activate the MonsterInsights plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, the plugin will add a new menu item labeled ‘Insights’ to your WordPress admin menu and you’ll see a welcome screen. Go ahead and click the ‘Launch the Wizard’ button.
Clicking on it will open the MonsterInsights setup wizard.
First, you will be asked to choose a category for your website (a business website, blog, or online store). Select one and then click on the ‘Save and Continue’ button.
Next, you need to connect MonsterInsights with your WordPress website.
Simply click on the ‘Connect MonsterInsights’ button.
This will take you to Google accounts where you will be asked to sign in or select a Google account if you are already signed in.
Go ahead and choose your Google account or enter your email to sign in.
Next, you will be asked to allow MonsterInsights to access your Google Analytics account.
Click on the ‘Allow’ button to continue.
The next step to completing the connection is to select the profile you want to track.
You need to select your website here and then click on the ‘Complete Connection’ button to continue.
After that, simply click on the ‘Complete Connection’ button to continue. MonsterInsights will now install Google Analytics on your website.
Next, you will be asked to select the recommended settings for your website.
The default settings would work for most websites. If you use an affiliate link plugin, then you need to add the path you use to cloak affiliate links. This will allow you to track your affiliate links in Google Analytics.
MonsterInsights will also ask who can see the reports. You can choose different WordPress user roles. Once you’re done, click on the ‘Save and Continue’ button to save your settings.
Next, MonsterInsights will show you a list of website tracking features you would like to enable.
You can scroll down and click on the ‘Continue’ button or the ‘Skip for Now’ option.
On the next screen, MonsterInsights will show that you’ve successfully setup Google Analytics tracking.
You can see that Google Analytics is connected, tracking code is installed, and data is now being collected.
Next, you can scroll down and see a field to enter your license key.
Go ahead and click the ‘Complete Setup without Upgrading’ option for now.
You’ve successfully added Google Analytics to your WordPress website.
Next, you’ll need to create a Measure Protocol API Secret. This will allow MonsterInsights to track events like eCommerce purchases, form conversions, and more.
To start, you can login to your Google Analytics account. Then head over to the ‘Admin’ settings page and click on the ‘Data Streams’ option.
Next, you’ll see your Data Streams.
Simply select the data stream you connected with MonsterInsights.
On the next screen, scroll down to the ‘Advanced Settings’ section.
After that, click on the ‘Measure Protocol API Secrets’ option.
You’ll now see a new window slide in with your Measurement Protocol API Secrets. Initially, this page will be empty, and you won’t have any API secrets.
Go ahead and click the ‘Create’ button.
Next, you’ll need to enter a nickname for your API secret.
Once you’ve done that, simply click the ‘Create’ button.
Your API secret will now be created.
Go ahead and copy the API secret that’s under the ‘Secret Value’ field.
Next, you’ll need to enter the Secret Value in MonsterInsights.
You can do that by going to Insights » Settings from your WordPress admin panel and then clicking the ‘General’ tab.
Then head over to the ‘Google Authentication’ section.
Simply enter the Secret Value under the ‘Measurement Protocol API Secret’ field.
You’ve successfully set up the Measurement Protocol API Secret.
Now, let’s see how to use dual tracking in MonsterInsights if you have a Universal Analytics account.