How to Integrate Google Analytics with WordPress
✅ Step 1: Create a Google Analytics Account
-
Visit Google Analytics
-
Sign in with your Google account.
-
Click Start measuring.
-
Set up:
-
Account Name
-
Property Name (usually your website)
-
Time zone and currency
-
-
Choose your platform: Web.
-
Enter your website URL and name.
-
Click Create Stream.
✅ Step 2: Copy the Tracking ID / Measurement ID
-
For GA4 (Google Analytics 4), it will look like:
G-XXXXXXXXXX -
You’ll need this to connect your website to Analytics.
🧩 Step 3: Add Google Analytics to Your WordPress Site
Option 1: Using a Plugin (Recommended for Beginners)
👉 Popular Plugins:
-
MonsterInsights (freemium)
-
Site Kit by Google (free, official plugin)
-
GA Google Analytics (lightweight)
How to Use Site Kit by Google:
-
Go to your WordPress dashboard.
-
Navigate to Plugins > Add New.
-
Search for Site Kit by Google and install it.
-
Activate the plugin.
-
Follow the setup wizard to:
-
Connect your Google account
-
Grant necessary permissions
-
Link your Analytics account
-
-
Done! Analytics is now tracking your site.
Option 2: Manually Add Tracking Code (Advanced Users)
-
Copy your Global Site Tag (gtag.js) from Google Analytics.
-
In WordPress, go to Appearance > Theme File Editor.
-
Open the
header.phpfile. -
Paste the code before the closing
</head>tag. -
Save changes.
⚠️ Warning: Editing theme files directly can break your site. Use a child theme or back up your site before editing.
✅ Step 4: Test Your Setup
-
Go back to Google Analytics.
-
Use Realtime > Overview to check if your visit appears.
-
Use tools like Google Tag Assistant or GA Debugger Chrome extensions.
📊 Bonus Tips
-
Set up Goals/Conversions in Analytics (like form submissions or purchases).
-
Link Google Analytics to Google Search Console.
-
Use UTM parameters to track marketing campaigns.