📊 Google Analytics 4 (GA4) Setup Guide

⚠️ Required: Google Analytics Account

You need to create a Google Analytics account first. This guide will walk you through the entire process.

Step 1: Create Google Analytics Account

  1. Go to analytics.google.com
  2. Click "Start measuring"
  3. Enter account name: Haircut.info
  4. Configure data sharing settings (recommended: keep defaults)
  5. Click "Next"

Step 2: Set Up Property

  1. Property name: Haircut.info Website
  2. Time zone: Your local timezone
  3. Currency: USD
  4. Click "Next"
  5. Business information:
    • Industry: Beauty & Fitness
    • Business size: Small
  6. Business objectives: Select all that apply:
    • Generate leads
    • Examine user behavior
    • Drive online sales (for affiliate)

Step 3: Create Data Stream

  1. Platform: Web
  2. Website URL: https://haircut.info
  3. Stream name: Main Website
  4. Enhanced measurement: Keep enabled (tracks scrolls, clicks, etc.)
  5. Click "Create stream"

Step 4: Get Your Measurement ID

After creating the stream, you'll see a Measurement ID that looks like: G-XXXXXXXXXX

Copy this ID - you'll need it for the next step.

Step 5: Add GA4 Code to Your Website

Add this code to EVERY HTML page, right after the <head> tag:

<!-- Google Analytics 4 --> <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', { page_path: window.location.pathname, }); </script> <!-- End Google Analytics 4 -->

⚠️ Replace G-XXXXXXXXXX with your actual Measurement ID

Step 6: Enhanced Ecommerce Tracking (For Affiliate Links)

Add this enhanced tracking code to track affiliate link clicks:

<script> // Track affiliate link clicks document.addEventListener('DOMContentLoaded', function() { // Find all Amazon affiliate links const affiliateLinks = document.querySelectorAll('a[href*="amazon.com"]'); affiliateLinks.forEach(link => { link.addEventListener('click', function() { // Send event to GA4 gtag('event', 'affiliate_click', { 'affiliate_network': 'Amazon', 'item_name': this.closest('.card')?.querySelector('h3')?.textContent || 'Unknown', 'link_url': this.href, 'page_location': window.location.pathname }); }); }); // Track scroll depth let scrollDepths = [25, 50, 75, 90]; let scrolled = []; window.addEventListener('scroll', function() { let scrollPercent = (window.scrollY + window.innerHeight) / document.body.scrollHeight * 100; scrollDepths.forEach(depth => { if (scrollPercent >= depth && !scrolled.includes(depth)) { gtag('event', 'scroll', { 'percent_scrolled': depth, 'page_location': window.location.pathname }); scrolled.push(depth); } }); }); // Track time on page let startTime = Date.now(); window.addEventListener('beforeunload', function() { let timeSpent = Math.round((Date.now() - startTime) / 1000); gtag('event', 'time_on_page', { 'time_seconds': timeSpent, 'page_location': window.location.pathname }); }); }); </script>

Step 7: Set Up Conversions

In Google Analytics, mark these events as conversions:

  1. Go to Admin → Events
  2. Find "affiliate_click" event
  3. Toggle "Mark as conversion"
  4. Repeat for other important events:
    • scroll (90% depth)
    • file_download (if you add PDFs)
    • form_submit (when contact form is ready)

Step 8: Create Custom Audiences

Set up audiences for remarketing:

  1. Go to Admin → Audiences
  2. Create new audience
  3. Suggested audiences:
    • Engaged Users: Time on site > 60 seconds
    • Affiliate Clickers: Users who clicked affiliate links
    • High Intent: Viewed 3+ haircut guides
    • Tool Shoppers: Visited tools page

Step 9: Connect to Google Search Console

  1. Go to Google Search Console
  2. Add property: https://haircut.info
  3. Verify using Google Analytics method
  4. In GA4: Admin → Product Links → Search Console
  5. Link the properties

Step 10: Set Up Reports

Create custom reports to track performance:

  1. Content Performance:
    • Pages and screens report
    • Sort by views, engagement rate
  2. Affiliate Performance:
    • Events → affiliate_click
    • Track which products get most clicks
  3. User Acquisition:
    • Acquisition → User acquisition
    • See which channels drive traffic

✅ Testing Your Setup

  1. Install GA Debugger Chrome Extension
  2. Visit your website with debugger enabled
  3. Open Chrome DevTools Console
  4. Look for "Sending Google Analytics Event" messages
  5. In GA4, go to Reports → Realtime
  6. You should see yourself as an active user

Key Metrics to Track

Monthly Action Items

🔒 Privacy Compliance

Since you have a Privacy Policy, make sure it mentions: