Add Google Analytics to WordPress

How to Add Google Analytics to Your WordPress Website

Want to know how visitors engage with your website? Add Google Analytics to your WordPress website and find out.

Google Analytics gives you detailed information (analytical data) about how visitors engage with your website. This data is invaluable when it comes to optimizing your website to give visitors the best experience possible. Google Analytics data can also be used to carefully fine tune your website for better conversion. You can fine tune marketing or sales funnels with Google Analytics data.

And I have to add, so many other invaluable insights are hidden in that treasure trove we call Google Analytics, just waiting to be discovered.

I believe it’s mandatory to add Google Analytics to WordPress, in fact any website. “But how do you do that” I hear you asking. In this article, I’ll show you several methods.

Get Detailed Website Visitor Data

Detailed is an understatement. The amount of data you can find on Google Analytics is staggering. Don’t be overwhelmed when starting out, dive in there and take a look around. Some of the data to be found includes:

  • See how visitors arrive at your website.
  • See where visitors arrive from.
  • See how they click through your website.
  • See how much time they spend on each page and on the site in total.
  • See which page they exit your site from.
  • You can even see things like which buttons they click on.

There is so much more data available from Google Analytics. I’ve not even scratched the surface, literally. Find out which pages are your strong pages. Find out which pages are weak i.e. people leave the site on particular pages. With this kind of information you can fix the bad and find out what’s working and improve it even more.

Add Google Analytics to WordPress

There are three ways I recommend you add Google Analytics to WordPress. Use any one you prefer, I use option three most often.

  1. Edit the header.php file
  2. Edit the functions.php file
  3. Use a plugin

Before you can add Google Analytics to WordPress you’ll need a Google Analytics account. If you don’t already have an account, sign-up for Google Analyics, it only takes a moment.

Once you’ve signed up to Google Analytics you’ll receive a tracking code. This tracking code is what is added to your website.

Add Google Analytics to WordPress Tracking Code

The tracking code must be inserted in every page you want to track. This means inserting it somewhere it will show up on each page of your website.

Option 1. Edit the header.php File

In your WordPress admin area go to Appearance > Editor then (usually) on the right. Then click your themes “header.php” file and paste your Google Analytics tracking code right after the <body> tag.

Save the file and you’re done.

Note: If you’re using the Genesis Framework for WordPress it’s even easier. In your WordPress admin go to Genesis > Theme Settings, scroll down till you see the “Header and Footer Scripts” text box and paste your code in there.

Click “Save Settings” and your done.

Add Google Analytics to WordPress with Genesis

Option 2. Edit the functions.php File

In your WordPress admin area go to Appearance > Editor then (usually) on the right. Then click your themes “functions.php” file. Copy the code below and paste it at the bottom of your functions.php file.

Now paste your Google Analytics code in to the appropriate space in the code below.

Option 3. Use a Plugin

My preferred method to add Google Analytics to my WordPress websites is with a plugin. My favourite plugin is Yoasts Google Analytics Plugin and it’s free. There is a paid version with more features but the free version is excellent.

Adding the plugin and connecting it to your Google Analytics account is easy. This handy guide from Yoast will walk you through step by step to install and setup the plugin.

Whats really handy is the Analytics Dashboard screen. In your WP Dashboard go to Analytics > Dashboard. From there you see a quick overview of what’s happening on your site.

Start Analyzing the Data

After you’ve added Google Analytics to your site it takes 12 to 24 hours for data to reflect. In the Google Analytics Dashboard start by going to the “Reporting” tab.

Google Analytics is indispensable and free, don’t wait to add Google Analytics to WordPress. This amazing tool deserves pride of place in your website success arsenal.

For your WordPress website, take a look at our WordPress Hosting, it’s user-friendly and powerful. We know you’ll love it!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top