How to Add Google Analytics Measurement ID to WordPress
Adding your Google Analytics ID to WordPress is one of the first and most important steps in understanding your website's traffic. This tiny snippet of code is the bridge between your site and the powerful insights waiting for you in Google Analytics. We'll walk you through exactly where to find your Measurement ID and a few simple ways to get it set up on your WordPress site today.
What is a Google Analytics Measurement ID?
Think of the Google Analytics Measurement ID as a unique mailing address for your website's data. When a visitor comes to your site, this ID tells the tracking code exactly which Google Analytics property to send the information to - like page views, clicks, and session durations.
If you've used Google Analytics before, you might be familiar with the old "Tracking ID," which started with "UA-". Google has since upgraded to Google Analytics 4, which uses a new format called the "Measurement ID." It always starts with "G-" followed by a series of numbers and letters (e.g., `G-ABC123XYZ4`).
In short, without this ID properly installed, Google Analytics can't collect any data from your WordPress site. Getting it set up correctly is the foundation for tracking your performance, understanding your audience, and making data-driven decisions.
First, Find Your Measurement ID
Before you can add the ID to WordPress, you need to know what it is. If you've already set up a Google Analytics 4 property for your website, finding your ID takes less than a minute. If you haven't, you'll need to create one first.
Here’s how to find your existing Measurement ID:
- Log in to your Google Analytics account.
- Click the Admin gear icon in the bottom-left corner of the page.
- Make sure you have the correct Account and Property selected in the top columns.
- In the Property column, click on Data Streams.
- You should see your website listed as a data stream. Click on it to open the details.
- Your Measurement ID will be displayed in the top-right corner. Use the copy icon next to it to copy it to your clipboard.
Keep that ID handy, you're going to need it in the next steps.
3 Simple Ways to Add the Google Analytics ID to WordPress
There are several ways to get your WordPress site connected to Google Analytics. We'll cover three of the most common methods, ranging from the absolute easiest to a more manual approach for those who are comfortable with code.
Method 1: Use a WordPress Plugin (Recommended for Most Users)
For most people, using a plugin is the fastest, safest, and most straightforward way to add Google Analytics to WordPress. You won't have to touch any code, and many plugins offer additional features like displaying simple reporting right inside your WordPress dashboard.
Site Kit by Google is an excellent choice because it's Google's official plugin, making the integration seamless.
How to Set It Up with Site Kit:
- Step 1: Install and Activate the Plugin In your WordPress dashboard, go to Plugins → Add New. Search for "Site Kit by Google," click Install Now, and then Activate.
- Step 2: Connect Your Google Account Once activated, you'll see a prompt to start the setup. Click the "Start Setup" button. It will guide you through connecting your Google account with just a few clicks. You'll grant the plugin permission to access your Google Analytics data.
- Step 3: Connect to Google Analytics Site Kit will automatically detect your Google Analytics account. Simply select the property and view that corresponds to your website and click "Configure Analytics."
That's it! Site Kit automatically adds the required tracking code to your website. You don’t even need to manually paste the Measurement ID anywhere. The plugin handles it all for you and will even start showing you a high-level overview of your traffic directly in your WordPress dashboard.
Other popular alternatives like MonsterInsights or GA Google Analytics follow a similar, simple setup process.
Method 2: Use Your Theme's Built-in Features
Many modern WordPress themes include a dedicated area in their settings for adding tracking scripts. This is a great option if you don't want to install an extra plugin but also want to avoid editing theme files directly.
The exact location of this setting varies by theme, but it's typically found in the Theme Customizer or a separate "Theme Options" panel.
Important clarification:
This method almost always requires the full JavaScript tracking snippet (gtag.js), not just the "G-" Measurement ID. But don't worry, getting it is just as easy.
How to Find and Add the Full Tracking Snippet:
- Step 1: Get the Full Snippet (gtag.js)
Go back to your Google Analytics → Admin → Data Streams page and click on your website's data stream. At the bottom, under Tagging Instructions, click View tag instructions. Then, select the "Install manually" tab. Here you will see a box of code that starts with
<!-- Global site tag (gtag.js) - Google Analytics -->. Copy this entire block of code.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-YOUR_MEASUREMENT_ID"></script>
<script>
window.dataLayer = window.dataLayer || [],
function gtag(){dataLayer.push(arguments),}
gtag('js', new Date()),
gtag('config', 'G-YOUR_MEASUREMENT_ID'),
</script>- Step 2: Paste the Snippet in Your Theme Options In your WordPress dashboard, navigate to Appearance → Customize (or your theme's dedicated options panel). Look for a section named something like:
- Step 3: Save and Publish
Find the box labeled "Header Scripts" or similar and paste the entire JavaScript snippet you copied. Click Publish or Save. This action inserts the code into the
<head>section of every page on your site, which is exactly where it needs to be.
Method 3: Add the Tracking Code Manually (Advanced Users)
This method involves editing your theme's files directly. It's clean and doesn't rely on third-party plugins, but it comes with a strong warning: do this only if you are comfortable editing PHP files and always use a child theme.
If you edit your main theme's files, your changes will be completely erased the next time your theme has an update. A child theme inherits the functionality of the parent theme but allows you to modify files safely.
How to Manually Add the Code:
- Step 1: Get the full tracking snippet (gtag.js) as described in Method 2.
- Step 2: In your WordPress dashboard, go to Appearance → Theme File Editor.
- Step 3: On the right side, make sure you have your child theme selected. Under Theme Files, find and click on the file named header.php.
- Step 4: Scroll through the file and find the closing
<head>tag (</head>). - Step 5: Paste your entire Google Analytics tracking snippet on a new line just before the
</head>tag. - Step 6: Click the "Update File" button to save your changes.
How to Verify That It's Working
After you've added the code, you need to make sure it's working properly. This is an important last step to ensure you're actually collecting data.
The easiest way to check is with the Realtime report in Google Analytics:
- Log in to Google Analytics and navigate to Reports → Realtime.
- In a separate browser window (preferably an incognito window so you're not logged in), open your website and click around to a few different pages.
- Look back at the Realtime report. Within a minute or two, you should see yourself show up as an active user. You might see your location on the map and the pages you've visited pop up under "Views by Page title."
If you see your activity, congratulations! Google Analytics is now successfully tracking traffic on your WordPress site.
Final Thoughts
Connecting your website to Google Analytics is a non-negotiable step for anyone serious about growing their online presence. Whether you choose the simplicity of a plugin like Site Kit, use your theme's options, or add the code manually, getting it done is what matters most. Now you're ready to start collecting the data you need to understand your visitors better.
Of course, collecting data is just the start, turning it into actionable insights is where the real value lies. Digging through reports in Google Analytics can feel like a full-time job. With Graphed, we connect directly to your Google Analytics account and your other marketing platforms, letting you create dashboards and get insights simply by asking questions in plain English. Instead of spending hours building reports, you can get answers in seconds and focus on strategy, not spreadsheets.
Related Articles
How to Connect Facebook to Google Data Studio: The Complete Guide for 2026
Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.
Appsflyer vs Mixpanel: Complete 2026 Comparison Guide
The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.
DashThis vs AgencyAnalytics: The Ultimate Comparison Guide for Marketing Agencies
When it comes to choosing the right marketing reporting platform, agencies often find themselves torn between two industry leaders: DashThis and AgencyAnalytics. Both platforms promise to streamline reporting, save time, and impress clients with stunning visualizations. But which one truly delivers on these promises?