Google Analytics 4 Setup Guide

Complete installation guide for Google Analytics 4. Follow these steps to get GA4 tracking up and running on your website.

Prerequisites

Before you begin, make sure you have:

  • A Google account
  • Access to your website's code or admin panel
  • Basic understanding of HTML/JavaScript (for manual setup)
  • Your website URL ready

Step 1: Create a GA4 Property

1

Sign in to Google Analytics

Go to analytics.google.com and sign in with your Google account.

2

Create a New Property

Click "Admin" (gear icon) → "Create Property" → Enter your property name and select your time zone and currency.

3

Set Up Data Stream

Choose "Web" as your platform → Enter your website URL and stream name → Click "Create stream".

Important: Save your Measurement ID (starts with G-). You'll need this for installation.

Step 2: Install GA4 Tracking Code

Choose the installation method that works best for your website:

Method 1: Google Tag Manager (Recommended)

Best for: Multiple tracking codes, easy management, advanced tracking needs

1. Set Up Google Tag Manager

Create a GTM account at tagmanager.google.com

2. Install GTM Container Code

Add the GTM code to your website's <head> and <body> sections:

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- End Google Tag Manager -->

3. Create GA4 Tag in GTM

In GTM, create a new tag → Choose "Google Analytics: GA4 Configuration" → Enter your Measurement ID → Set trigger to "All Pages" → Publish.

Method 2: Direct Installation

Best for: Simple websites, single tracking code, direct control

Add to Website Head

Copy the Global Site Tag (gtag.js) code from GA4 and paste it into your website's <head> section:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Replace G-XXXXXXXXXX with your actual Measurement ID.

Method 3: WordPress Plugin

Best for: WordPress websites, non-technical users, quick setup

Recommended Plugins

  • MonsterInsights: Most popular, user-friendly interface
  • GA Google Analytics: Lightweight, free option
  • Google Site Kit: Official Google plugin

Installation Steps

  1. Install your chosen plugin from WordPress admin → Plugins → Add New
  2. Activate the plugin
  3. Go to plugin settings and enter your GA4 Measurement ID
  4. Save settings and verify installation

Step 3: Verify Installation

Confirm that GA4 is tracking correctly:

Real-Time Reports

In GA4, go to Reports → Realtime. Visit your website and you should see your visit appear within seconds.

Browser Tools

  • Use Google Analytics Debugger browser extension
  • Check browser developer tools (F12) → Network tab → filter for "analytics"
  • View page source and search for your Measurement ID

GA4 DebugView

In GA4 Admin → DebugView, you can see real-time events as they fire on your website.

Step 4: Basic Configuration

Configure essential settings for accurate tracking:

Exclude Internal Traffic

Filter out your own visits to get accurate visitor data:

  1. Go to Admin → Data Streams → Your stream
  2. Click "Configure tag settings" → "Show advanced settings"
  3. Add your IP address to the exclusion list

Set Up Goals/Conversions

Mark important events as conversions:

  1. Go to Admin → Events
  2. Find events you want to track (e.g., purchase, form_submit)
  3. Toggle "Mark as conversion" for each important event

Link Google Search Console

Connect Search Console for SEO insights:

  1. Go to Admin → Search Console links
  2. Click "Link" and follow the setup wizard
  3. Select your Search Console property

Common Issues & Solutions

No Data Appearing

Check that your Measurement ID is correct, code is in the <head> section, and there are no JavaScript errors blocking execution.

Duplicate Tracking

If you see inflated numbers, you may have multiple tracking codes. Remove duplicate installations.

Data Delay

Standard reports can take 24-48 hours. Use Real-time reports for immediate verification.

Next Steps

Now that GA4 is set up, explore advanced features like custom events, e-commerce tracking, and audience building.