How to Install Google Analytics in WordPress?

Regardless of your chosen niche, knowing what sort of people visit your website and how they interact with it is essential. Many tools can give you such precious information, and Google Analytics is perhaps the most powerful and popular of them all. Our job today is to pair the platform with the most acclaimed CMS – WordPress.

WordPress users (a third of all website owners) can reap great benefits from Google’s detailed site statistics. Real-time analytics, demographics, visitor behavior, traffic sources – there is little you can’t find out with this tool. But before you start gaining insights, you have to first install Google Analytics in WordPress

What is Google Analytics?

Google Analytics was first released more than 15 years ago after Google acquired Urchin – a web statistics and analysis program that was fairly popular at the time. It’s still considered the best source of analytics data that can show you what you need to focus on and how you can improve the user experience for your visitors.

The platform has a premium plan that offers an extremely detailed insight into how your website is performing. Still, for most users, the data provided by the free plan should be more than enough.

Why Is Google Analytics Important?

Google Analytics answers a couple of fundamental questions – who are your visitors, and what they do on your website?

First, GA shows you the demographic characteristics of your site visitors. You get to see where they live, how old they are, what sort of devices they use, etc.

Armed with that information, you can move the website to a data center that is geographically closer to your largest audience. That way, recurring visitors will enjoy even better loading speeds.

Your visitors’ age and gender can also have a major influence on your content strategy. You can better predict what products and services they might be interested in and adjust your website focus accordingly.

 

But Google Analytics doesn’t just track information on who your visitors are. It also records what they do.

The analytics platform gives you detailed stats on how long a typical session lasts as well as a measurement of the website’s bounce rate. This is an essential metric that shows how many users land on one of your web pages and then leave instead of interacting with other sections of your website.

With Google Analytics, you’ll also see the pages users visit the most and the links and buttons they click more frequently. It should be pretty clear how this information can help make them happier. By concentrating on the type of content that gets more attention, you can be sure visitors will stay and click around more. 

You can also use the data for your own goals. For example, you notice that not a lot of people are clicking on a particular menu or a button that plays an important role in your business model. Knowing that you can move around and reposition the visual elements, change their color, A/B test different versions, and more.

Last but not least, you can see how visitors get to your site. Google Analytics tells you exactly which channel attracts the most visitors, and it’s up to you to use this information to adjust your marketing strategy. Would you put more effort into your SEO strategy? Or promote mainly in social networks? Should you go for a responsive design to accommodate more mobile users?

Google Analytics has all the answers.

How to Sign up With Google Analytics?

Analytics is one of the services that come for free as part of your Google account. To use it, you first need to add your website as a GA property at https://analytics.google.com.  The process is fairly straightforward, but you need to bear in mind a couple of specifics.

Google Analytics 4 came out in October 2020 and brought about some significant changes. GA4 is a new version of the statistics tool that collects and tracks mobile app data more efficiently.

Developers have not yet had the chance to adapt their products, though. For example, some of the methods for deploying Google Analytics on WordPress still only work with the old GA properties (now called Universal Analytics properties).

Thankfully, you can still add your website as a new Universal Analytics property. If you’re using the platform for the first time, you first need to sign in to your Google account, set up an Analytics profile, and configure the data sharing settings.

After that, you’ll move on to setting up your property.

Pick a name, choose the time zone and currency, and click the Show Advanced Options button. This way, in addition to the GA4 property, you’ll also create an Advanced Analytics one. This will allow you to use WordPress plugins to deploy Google Analytics on your site.

After you enter the domain name and fill out some details about your business, the properties will be created. They will now be available in the Google Analytics admin panel – the place to find all the important analytics data.

Now it’s time to integrate the service into your WordPress website.

How to Install Google Analytics Using MonsterInsights?

MonsterInsights prides itself as the best Google Analytics plugin for WordPress, and, given the 2 million active installations, few people will try to dispute this claim. Users prefer it over similar alternatives as it’s easy to set up and brings all the vital Google Analytics data straight to your WordPress dashboard.

One important thing to keep in mind is that MonsterInsights only works with Advanced Analytics properties.

After you install it, you will see a setup wizard that will help you connect the plugin to your Google Analytics account in no time. You simply need to log into your Google account, set the appropriate permissions for MonsterInsights, and pick the correct website from the list of properties.

After a few hours, Google should start populating data straight to the MonsterInsights widget you’ll see on your WP Dashboard homepage. If you have problems retrieving data – clearing your content cache is one common way of solving the issue.

MonsterInsights’s premium version comes with quite a few additional features that give you an even better insight into what people do on your website. If you upgrade from MonsterInsights Lite to MonsterInsights Pro, you can get the paid option with a whopping 50% discount.

How to Install Google Analytics Using the Insert Headers & Footers Plugin?

Insert Headers and Footers is an open-source plugin with over 1 million active installations. It can be used to easily add custom code to your WordPress website. In addition to integrating Google Analytics, it can also help you install a Facebook Pixel, add custom CSS rules, and insert HTML and JavaScript snippets.

