How to Set Up Google Analytics 4 on Your Website

📊 How to Set Up Google Analytics 4 on Your Website

Google Analytics 4 (GA4) is the newest version of Google’s web analytics platform. It offers advanced tracking, event-based data, and better insights for modern websites.

Whether you’re running a blog, eCommerce store, or company site — GA4 gives you powerful tools to understand your visitors.

Here’s a step-by-step tutorial to get started.


🛠 Step 1: Create a Google Analytics Account

  1. Go to analytics.google.com
  2. Sign in with your Google account.
  3. Click AdminCreate Account
  4. Enter an account name (e.g., “My Website Analytics”)
  5. Choose your data sharing settings.

🌍 Step 2: Create a GA4 Property

  1. Under the account you just created, click + Create Property
  2. Add your website name, select your country/time zone, and currency.
  3. Choose Web for platform type.
  4. Enter your website URL.

GA4 properties are different from Universal Analytics. They use an event-based tracking model for more flexibility.


🏷️ Step 3: Add the GA4 Tracking Code to Your Website

There are two main ways to do this:

🔹 A) With Google Tag Manager (Recommended)

  1. Go to tagmanager.google.com
  2. Create a new container for your website.
  3. Add your GA4 Measurement ID (starts with “G-XXXXXX”)
  4. Publish the container.

🔹 B) Manual Installation

  1. Copy the global site tag from your GA4 property
  2. Paste it in the <head> section of your website

Example:

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

⚙️ Step 4: Verify Tracking Is Working

Use the Realtime report in Google Analytics to verify that page views are being recorded.

Or, install the Google Tag Assistant Chrome extension to check your tag setup.


📈 Step 5: Set Up Conversions and Events

GA4 automatically tracks some events like:

  • Page views
  • Scrolls
  • Outbound clicks
  • Video engagement

But you can set up custom events like:

  • Button clicks
  • Form submissions
  • Purchases

Go to Admin → Events to create and manage custom tracking.


🧠 Bonus Tips

  • Link GA4 to Google Ads for deeper ad tracking
  • Enable Enhanced Measurement for automatic tracking
  • Use Exploration Reports for advanced user behavior analysis
  • Set up Data Retention and User ID tracking if needed

✅ Final Thoughts

Setting up Google Analytics 4 is essential for any modern website in 2025. With its event-based model and machine learning insights, GA4 helps you make data-driven decisions to grow your online presence.