Google Analytics Setup

Complete guide to setting up Google Analytics 4 and implementing essential tracking for your website

Introduction to Google Analytics

Google Analytics is a free web analytics service that tracks and reports website traffic, user behavior, and conversion data. It's essential for understanding how visitors interact with your website and measuring the success of your digital marketing efforts.

Google Analytics 4 (GA4) is the latest version, designed for a privacy-first world with enhanced measurement capabilities across websites and apps.

Google Analytics Usage Statistics

  • Used by 86.1% of all websites with known analytics tools
  • Processes over 1 billion website visits daily
  • Provides insights for over 37 million websites worldwide
  • Universal Analytics will stop processing data on July 1, 2024
  • GA4 offers 14 months of data retention for free accounts

GA4 vs Universal Analytics

Key Differences

Feature Universal Analytics Google Analytics 4 Advantage
Data Model Session-based Event-based More flexible tracking
Cross-Platform Web only Web + App unified Complete customer view
Privacy Basic controls Privacy-first design GDPR/CCPA compliance
Machine Learning Limited Built-in AI insights Predictive metrics
Data Retention Indefinite 14 months (free) Privacy compliance

Why Migrate to GA4

Future-Proof

Universal Analytics stops processing data July 1, 2024. GA4 is the future.

Enhanced Insights

Machine learning provides predictive metrics and automated insights.

Privacy-First

Built for a cookieless future with consent mode and data controls.

Cross-Platform

Unified measurement across websites, apps, and offline touchpoints.

Migration Timeline

Important Deadlines

  • July 1, 2024: Universal Analytics stops processing new data
  • January 1, 2025: Access to Universal Analytics interface ends
  • Now: Set up GA4 to start collecting historical data
  • Recommendation: Run both GA4 and Universal Analytics in parallel during transition

Creating Your Analytics Account

Account Setup Process

1

Visit Google Analytics

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

2

Start Setup

Click "Start measuring" to begin the account creation process.

3

Account Details

Enter your account name (usually your business name).

4

Data Sharing

Choose data sharing settings based on your privacy preferences.

Account Structure

Account Level

Top-level container, typically one per organization or business.

Property Level

Individual websites or apps, can have multiple properties per account.

Data Stream Level

Specific data sources (web, iOS app, Android app) within each property.

Naming Conventions

Best Practices for Naming

  • Account Name: Your business name (e.g., "Evoba Digital Marketing")
  • Property Name: Website or app name (e.g., "Evoba Website")
  • Data Stream: Descriptive source (e.g., "Main Website" or "Mobile App")
  • Consistency: Use consistent naming across all properties
  • Environment: Include environment if applicable (e.g., "Website - Production")

Setting Up Your Property

Property Configuration

Property Name

Choose a descriptive name for your website or app property.

Reporting Time Zone

Select your business time zone for consistent reporting.

Currency

Choose your business currency for e-commerce and revenue reporting.

Industry Category

Select your business category for relevant benchmarks and insights.

Business Size

Choose your business size for appropriate feature recommendations.

Data Stream Setup

Web Stream

For tracking website visitors and interactions across all pages.

iOS App Stream

For tracking user behavior within iOS mobile applications.

Android App Stream

For tracking user behavior within Android mobile applications.

Multiple Streams

Combine multiple data sources for unified cross-platform insights.

Enhanced Measurement

Event Type Description Automatically Tracked Business Value
Page Views When users view pages Yes Content performance
Scrolls 90% page scroll depth Yes Content engagement
Outbound Clicks Clicks to external sites Yes Referral tracking
Site Search Internal search queries Yes User intent
Video Engagement YouTube video interactions Yes Content effectiveness
File Downloads PDF, doc, zip downloads Yes Lead generation

Installing Tracking Code

Implementation Methods

1

Google Tag Manager (Recommended)

Most flexible method for managing multiple tracking codes.

2

Global Site Tag (gtag.js)

Direct implementation for simple setups without tag management.

3

CMS Plugins

WordPress, Shopify, and other platform-specific plugins.

4

Developer Integration

Custom implementation through APIs and measurement protocols.

Google Tag Manager Setup

GTM Implementation Steps

  1. Create GTM Account: Visit tagmanager.google.com and create account
  2. Install GTM Code: Add GTM container code to all website pages
  3. Create GA4 Tag: Add Google Analytics 4 Configuration tag
  4. Set Measurement ID: Use your GA4 Measurement ID (G-XXXXXXXXXX)
  5. Configure Trigger: Set to fire on "All Pages" for basic tracking
  6. Publish Container: Submit and publish your GTM container
  7. Verify Installation: Test tracking using GA4 Real-time reports

