Easily add Google Analytics to your WordPress website

When you have a website, it’s important you know where your traffic is coming from and how much traffic you’re getting. This will help you continue to optimize your website and let you see if any of your traffic generation efforts are actually working.

Below we illuminate a few different ways you can install Google Analytics on your website, including adding it to your existing theme, installing analytics in your website’s header or footer, or using a WordPress plugin to manage your data.

Why You Need to Install Google Analytics

Do you know where your traffic is coming from? Do you have a way to determine if any of your traffic generation strategies are actually working? Knowing how your audience interacts with your website, and understanding how they find your site is crucial for your success.

Google Analytics will help you keep track of the following things (plus a lot more):

• Who visits your site

How well do you understand your target market? Although the data provided won’t give you a specific look into the head of your visitor it will give you information like where they’re from, the devices they’re using, the languages they speak, and much more.

• Where they visit your site from

It’s important to have an understanding of the sources that are sending your website the most traffic. For instance, were they referred from Facebook, or did they find your site from the search engines? The more you know about the specific location your users are visiting from the better you’ll be able to maximize traffic from that source.

• How they interact with your site

Installing analytics will enable you to track how your visitors are using and navigating your website, how long they stay on certain pages, and how frequently they’re leaving your website.

This will help you to optimize your site to reduce your bounce rate, which will improve your user experience and be a boon to your SEO efforts.

• What content and site pages they prefer

Do you know which pages of your website visitors find the most valuable? Are you aware of which pages on your site tend to repel visitors? By mining your analytics data you’ll be able to slowly engineer a website that your visitors love.

Recommended WordPress Hosting

How to Install Google Analytics

Now that you understand the importance of installing analytics on your site, it’s time to get everything up and running. You do need to have a Google account to setup for this tool to work, so if you don’t have an account, then set one up here.

On the next screen you’ll add the website that you want to track.

Sign Up for Google Analytics

Just enter all of the required information, click ‘Get Tracking ID’ and you’re all set.

Google Analytics Code

Your tracking ID should look something like the image above. Don’t worry, you don’t need to edit any of this code. Just copy and paste it for the following steps.

There are multiple methods of adding Google Analytics to your site, choose the method below that works best for you.

Method 1: Manually Add Analytics to Your WordPress Site

One of the simplest ways to add Google Analytics to your website is to simply insert the code into the header or footer of your site.

Navigate to your WordPress dashboard and go to Appearance>Editor>header.php. Then paste the code you copied in the step above right after the <body> tag. That’s it!

Method 2: Add the Analytics Code Into Your Theme

Depending on your theme you might even be able to paste the code directly into your theme settings page. To do this navigate to your theme’s options page. This can be found by navigating to your “Theme Name”>Theme Settings. For this example we’re using a Genesis theme, so we’ll navigate to Genesis>Theme Settings.

Towards the bottom there’s a place to insert Header and Footer scripts. Then we’ll just copy our code into the header section, as shown below.

Setting up Google Analytics

You can also enable easy access to the header and footer areas by using a plugin like Insert Headers and Footers. This plugin will create an area you can easily modify and insert your tracking code, like the example above.

Method 3: Add Analytics Using a Plugin

If the methods above don’t suit your fancy, then you can always install a plugin that’ll simplify the process for you. However, using a plugin to access your analytics data often won’t give you the same level of reporting information. There are a variety of plugins you can use including Google Analytics by MonsterInsights, Google Analyticator, and Google Analytics Dashboard for WP.

For the sake of example we’re going to assume you went with Google Analytics by MonsterInsights (formerly Google Analytics by Yoast).

To install the plugin, navigate to your WordPress dashboard. Then navigate to the plugin installation screen by going to Plugins>Add New. Then do a search for Google Analytics by MonsterInsights, and it should be the first plugin that comes up.

Click install now and the plugin will download and install on your site. Click ‘Activate Plugin’ and you’re all set. Now all you have to do is configure the settings shown below.

Google Analytics WordPress

Navigate to Insights>Settings. Then all you have to do is Authenticate your Google account, which will automatically link your Analytics account and the plugin. Then you’ll have to select which website you wan to collect data on.

Then, just check the boxes for the data you’d like to track and you’re all set. Now, when you navigate to the Insights Dashboard you’ll be able to see your general analytics data.

Setting up Google Analytics on your WordPress site doesn’t have to be difficult. Just use one of the methods above to easily enable analytics tracking across your site.

Setting up WordPress doesn’t have to be difficult, either. With HostGator one-click installs and free site transfers, we make web hosting easy and affordable.

Get Started With HostGator!