How To Install Google Analytics In WordPress

WordPress is the world’s most popular and powerful content management software, and Google Analytics is the world’s most popular program for measuring and tracking visitor statistics. Together, they allow WordPress administrators to operate some of the most successful and popular websites on the internet.

One of the first things you should do when you start a blog is to install Google Analytics.

What Is Google Analytics?

Google Analytics is a freemium product that was first launched by Google in 2005 after acquiring the firm Urchin. The term “freemium” refers to the fact that most of the capabilities and services of Google Analytics are free, but more advanced functions are only available with a paid subscription.

It is estimated than more than 10 million websites are currently using Google Analytics, and over 60% of the world’s 10,000 biggest websites rely on it. At its most basic level, Google Analytics is a small piece of Javascript code on a website called a cookie that stores and analyzes data gathered from visitors.

Note: WordPress sites hosted by WordPress.com cannot use Google Analytics because it requires installing third-party code.

The snippet of code used by Google Analytics can be added to one or more pages. The tool, at its most basic, shows you who is visiting your site, where they came from, and general attributes of the visitors, including age, gender, and interests, where known.

Google Analytics also functions as a data aggregator, collecting and sorting visitor data on four levels.

* User level – The actions performed by each user.
* Session level – What happens during a single visit.
* Pageview level – Which pages were viewed by visitors.
* Event level – What users clicked, which videos they watched, etc.

It’s important to remember that Google Analytics only displays data on an aggregate level. For instance, Google Analytics can tell you that your website received 1,000 views from men age 35-45, but it won’t tell about one specific man and what he viewed or clicked on.

For WordPress administrators, Google Analytics offers insights into two types of data: who is visiting your website and what they’re doing and where visitors are coming from before arriving at your website.

Why Do I Need Google Analytics for My WordPress Site?

Of course, it has always been possible to use WordPress to create amazing content and attract visitors without Google Analytics, but the Google Analytics tool makes it a lot easier for WordPress administrators to improve each visitor’s experience of your site. And while there are other statistics and analytics tools available, Google Analytics remains the world’s most popular option, especially the free version of the tool.

In short, Google Analytics allows you to better see your website from the point of view of your visitors. You’ve worked very hard to create an interesting and engaging website with a lovely theme, top-notch content, and an attractive layout. But without a tool like Google Analytics, you can only guess how your visitors are interacting with your website and information about who those visitors are.

Google Analytics reveals a lot of information about who is visiting your website, including their gender, age, location, and other characteristics. This information shows you what kind of people are already interested in the content on your website, allowing you to further refine and focus your content. Google Analytics also reveals exactly which websites are sending visitors to your website, including Google’s search engine, thus showing you your site’s most successful referrers and what keywords are sending visitors to your website.

For instance, if you’re using WordPress to host a blog, you might learn from Google Analytics that three other blogs are sending a lot of visitors to your site. After learning this information, you might want to reach out to those three blogs and ask about exchanging guest posts, exchanging permanent “blogroll” links, or simply to thank them for sending your traffic.

Google Analytics also unlocks what is known as user behavior data or what users (in aggregate) are doing once they arrived at your website. Which pages are they visiting? Which posts are they reading? What buttons are they clicking on? How much time are they spending on your site? What “path” are users taking when navigating across your site? And what is the last thing that users are doing before leaving your website?

Let’s imagine that you use Google Analytics and discover that a lot of users are ending their visit to your site on the same page. Perhaps that page is confusing or poorly set up, causing users to want to abandon your website. Or maybe there’s too much content on that page, prompting users to go elsewhere. Whatever the case, understanding this information will help you improve your website. Google Analytics will also tell you which pages and posts are doing well, allowing you to promote them and produce similar content in order to keep attracting visitors.

Of course, Google Analytics is also very useful for marketing campaigns and paid advertisements. If you are paying money in order to attract visitors, Google Analytics will tell you which ads or campaigns are working and which ones aren’t. This is invaluable information for fine tuning your marketing efforts.

