Help CenterSEO & AnalyticsHow do I set up Google Analytics 4 on my website?

How do I set up Google Analytics 4 on my website?

Google Analytics 4 (GA4) gives you real-time data on who visits your website, where they come from, and what they do. Here is how to install it correctly.

What is Google Analytics 4?

Google Analytics 4 (GA4) is Google's latest analytics platform that replaced Universal Analytics in July 2023. It tracks user behaviour across websites and apps using an event-based data model — every interaction is an "event" rather than a page view.

GA4 gives you:

  • Real-time visitor data
  • Traffic sources (organic, paid, social, direct)
  • User demographics and location
  • Pages viewed and time spent
  • Conversion tracking (form submissions, purchases)
  • Funnel analysis

Step 1: Create a GA4 Property

1. Go to [analytics.google.com](https://analytics.google.com)

2. Sign in with your Google account

3. Click **Admin** (gear icon, bottom left)

4. Under **Account**, click **Create Account** (or choose existing)

5. Click **Create Property**

6. Enter your property name (e.g., "My Business Website")

7. Choose your country (India), currency (INR), and industry

8. Click **Next** → Choose **Web** → Enter your website URL

9. Click **Create Stream**

Step 2: Install the Tracking Code

### For WordPress

1. Install **"Site Kit by Google"** plugin (free, official Google plugin)

2. Follow the setup wizard — it connects GA4, Search Console, and AdSense automatically

3. No code changes needed

Alternatively, use **"MonsterInsights"** or add the code manually via a child theme's `functions.php`.

### For All Other Websites (Manual)

Copy the `gtag.js` tracking code from GA4:

1. In GA4 Admin → Data Streams → your stream → **View tag instructions**

2. Copy the `<script>` block provided

3. Paste it into the `<head>` section of every page on your website

```html

<!-- 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.

### Using Google Tag Manager (Recommended for Flexibility)

If you already use Google Tag Manager (GTM):

1. In GTM, create a new **Tag** → **Google Analytics: GA4 Configuration**

2. Enter your Measurement ID

3. Set trigger to **All Pages**

4. Publish the container

This lets you manage all tracking from one place.

Step 3: Verify Installation

1. Open your website in Chrome

2. In GA4, go to **Reports → Realtime**

3. You should see yourself as "1 user in last 30 minutes"

Alternatively, install the **"Tag Assistant"** Chrome extension from Google to verify the tag fires correctly.

Step 4: Set Up Conversions

Tell GA4 what actions matter to your business:

1. Go to **Admin → Events**

2. Find events like `generate_lead` (form submissions) or `purchase`

3. Toggle **"Mark as conversion"**

For custom conversions (like a specific button click), you need Google Tag Manager.

Privacy Compliance (India & GDPR)

If you have European visitors, you need a cookie consent banner. Services like **Cookiebot** or **CookieYes** integrate with GA4 to only load tracking after consent is given.

Check back in 24–48 hours for your first batch of data to appear in GA4 reports.

Was this article helpful? Contact Support
Still need help?

Raise a support ticket or chat with our team.

Get Support