If you’re not using data to guide your website strategy, you’re just guessing. Google Analytics is one of the most widely used tools for understanding how your site content performs.

In this post, we’ll show you how to connect Google Analytics to your WordPress site so that you can start uncovering actionable insights about your content and users.

What is Google Analytics?

Google Analytics is a free website analytics tool that helps you understand how visitors navigate and interact with your site. It’s easy to connect (more on that below) by adding a tracking code to your WordPress site. Once installed, it helps you better understand:

  • Your website visitor demographics (like location, device type, and browser)
  • How people find your site (like Google search, social media, and direct visits)
  • Individual page interactions (like which pages are viewed most and how long your readers stay on your site)
  • Conversions (like purchases, signups, and downloads)

Installing Google Analytics on your site enables you to make data-driven decisions, like tailoring your website experience and marketing campaigns according to visitor preferences and behavior.

Install Google Analytics on your WordPress site

Ready to add Google Analytics to your site? Follow these steps to start collecting data:

Step 1: Sign up for Google Analytics

You’ll need to create a Google Analytics account if you don’t already have one.

  1. Go to the Google Analytics website and click “Get started today.
The Google Analytics homepage with the Get started today button higlighted
  1. Give your account a name by entering an “Account name” and customize your data sharing settings. These settings will allow you to control how much of your site data you share with Google.
The Create an account page in the Google Analytics signup flow
  1. The next step is to “Create a property,” which is the website Google will track. Enter the name of your business or website here. You will also choose your reporting time zone and local currency.
The Create a property page in the Google Analytics signup flow
  1. The final steps are about your business or website. Choose an industry that best matches your niche and your business size.
The Describe your business page in the Google Analytics signup flow with Books & Literature category selected and Small selected
  1. Choose the business objectives that fit your purpose of using Google Analytics. For example, if you want to increase blog traffic, select “Understand web and/or app traffic.” You can choose multiple categories if you have more than one goal.
The business objectives page in the Google Analytics signup flow with 'understand web and/or app traffic' selected
  1. Click Create and accept Google’s Terms of Service Agreement.
  2. Finally, choose your data streams. These sources will help Google collect information about your content’s performance to provide accurate analytics. Choose Web and type your URL. Enter your site name in “Stream Name.” Google Analytics turns on “Enhanced Measurements” by default, allowing it to measure interactions on your website. You can toggle this off if you just want to measure page views.
The Start Collecting Data page in the Google Analytics signup flow
The enhanced measurement section in the Google Analytics signup flow
  1. Click “Create and continue” to finish setting up your Google Analytics account.

Step 2: Copy your Measurement ID

Once you finish setting up your account, Google Analytics will provide you with your web stream details: your Stream Name, Stream URL, Stream ID, and Measurement ID.

the Measurement ID with an orange rectangle around it in the Stream Details section in Google Analytics

Click the copy icon next to your Measurement ID. This is the number you’ll need to connect to your WordPress site.

Step 3: Add the Measurement ID to your WordPress website

There are three ways to add your Measurement ID to your WordPress site:

You only need to add your Google Analytics information to your website once using one of the methods above; adding your analytics measurement to your site more than once may result in inaccurate reporting.

If you want to use a plugin, simply activate it and follow the step-by-step instructions. Each plugin has a slightly different process, but they should guide you through the connection process.

If you want to add code to your theme manually, follow these steps:

  1. Go to your Google Analytics dashboard.
  2. Click Admin in the bottom-left corner.
  3. Under the Property column, click “Data Streams.”
  4. Scroll down and click “View tag instructions.”
  5. Copy the full tracking script under “Install manually.”
the Install Manually installation instructions from Google Analytics
  1. Log in to your WordPress dashboard.
  2. Paste the code in your theme’s header.php file.

We recommend only using the code method if you’re comfortable editing theme files. The plugin method works just fine if you aren’t confident in editing your website theme’s code. Moreover, when your theme updates or changes, this code may be overwritten.

If you have a website on WordPress.com, you don’t need to use a plugin or code to integrate Google Analytics. Sites on our Premium, Business, Commerce, or legacy Pro plans can use the pre-installed Jetpack plugin to easily connect your site to your Google Analytics account:

  1. Go to your WordPress.com dashboard.
  2. Navigate to Tools → Marketing (or Jetpack → Settings if using WP Admin).
  3. Select the Traffic tab.
  4. Find the Google section and enter your Measurement ID in the “Google Analytics Measurement ID” box.
  5. Click “Save settings.”
The Google Analytics measurement ID field and section on WordPress.com

After following one of the three methods outlined above, Google Analytics will start capturing your website data in 48–72 hours.

How to use Google Analytics to improve your site performance