And if you are using Google’s AdWords product, Google Analytics will give you extremely detailed information about how your AdWords campaigns are working, including goal completions, clicks, cost data, and other performance metrics. AdWords lets you directly import the data from Google Analytics into your Conversion tracking dashboard in order to make better-informed decisions about your marketing campaigns.

Google Analytics can also be used with WordPress e-commerce sites. Besides all of the other data, Google Analytics can also tell you which products or services are selling well and which ones aren’t. The user journey information can also reveal UX/UI problems as well as successful UX/UI that is resulting in more sales.

How to Get a Google Analytics Account

Before you can use Google Analytics on your WordPress website, you’ll need a Google Analytics account.

You’ll be taken to a page like the one below. If you have a Google Gmail account then sign in using your email and password. Or you can simply click on the create account button to sign up.

Once you’ve signed up, you’ll need to log into your Google Analytics. You’ll see a screen like the one below. Click on the Sign up button to get started.

You’ll then be prompted to create an account name for use with your WordPress website as well as data about the website such as its title, URL, time zone, and host country. Once this has been set up, you’ll be ready to get your tracking ID button. If you agree with the terms and services for using Google Analytics, click on “Get Tracking ID button.”

Once this has been completed, you’ll get the special piece of code for use on your WordPress website. Depending on how you want to integrate Google Analytics with WordPress, you’ll need to insert the tracking code in a specific location which is discussed below.

Note: It is recommended that you leave the Google Analytics tracking code page open in your browser during the installation process so that you can easily copy and paste the information.

How to Install Google Analytics in WordPress With a Plugin

The easiest way to integrate Google Analytics into WordPress is with the use of a plugin. There are several available, but the most popular, by far, is called MonsterInsights. According to MonsterInsights, more than two million WordPress websites are currently using their Google Analytics plugin.

Note: The MonsterInsights plugin has both a free and paid version. While it is possible to use Google Analytics with the free version, the paid version unlocks a lot more information, charts, and reports about visitor data.

Once you’ve downloaded and installed the MonsterInsights plugin, you’ll see a new menu item appear on the left-hand column of the WordPress Admin Screen called “Insights.”

Click on “Insights” and then “Settings” in order to set up the plugin. Since you’re installing a Google product, you’ll need to click on “Authenticate with your Google account.” From there, you’ll be redirected to a Google login page where you will present your Google credentials. You’ll then need to give permission for MonsterInsights to connect to your Google Analytics account.

After this has been completed, you’ll need to select a profile to track. In most cases, choosing “all web site data” is the best choice. Click on “Complete Authentication” and you’re done! Google Analytics has been successfully integrated into your WordPress website.

Note: It will take hours, if not days for Google Analytics to collect enough data to show you any statistics about visitors to your website. Be patient!

To see the information provided by Google Analytics, click on “Insights” in the left-hand column of your WordPress admin screen and then “Reports.”

If you prefer not to use the MonsterInsights plugin, there is another way you can install Google Analytics, using a plugin called “Insert Headers and Footers.”

Once that plugin has been installed, you’ll need to click on “Settings” and then “Insert Headers and Footers” from the Admin Screen. You’ll then see a text box showing your current header and footer scripts. Copy your Google Analytics tracking code and add it to your header section.

Note: While this method does allow you to install Google Analytics, it does not generate any reports or give you access to your statistics from the WordPress admin screen. You’ll have to visit the Google Analytics website directly for this information.

How to Install Google Analytics in WordPress Without a Plugin

Because using a plugin is so much simpler, installing and using Google Analytics without one is only recommended for advanced users. Many administrators mistakenly believe that using plugins will slow down their website’s responsiveness, but the two plugins discussed in the previous section are highly optimized so as not to affect site performance. Using Google Analytics without a plugin is primarily for administrators who want to exercise more fine control over how their website is set up.