To deploy Analytics using the Insert Headers and Footers plugin, you first need to get your tracking code from GA’s Admin panel. For Advanced Analytics properties, click Admin (the gear icon in the bottom-left corner), select the correct property, and go to Tracking Info > Tracking Code. The all-important code is in the Website Tracking section. Copy it to your clipboard and go back to your WordPress dashboard.

The tracking code for GA4 properties is located in Admin > Data Streams. Pick the correct website, and under the Add New On-page Tag tab, select Global Site Tag. The snippet in the box is your tracking code.

After you install the Insert Headers and Footers plugin, you can configure it via Settings > Insert Headers and Footers. Paste the tracking code into the Scripts in Header box and click Save to apply the changes.

The plugin will automatically integrate the script into WordPress’s header, and Google Analytics will start collecting data immediately.

How to Install Google Analytics in WordPress Without a Plugin?

Naturally, you can deploy Google Analytics manually as well. What you need to do is paste the tracking code into the header.php file of your WordPress theme.

There are a few things to consider, though.

In effect, you will be editing your website’s code, and even the tiniest mistake can result in downtimes. If you don’t feel confident enough, it’s perhaps a better idea to consider one of the other plugin methods. But even if you think you can do it – you should still back up your website, just to be on the safe side.

Fetch the tracking code from the Google Analytics Admin panel, log into your WordPress dashboard, and go to Appearance > Theme Editor. Open the Theme Header (header.php) file and locate the </head> tag. Insert a new line just before that and paste the Google Analytics tracking code. Click Update File to apply the changes.

You need to bear in mind this method enables GA on your current theme only. If you change the theme at some point in the future, you’ll need to repeat the steps mentioned above.

Viewing Google Analytics Reports and Making the Most of Google’s Stats Tool

The Google Analytics Admin panel contains so much information that sifting your way through all the data could be a bit of a challenge. This is why the MonsterInsights plugin is so successful. Instead of navigating through all the menus and charts in Google Analytics, you can get the most useful information directly in the WordPress dashboard.

But what insights are actually included in the platform?

For starters, you can get Real-time data, which includes the number of people currently visiting your website, information on where they come from, where they are located, and how they interact.

From the Audience reports, you gain more insights on what sort of people visit your website and how they use it. The information is related to both the demographics of your audience and their behavior.

In the Acquisition section, you’ll find data about your traffic sources. The detailed reports reveal which channels efficiently direct people to your website and which might need more attention.

The focus of the Behavior section is user actions once they land on your website. You’ll see what your visitors access, what they search for, and what they avoid. You’ll also get an idea of how fast your pages are loading. If you see that your speed needs improvements – you can take the necessary precautions.

The Conversions section can be very useful for people who need to track the exact results of their marketing campaigns. Among other things, you can set goals (e.g., having a user create an account or make a payment) and monitor how often they are achieved.

Conclusion

By a rough estimate, nearly 30 million websites use Google Analytics. This is no surprise as GA can be invaluable for any site owner. Integrating it can be a challenge, especially if you want to have the data easily accessible. As a WordPress user, however, you have a number of different methods for making it work, both manually and with the help of a plugin.

Now that you have all the statistics – make sure to put them to good use!

FAQ

How does Google Analytics work?

To enable Google Analytics, a unique snippet of JavaScript code (your Google Analytics tracking code) must be inserted into the HTML of a web page. When a user arrives on the page, their computer executes the code and sends the encrypted information to Google’s servers.

This information includes the page that is currently viewed, the visitor’s hardware configuration, data about the referral URL, etc. Google Analytics then collects, organizes, and presents all this data in relatively easy-to-digest reports.

Is Google Analytics easy-to-use?

The Google Analytics admin panel is designed to be as user-friendly as possible. Still, because of the sheer volume of data, navigating around could be a bit confusing for less experienced users. Thankfully, the internet is awash with useful and easy-to-follow guides that walk you through the interface and help you get the most out of it.

Do I need Google Analytics on my website?

If you’re serious about your online business, you have to have an idea of what sort of audience your website attracts. You need to know how they interact with it and what they like the most. Knowing all these things, you can steer your website in a direction that would lead to the retention of current users and the addition of new ones. Google Analytics is arguably the easiest way of obtaining website information.

Is it difficult to integrate Google Analytics into WordPress?

If you want to go down the user-friendly route, installing it via a plugin is the best way to integrate Google Analytics in WordPress. There are quite a few to choose from, and your choice should mainly depend on the features included.
For example, some can bring Google Analytics data straight to your WordPress dashboard, while others will only add the code and leave you to view the information at https://analytics.google.com. Alternatively, if you’re feeling confident, you can add the tracking code to the header.php file yourself.

ScalaHosting – How to Install Google Analytics in WordPress?

Was this article helpful?

What’s your goal today?

1. Find the right WordPress hosting solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lightning-fast

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Fill out the form, and we’ll be in touch.

Make your website lighting fast—or your money back
Slow websites lose visitors and sales. See how you can surf tsunami sized traffic spikes—or any traffic—with ease with ScalaHosting. Fill out the form, and we’ll be in touch!
Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.

Photo

Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. Learn how to grow your website in 2024

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

An Exclusive Insiders Look Behind The SEO and Web Development Curtain