Direct gtag.js Installation

HTML Code Implementation

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

Placement: Add this code to the <head> section of every page on your website.

Note: Replace "G-XXXXXXXXXX" with your actual GA4 Measurement ID.

WordPress Installation

Site Kit by Google

Official Google plugin for easy Analytics integration.

MonsterInsights

Popular WordPress analytics plugin with advanced features.

Manual Theme Edit

Add tracking code directly to theme header.php file.

Header/Footer Scripts

Use plugins to insert tracking code without theme editing.

Basic Configuration

Essential Settings

Data Retention

Set how long user and event data is retained (2-14 months).

Google Signals

Enable for cross-device reporting and audience insights.

Enhanced Measurement

Configure automatic event tracking for common interactions.

Search Console Linking

Connect Google Search Console for organic search data.

User Permissions

Permission Level Access Rights Best For Recommended Users
Administrator Full access, user management Account owners Business owners, IT managers
Editor Configure settings, no user management Analytics managers Marketing managers, analysts
Analyst View reports, create audiences Data analysis Marketing team, consultants
Viewer View reports only Stakeholders Executives, clients

Data Filters & Exclusions

Internal Traffic Filter

Exclude your business IP addresses from analytics data.

Developer Traffic

Filter out staging and development environment traffic.

Bot Filtering

Enable automatic bot and spider filtering in data settings.

Referrer Spam

Create filters to exclude known referrer spam sources.

Goals & Conversions

Conversion Events

1

Identify Key Actions

Determine which user actions represent business value.

2

Mark as Conversions

Toggle the conversion switch for important events.

3

Set Values

Assign monetary values to conversions when possible.

4

Create Custom Events

Track specific business actions not covered by default events.

Common Conversion Types

E-commerce

Purchases, add to cart, begin checkout events for online stores.

Lead Generation

Form submissions, quote requests, contact inquiries.

Content Engagement

Newsletter signups, content downloads, video completions.

Service Bookings

Appointment scheduling, service requests, consultations.

Custom Event Setup

Creating Custom Events

Method 1: Google Tag Manager

  1. Create new tag in GTM with event name and parameters
  2. Set trigger conditions (button clicks, form submissions, etc.)
  3. Test and publish the container
  4. Mark event as conversion in GA4 interface

Method 2: gtag.js Code

gtag('event', 'contact_form_submit', {
  'event_category': 'Lead Generation',
  'event_label': 'Contact Page',
  'value': 50
});

Audience Configuration

Default Audiences

All Users

Every user who visits your website during the selected time period.

Purchasers

Users who completed purchase events (requires e-commerce tracking).

Non-Purchasers

Users who visited but didn't complete any purchase events.

Revenue Generators

Users whose sessions generated revenue for your business.

Custom Audience Examples

Audience Type Conditions Use Case Marketing Application
High-Value Visitors Session duration > 3 minutes Engaged users Retargeting campaigns
Cart Abandoners Add to cart but no purchase Recovery campaigns Email remarketing
Repeat Customers Purchase count > 1 Loyalty programs Upsell campaigns
Mobile Users Device category = mobile Mobile optimization Mobile-specific ads

Audience Building Best Practices

Effective Audience Strategy

  • Start Simple: Begin with basic demographic and behavioral audiences
  • Business Relevance: Create audiences that align with marketing goals
  • Sufficient Size: Ensure audiences have enough users for statistical significance
  • Regular Review: Update audience definitions as business needs change
  • Test Performance: Compare audience performance in marketing campaigns
  • Privacy Compliance: Respect user privacy and consent preferences

E-commerce Tracking

Enhanced E-commerce Events

Purchase

Track completed transactions with revenue and product details.

Add to Cart

Monitor when users add products to their shopping cart.

Begin Checkout

Track when users start the checkout process.

View Item

Monitor product page views and user interest.

E-commerce Implementation

1

Enable E-commerce

Turn on Enhanced e-commerce in your GA4 property settings.

2

Implement Events

Add e-commerce event tracking to your website or app.

3

Test Tracking

Verify events are firing correctly using DebugView.

4

Validate Data

Compare GA4 revenue data with your actual sales records.

E-commerce Event Code Example

Purchase Event Implementation

gtag('event', 'purchase', {
  'transaction_id': '12345',
  'value': 25.42,
  'currency': 'USD',
  'items': [{
    'item_id': 'SKU123',
    'item_name': 'Product Name',
    'category': 'Category',
    'quantity': 1,
    'price': 25.42
  }]
});