After creating a Google Analytics account and getting the tracking code for your WordPress site, you’ll need to edit the “header.php” file in your WordPress directory. You can do this either directly with a text editor or by clicking on “Appearance” and then “Editor” and “Theme Header” from the WordPress admin screen.

You’ll then need to paste the Google Analytics code directly into the “header.php” file after the opening <body> tag. Then save the changes or click “Update File” if you are doing this from the WordPress admin screen.

Note: Keep in mind that if you update or change your theme, the Google Analytics tracking code will disappear and have to be re-inserted.

Adding Google Analytics to WordPress Theme Files

It is possible to directly insert your Google Analytics tracking code to your WordPress theme, but this option is best left to advanced users who understand coding. Furthermore, it’s important to remember that, if you change your theme or update your theme, the tracking code information will be removed.

To install your Google Analytics tracking code directly to your theme, open the “header.php” file and paste the code directly after the opening HTML <body> tag. You can also add the Google Analytics tracking code to your theme’s “functions.php” file.

You can access these files directly or use the WordPress admin screen’s “Editor” function available by clicking on “Appearance” in the left-hand column.

How to Use Google Analytics in WordPress

Once you’ve successfully installed Google Analytics and given the tool enough time to collect a sufficient amount of data, you can begin using the insights provided about visitor data to improve how visitors experience your WordPress website.

Many people mistakenly believe that Google Analytics is only useful for monetized websites or WordPress sites that are set up to make money. This simply isn’t true. Understanding who your visitors are and how they interact with the content on your site is crucial for improving the user experience. You can, however, also use Google Analytics to track marketing campaigns or paid advertisements in order to better judge their effectiveness in increasing (targeted) visitor traffic to your site.

Google Analytics allows you to see who is visiting your website, thus allowing you to better tailor content. Google Analytics also allows you to see which pages, posts, and buttons that visitors are interacting with, thus showing you what is popular and what is not popular on your website. Google Analytics also shows you what products are selling well (for e-commerce websites) and where your visitors are coming from.

Imagine that you learn from Google Analytics that a guest post on your blog received a lot of visitors. That tells you that you definitely need to have that author write more content for your website. Google Analytics can also tell you which topics and categories on your website are more popular than others.

Another really great insight provided by Google Analytics is seeing the user journey. Where did visitors begin their journey on your website, what did they click or read or view, and where was the last place that they visited before leaving your website? Understanding this journey will help you identify “dead ends” or places where users get “stuck” as well as tell you what’s working very well.

And because Google Analytics tells you which websites your visitors are coming from before they visit your site, this information reveals which third-party sites are helping drive traffic to your website. For paid advertisements, this information will tell you which campaigns are working best. But for unpaid or organic traffic, this information can reveal which sites are championing the content on your website. You might use this information to reach out to them and agree to mutually link to one another’s site, inquire about guest posts, or learn more about what type of content is getting results from third-party websites.

Of course, one of the biggest drivers of traffic to your website is going to be Google’s search engine itself. Understanding this search information provided by Google Analytics is extremely useful because it tells you which keywords or topics people are searching for that led them to your WordPress website. This will help you further narrow your focus or (re)define your niche in order to improve the SEO (Search Engine Optimization) results for your website.

Effectively, Google Analytics reveals insights to better help you understand where your visitors are coming from, who they are, and what they’re doing once they’re on your website. By understanding what is working and what isn’t, you’ll be better able to manage the content, layout, and organization of your website. Whether your goal is to make (more) money or simply to receive more visitors and provide more engaging content, Google Analytics is an incredibly powerful and useful tool.

The following two tabs change content below.

Jamie Spencer

My name is Jamie Spencer and I have spent the past 10 years building money making blogs. After growing tired of the 9-5, commuting and never seeing my family I decided that I wanted to make some changes and launched my first blog. Since then I have launched lots of successful niche blogs and after selling my survivalist blog I decided to teach other people how to do the same.

Leave a Comment