Skip to main content

GA4 Setup Guide

A comprehensive guide to setting up Google Analytics 4 correctly from the start.

Prerequisites

Before starting, ensure you have:

  • [ ] Google Analytics account with Admin access
  • [ ] Google Tag Manager container (recommended)
  • [ ] Access to website/app code (if not using GTM)
  • [ ] List of key business objectives and KPIs

Step 1: Create GA4 Property

In Google Analytics Admin

  1. Navigate to Admin > Create Property
  2. Enter your property name (e.g., "Company Website - Production")
  3. Select your reporting time zone and currency
  4. Choose your industry category and business size
  5. Select your business objectives

Initial Settings

Configure these settings immediately:

| Setting | Recommended Value | Why | |---------|-------------------|-----| | Data Retention | 14 months | Maximum for free GA4 | | Google Signals | Enable | Enables cross-device reporting | | Granular Location | Enable | More detailed geo data | | Ads Personalization | Based on privacy policy | Required for remarketing |

Step 2: Create Data Stream

For web properties:

  1. Go to Admin > Data Streams > Add Stream > Web
  2. Enter your website URL
  3. Name your stream (e.g., "Production Website")
  4. Enable Enhanced Measurement (recommended for most sites)

Enhanced Measurement Options

Review each option:

  • Page views - Always enable
  • Scrolls - Enable for content sites
  • Outbound clicks - Enable to track exit links
  • Site search - Enable if you have site search
  • Video engagement - Enable for YouTube embeds
  • File downloads - Enable to track downloads
  • Form interactions - Enable for form tracking

Step 3: GTM Implementation

Install GA4 via GTM

  1. Create a new tag: Google Tag (GA4 Configuration)
  2. Enter your Measurement ID (G-XXXXXXXXXX)
  3. Set trigger to All Pages
  4. Configure additional settings as needed
// Example: Setting user properties via data layer
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  'user_type': 'premium',
  'account_age_days': 365
});

Configure User Properties

Set up user-scoped dimensions:

  1. In GA4: Admin > Custom Definitions > User Properties
  2. In GTM: Configure in your GA4 Configuration tag

Step 4: Event Tracking

Recommended Events

Implement these based on your site type:

E-commerce

// View item
dataLayer.push({
  event: 'view_item',
  ecommerce: {
    currency: 'USD',
    value: 29.99,
    items: [{
      item_id: 'SKU_12345',
      item_name: 'Product Name',
      item_category: 'Category',
      price: 29.99,
      quantity: 1
    }]
  }
});

Lead Generation

// Form submission
dataLayer.push({
  event: 'generate_lead',
  value: 100,
  currency: 'USD',
  lead_type: 'contact_form'
});

Event Naming Conventions

Follow these rules:

  • Use lowercase with underscores: form_submit, not FormSubmit
  • Be descriptive but concise: newsletter_signup, not ns
  • Use consistent prefixes: video_play, video_pause, video_complete
  • Avoid PII in event names

Step 5: Conversions

Mark Key Events as Conversions

  1. Go to Admin > Conversions
  2. Mark important events as conversions
  3. Typical conversions include:
    • purchase
    • generate_lead
    • sign_up
    • begin_checkout

Conversion Values

Assign values to non-revenue conversions:

| Event | Suggested Value | Rationale | |-------|-----------------|-----------| | Newsletter signup | $5 | Estimated customer value | | Contact form | $50 | Lead value | | Demo request | $100 | Higher intent |

Step 6: Validation

Testing Checklist

  • [ ] Page views firing correctly
  • [ ] Enhanced measurement working
  • [ ] Custom events appearing in DebugView
  • [ ] Conversions marked correctly
  • [ ] User properties being set
  • [ ] No PII being collected
  • [ ] No duplicate events

Debugging Tools

  • GA4 DebugView - Real-time event validation
  • GTM Preview Mode - Tag firing verification
  • Google Tag Assistant - Browser extension for debugging
  • Chrome DevTools - Network tab for raw requests

Common Pitfalls

Avoid these mistakes:

  1. Not setting data retention - Defaults to 2 months
  2. Forgetting to mark conversions - Events must be explicitly marked
  3. Duplicate implementations - Check for gtag.js AND GTM
  4. Missing cross-domain tracking - Configure for multi-domain sites
  5. PII in URLs - Filter or redact sensitive parameters

Next: GTM Best Practices