Key Parameters:

  • transaction_id: Unique identifier for the purchase
  • value: Total transaction value
  • currency: Currency code (USD, EUR, etc.)
  • items: Array of purchased products with details

Verification & Testing

Testing Methods

Real-time Reports

Check if your visits appear in GA4 real-time reporting.

DebugView

Use GA4 DebugView to see detailed event tracking information.

Google Tag Assistant

Browser extension to verify Google tag implementation.

GA4 Assistant

Chrome extension specifically for GA4 debugging and validation.

Common Issues & Solutions

Issue Symptoms Common Causes Solution
No Data Empty reports Missing tracking code Verify code installation
Duplicate Data Inflated numbers Multiple tracking codes Remove duplicate implementations
Missing Events Low conversion counts Incorrect event setup Check event implementation
Wrong Revenue Incorrect e-commerce data Currency or value errors Validate e-commerce code

Validation Checklist

GA4 Setup Verification

  • ✓ Tracking code installed on all pages
  • ✓ Real-time data showing current visitors
  • ✓ Page view events firing correctly
  • ✓ Conversion events marked and tracking
  • ✓ E-commerce events (if applicable) working
  • ✓ Internal traffic filtered out
  • ✓ Search Console linked
  • ✓ User permissions configured
  • ✓ Data retention settings configured
  • ✓ Audiences created for marketing use

Privacy & Compliance

GDPR & Privacy Regulations

Consent Mode

Respect user consent choices while maintaining measurement quality.

IP Anonymization

GA4 automatically anonymizes IP addresses for privacy protection.

Data Deletion

Automatically delete user data based on retention settings.

User Rights

Support user requests for data access and deletion.

Consent Mode Implementation

Basic Consent Mode Setup

// Default consent state
gtag('consent', 'default', {
  'analytics_storage': 'denied',
  'ad_storage': 'denied'
});

// Update consent when user accepts
gtag('consent', 'update', {
  'analytics_storage': 'granted',
  'ad_storage': 'granted'
});

Benefits of Consent Mode:

  • Maintains some measurement without cookies
  • Respects user privacy preferences
  • Provides conversion modeling for consented users
  • Helps with regulatory compliance

Privacy Best Practices

Privacy Policy

Update your privacy policy to mention Google Analytics usage.

Cookie Notice

Implement cookie consent banners where required by law.

Data Processing Agreement

Review and accept Google's data processing terms.

Regular Audits

Periodically review data collection and retention practices.

Next Steps & Best Practices

Ongoing Optimization

1

Regular Monitoring

Check analytics data weekly for trends and anomalies.

2

Goal Refinement

Update conversion goals as your business evolves.

3

Advanced Features

Explore attribution modeling, funnel analysis, and cohort reports.

4

Integration Expansion

Connect Google Ads, Search Console, and other marketing tools.

Common Mistakes to Avoid

❌ Set and Forget

Analytics requires ongoing attention and optimization.

❌ Too Many Goals

Focus on 3-5 key conversions that matter most to your business.

❌ Ignoring Data Quality

Regularly audit data for accuracy and filter out irrelevant traffic.

❌ No Testing

Always test tracking implementation before going live.

❌ Privacy Neglect

Stay compliant with privacy regulations and user expectations.

Advanced Learning Path

What to Learn Next

  1. Custom Dimensions & Metrics: Track business-specific data points
  2. Attribution Modeling: Understand multi-channel customer journeys
  3. Looker Studio: Create custom dashboards and reports
  4. BigQuery Export: Advanced data analysis and machine learning
  5. Measurement Protocol: Server-side tracking for offline events
  6. GA4 API: Automated reporting and data integration

Key Takeaways

  • GA4 is the future of Google Analytics - migrate from Universal Analytics before July 2024
  • Proper setup includes account structure, tracking code installation, and goal configuration
  • Enhanced measurement automatically tracks common events like scrolls and downloads
  • Conversion events should align with your business objectives and have monetary values
  • E-commerce tracking provides detailed insights into customer purchase behavior
  • Privacy compliance is essential - implement consent mode and respect user choices
  • Regular testing and validation ensures data accuracy and reliability
  • Audiences enable better marketing targeting and campaign optimization
  • Ongoing monitoring and optimization maximize analytics value for your business
  • Start simple and gradually add complexity as you become more comfortable with GA4

Get Your Analytics Setup Right

Proper Google Analytics setup is the foundation of data-driven marketing. Start tracking your website performance and user behavior today.

Explore More Analytics Guides Get Analytics Setup Help