Initial commit
This commit is contained in:
527
skills/ga4-setup/references/data-streams-configuration.md
Normal file
527
skills/ga4-setup/references/data-streams-configuration.md
Normal file
@@ -0,0 +1,527 @@
|
||||
# Data Streams Configuration Guide
|
||||
|
||||
Complete reference for configuring GA4 data streams for web, iOS, and Android platforms.
|
||||
|
||||
## Overview
|
||||
|
||||
Data streams are platform-specific tracking configurations that collect and send data to your GA4 property. Each data stream receives a unique Measurement ID used in implementation.
|
||||
|
||||
## Data Stream Types
|
||||
|
||||
### Web Data Stream
|
||||
- **Platform**: Websites
|
||||
- **Measurement ID Format**: G-XXXXXXXXXX
|
||||
- **Installation Methods**: gtag.js, GTM, CMS plugins
|
||||
- **Enhanced Measurement**: Available
|
||||
|
||||
### iOS Data Stream
|
||||
- **Platform**: Apple iOS applications
|
||||
- **Measurement ID Format**: G-XXXXXXXXXX
|
||||
- **Installation Methods**: Firebase SDK
|
||||
- **Additional Setup**: Firebase project integration
|
||||
|
||||
### Android Data Stream
|
||||
- **Platform**: Android applications
|
||||
- **Measurement ID Format**: G-XXXXXXXXXX
|
||||
- **Installation Methods**: Firebase SDK
|
||||
- **Additional Setup**: Firebase project integration
|
||||
|
||||
## Creating a Web Data Stream
|
||||
|
||||
### Step-by-Step Process
|
||||
|
||||
**Step 1: Navigate to Data Streams**
|
||||
|
||||
1. GA4 Property → Admin
|
||||
2. Under "Property" column → Data Streams
|
||||
3. Click "Add Stream"
|
||||
4. Select "Web"
|
||||
|
||||
**Step 2: Configure Stream Details**
|
||||
|
||||
**Website URL**:
|
||||
- Enter primary domain: `example.com`
|
||||
- Do not include `https://` or `www`
|
||||
- Example: `example.com` not `https://www.example.com`
|
||||
|
||||
**Stream Name**:
|
||||
- Descriptive identifier for internal use
|
||||
- Example: "Main Website" or "E-commerce Site"
|
||||
- Shows in Data Streams list
|
||||
|
||||
**Step 3: Enhanced Measurement**
|
||||
|
||||
Toggle Enhanced Measurement:
|
||||
- **Recommended**: ON (enabled)
|
||||
- Automatically tracks common interactions
|
||||
- Can customize which events to collect
|
||||
|
||||
**Enhanced Measurement Events**:
|
||||
- Page views (cannot disable)
|
||||
- Scrolls (90% depth)
|
||||
- Outbound clicks
|
||||
- Site search
|
||||
- Video engagement (YouTube)
|
||||
- File downloads
|
||||
- Form interactions
|
||||
|
||||
**Step 4: Create Stream**
|
||||
|
||||
Click "Create stream" button
|
||||
|
||||
**Result**:
|
||||
- Data stream created
|
||||
- Unique Measurement ID generated (G-XXXXXXXXXX)
|
||||
- Installation instructions available
|
||||
|
||||
### Web Data Stream Settings
|
||||
|
||||
After creation, access stream settings:
|
||||
|
||||
**Navigate**: Admin → Data Streams → Click your web stream
|
||||
|
||||
**Available Settings**:
|
||||
|
||||
#### 1. Stream Details
|
||||
- Stream name (editable)
|
||||
- Stream ID (read-only)
|
||||
- Measurement ID (read-only, copy for installation)
|
||||
- Website URL (editable)
|
||||
- Enhanced Measurement toggle
|
||||
|
||||
#### 2. Enhanced Measurement Configuration
|
||||
|
||||
Click gear icon to customize:
|
||||
|
||||
**Page views**:
|
||||
- Always collected (cannot disable)
|
||||
- Triggers on: Page load, history changes
|
||||
- Parameters: page_location, page_referrer, page_title
|
||||
|
||||
**Scrolls**:
|
||||
- Toggle: ON/OFF
|
||||
- Trigger: 90% vertical scroll depth (first time only)
|
||||
- Event name: `scroll`
|
||||
|
||||
**Outbound clicks**:
|
||||
- Toggle: ON/OFF
|
||||
- Trigger: Click to different domain
|
||||
- Event name: `click`
|
||||
- Parameters: link_url, link_domain, outbound=true
|
||||
|
||||
**Site search**:
|
||||
- Toggle: ON/OFF
|
||||
- Auto-detects common query parameters (q, s, search, query)
|
||||
- Event name: `view_search_results`
|
||||
- Parameters: search_term
|
||||
|
||||
**Video engagement**:
|
||||
- Toggle: ON/OFF
|
||||
- Platform: YouTube embedded videos only
|
||||
- Events: `video_start`, `video_progress`, `video_complete`
|
||||
- Parameters: video_title, video_url, video_duration, video_percent
|
||||
|
||||
**File downloads**:
|
||||
- Toggle: ON/OFF
|
||||
- Auto-detects: .pdf, .xlsx, .docx, .txt, .csv, .zip, etc.
|
||||
- Event name: `file_download`
|
||||
- Parameters: file_name, file_extension, link_url
|
||||
|
||||
**Form interactions**:
|
||||
- Toggle: ON/OFF
|
||||
- Events: `form_start` (first interaction), `form_submit`
|
||||
- Parameters: form_id, form_name, form_destination
|
||||
|
||||
#### 3. Tagging Instructions
|
||||
|
||||
**View tag instructions** button provides:
|
||||
- Installation code snippets
|
||||
- GTM setup guidance
|
||||
- Platform-specific instructions
|
||||
|
||||
#### 4. Configure Tag Settings
|
||||
|
||||
Advanced gtag.js configuration options
|
||||
|
||||
#### 5. More Tagging Settings
|
||||
|
||||
**Cross-domain Measurement**:
|
||||
- Configure domains for cross-domain tracking
|
||||
- List all domains to track as single session
|
||||
- Format: `example.com,shop.example.com`
|
||||
|
||||
**Ignore Internal Traffic**:
|
||||
- Define IP ranges for internal traffic
|
||||
- Create rules to filter office/test traffic
|
||||
- Traffic tagged as "internal" in reports
|
||||
|
||||
**List Unwanted Referrals**:
|
||||
- Exclude payment processors, login pages
|
||||
- Prevents session breaks from expected referrals
|
||||
- Example: `paypal.com,stripe.com`
|
||||
|
||||
#### 6. Measurement Protocol API Secrets
|
||||
|
||||
Generate API secrets for:
|
||||
- Server-side event tracking
|
||||
- Measurement Protocol implementations
|
||||
- Secure server-to-server communication
|
||||
|
||||
**Create API Secret**:
|
||||
1. Click "Create"
|
||||
2. Enter secret nickname
|
||||
3. Copy secret value (shown once only)
|
||||
4. Store securely
|
||||
|
||||
## Creating an iOS Data Stream
|
||||
|
||||
### Prerequisites
|
||||
|
||||
**Required**:
|
||||
- Apple Developer account
|
||||
- iOS app published or in development
|
||||
- Firebase project (auto-created if needed)
|
||||
|
||||
### Setup Process
|
||||
|
||||
**Step 1: Add Stream**
|
||||
|
||||
1. Admin → Data Streams
|
||||
2. Click "Add Stream"
|
||||
3. Select "iOS app"
|
||||
|
||||
**Step 2: Configure App Details**
|
||||
|
||||
**Bundle ID**:
|
||||
- Format: `com.company.appname`
|
||||
- Must match Xcode project bundle identifier
|
||||
- Example: `com.acme.myapp`
|
||||
|
||||
**App Store ID** (Optional):
|
||||
- Found in App Store Connect
|
||||
- Format: Numeric ID
|
||||
- Example: `1234567890`
|
||||
|
||||
**App Name**:
|
||||
- Descriptive name for internal use
|
||||
- Example: "Acme Mobile App (iOS)"
|
||||
|
||||
**Step 3: Register App**
|
||||
|
||||
Click "Register app"
|
||||
|
||||
**Result**:
|
||||
- Firebase project created (if didn't exist)
|
||||
- Data stream created
|
||||
- Measurement ID assigned
|
||||
|
||||
### iOS Firebase Configuration
|
||||
|
||||
**Step 4: Download Config File**
|
||||
|
||||
1. Download `GoogleService-Info.plist`
|
||||
2. Add to Xcode project root
|
||||
3. Ensure file included in app target
|
||||
|
||||
**Step 5: Add Firebase SDK**
|
||||
|
||||
**Using CocoaPods**:
|
||||
|
||||
```ruby
|
||||
# Podfile
|
||||
pod 'Firebase/Analytics'
|
||||
```
|
||||
|
||||
**Using Swift Package Manager**:
|
||||
|
||||
Add Firebase package:
|
||||
```
|
||||
https://github.com/firebase/firebase-ios-sdk
|
||||
```
|
||||
|
||||
**Step 6: Initialize Firebase**
|
||||
|
||||
In `AppDelegate.swift`:
|
||||
|
||||
```swift
|
||||
import Firebase
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
func application(_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
FirebaseApp.configure()
|
||||
return true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Step 7: Verify Installation**
|
||||
|
||||
Run app and check:
|
||||
- Xcode console for Firebase initialization
|
||||
- GA4 DebugView (enable debug mode in Xcode scheme)
|
||||
- Realtime reports in GA4
|
||||
|
||||
## Creating an Android Data Stream
|
||||
|
||||
### Prerequisites
|
||||
|
||||
**Required**:
|
||||
- Android Studio
|
||||
- Android app package name
|
||||
- Firebase project (auto-created if needed)
|
||||
|
||||
### Setup Process
|
||||
|
||||
**Step 1: Add Stream**
|
||||
|
||||
1. Admin → Data Streams
|
||||
2. Click "Add Stream"
|
||||
3. Select "Android app"
|
||||
|
||||
**Step 2: Configure App Details**
|
||||
|
||||
**Package Name**:
|
||||
- Format: `com.company.appname`
|
||||
- Must match AndroidManifest.xml package
|
||||
- Example: `com.acme.myapp`
|
||||
|
||||
**App Name**:
|
||||
- Descriptive name for internal use
|
||||
- Example: "Acme Mobile App (Android)"
|
||||
|
||||
**Step 3: Register App**
|
||||
|
||||
Click "Register app"
|
||||
|
||||
**Result**:
|
||||
- Firebase project created (if didn't exist)
|
||||
- Data stream created
|
||||
- Measurement ID assigned
|
||||
|
||||
### Android Firebase Configuration
|
||||
|
||||
**Step 4: Download Config File**
|
||||
|
||||
1. Download `google-services.json`
|
||||
2. Place in `app/` directory
|
||||
3. Ensure file in version control
|
||||
|
||||
**Step 5: Add Firebase SDK**
|
||||
|
||||
**Project-level build.gradle**:
|
||||
|
||||
```gradle
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath 'com.google.gms:google-services:4.3.15'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**App-level build.gradle**:
|
||||
|
||||
```gradle
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'com.google.gms.google-services'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation platform('com.google.firebase:firebase-bom:32.0.0')
|
||||
implementation 'com.google.firebase:firebase-analytics'
|
||||
}
|
||||
```
|
||||
|
||||
**Step 6: Initialize Firebase**
|
||||
|
||||
Firebase initializes automatically when app starts (no code needed)
|
||||
|
||||
**Step 7: Verify Installation**
|
||||
|
||||
Run app and check:
|
||||
- Logcat for Firebase initialization
|
||||
- GA4 DebugView (debug mode enabled via ADB)
|
||||
- Realtime reports in GA4
|
||||
|
||||
## Data Stream Management
|
||||
|
||||
### Viewing All Data Streams
|
||||
|
||||
**Navigate**: Admin → Data Streams
|
||||
|
||||
**List Shows**:
|
||||
- Stream name
|
||||
- Platform type (Web, iOS, Android)
|
||||
- Stream ID
|
||||
- Status (Active/Inactive)
|
||||
|
||||
### Editing Data Stream
|
||||
|
||||
Click stream name to access settings:
|
||||
- Modify stream name
|
||||
- Update website URL (web only)
|
||||
- Configure Enhanced Measurement (web only)
|
||||
- Manage cross-domain tracking
|
||||
- Create API secrets
|
||||
- View tagging instructions
|
||||
|
||||
### Deleting Data Stream
|
||||
|
||||
**Warning**: Cannot be undone; historical data retained but no new data collected
|
||||
|
||||
**Steps**:
|
||||
1. Click stream name
|
||||
2. Top-right: More (three dots) → Remove this stream
|
||||
3. Confirm deletion
|
||||
|
||||
**Use Cases for Deletion**:
|
||||
- Decommissioned website/app
|
||||
- Test stream no longer needed
|
||||
- Consolidating tracking
|
||||
|
||||
## Multiple Data Streams Strategy
|
||||
|
||||
### When to Use Multiple Streams
|
||||
|
||||
**Same Property, Multiple Streams**:
|
||||
- Main website + mobile site
|
||||
- Main website + blog subdomain
|
||||
- iOS app + Android app
|
||||
- Different platforms for same business
|
||||
|
||||
**Benefits**:
|
||||
- Combined reporting
|
||||
- Shared custom definitions
|
||||
- Unified conversion tracking
|
||||
- Cross-platform user journeys
|
||||
|
||||
### Stream Naming Best Practices
|
||||
|
||||
Use clear, descriptive names:
|
||||
|
||||
**Good Examples**:
|
||||
- "Main Website (example.com)"
|
||||
- "iOS App (Production)"
|
||||
- "Android App (Production)"
|
||||
- "Mobile Site (m.example.com)"
|
||||
|
||||
**Bad Examples**:
|
||||
- "Website 1"
|
||||
- "Stream"
|
||||
- "Test"
|
||||
|
||||
## Measurement ID Reference
|
||||
|
||||
### Format & Location
|
||||
|
||||
**Format**: G-XXXXXXXXXX
|
||||
- G- prefix (identifies GA4)
|
||||
- 10 alphanumeric characters
|
||||
- Case-sensitive
|
||||
|
||||
**Where to Find**:
|
||||
1. Admin → Data Streams
|
||||
2. Click stream name
|
||||
3. Top-right: Measurement ID displayed
|
||||
4. Click copy icon to copy
|
||||
|
||||
### Using Measurement IDs
|
||||
|
||||
**gtag.js Installation**:
|
||||
```html
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
|
||||
```
|
||||
|
||||
**GTM Configuration**:
|
||||
- Tag Type: Google Tag
|
||||
- Tag ID: G-XXXXXXXXXX
|
||||
|
||||
**Measurement Protocol**:
|
||||
- Query parameter: `measurement_id=G-XXXXXXXXXX`
|
||||
|
||||
## Common Data Stream Issues
|
||||
|
||||
### Issue: Wrong Platform Type Selected
|
||||
|
||||
**Problem**: Created web stream but need app stream (or vice versa)
|
||||
|
||||
**Solution**:
|
||||
- Cannot change platform type
|
||||
- Delete stream and create correct type
|
||||
- Historical data from deleted stream retained
|
||||
|
||||
### Issue: Cannot Find Measurement ID
|
||||
|
||||
**Solution**:
|
||||
1. Admin → Data Streams
|
||||
2. Click stream name
|
||||
3. Top section shows Measurement ID
|
||||
4. Use copy icon
|
||||
|
||||
### Issue: Enhanced Measurement Not Working
|
||||
|
||||
**Checklist**:
|
||||
- Is Enhanced Measurement toggle ON?
|
||||
- Which specific event not working?
|
||||
- Check event-specific toggle
|
||||
- For file downloads: is file extension in default list?
|
||||
- For site search: are query parameters standard (q, s, search)?
|
||||
- For video: is video embedded YouTube with JS API enabled?
|
||||
|
||||
### Issue: Multiple Measurement IDs
|
||||
|
||||
**Scenario**: Have multiple Measurement IDs, unsure which to use
|
||||
|
||||
**Solution**:
|
||||
- Check Data Streams list
|
||||
- Match stream name to your platform
|
||||
- Use correct ID for correct platform
|
||||
- Don't mix IDs (don't use web ID for app)
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
### Debug Mode for App Streams
|
||||
|
||||
**iOS Debug Mode**:
|
||||
- Xcode scheme argument: `-FIRDebugEnabled`
|
||||
- Events visible in DebugView
|
||||
|
||||
**Android Debug Mode**:
|
||||
```bash
|
||||
adb shell setprop debug.firebase.analytics.app com.example.app
|
||||
```
|
||||
|
||||
### Stream ID vs Measurement ID
|
||||
|
||||
**Stream ID**:
|
||||
- Numeric identifier
|
||||
- Format: 1234567890
|
||||
- Used in APIs
|
||||
- Internal reference
|
||||
|
||||
**Measurement ID**:
|
||||
- G-XXXXXXXXXX format
|
||||
- Used in tracking code
|
||||
- Public-facing identifier
|
||||
- Implementation key
|
||||
|
||||
## Next Steps
|
||||
|
||||
After configuring data streams:
|
||||
|
||||
1. **Install Tracking Code** (see installation-methods.md)
|
||||
2. **Verify Installation** (see verification-checklist.md)
|
||||
3. **Configure Internal Traffic Filters**
|
||||
4. **Set Up Cross-Domain Tracking** (if needed)
|
||||
5. **Create Custom Events**
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- Official Google: Web Stream Setup
|
||||
- Official Google: iOS Stream Setup
|
||||
- Official Google: Android Stream Setup
|
||||
- Official Google: Enhanced Measurement Events
|
||||
- Firebase Documentation: iOS SDK
|
||||
- Firebase Documentation: Android SDK
|
||||
619
skills/ga4-setup/references/installation-methods.md
Normal file
619
skills/ga4-setup/references/installation-methods.md
Normal file
@@ -0,0 +1,619 @@
|
||||
# GA4 Installation Methods Complete Guide
|
||||
|
||||
Comprehensive guide covering all three GA4 installation methods with code examples and platform-specific instructions.
|
||||
|
||||
## Installation Method Comparison
|
||||
|
||||
### Quick Decision Matrix
|
||||
|
||||
| Method | Best For | Technical Level | Flexibility | Maintenance |
|
||||
|--------|----------|----------------|-------------|-------------|
|
||||
| **CMS Plugin** | WordPress, Shopify, Wix | Beginner | Low | Low effort |
|
||||
| **gtag.js** | Developers, custom sites | Intermediate | Medium | Code changes |
|
||||
| **Google Tag Manager** | Most websites, teams | Beginner-Advanced | High | No code changes |
|
||||
|
||||
### When to Use Each Method
|
||||
|
||||
**Use CMS Plugin When**:
|
||||
- Using popular CMS (WordPress, Shopify, Wix, Squarespace)
|
||||
- Want click-and-configure setup
|
||||
- No technical expertise required
|
||||
- Single tracking platform (GA4 only)
|
||||
|
||||
**Use gtag.js When**:
|
||||
- Have code access to website
|
||||
- Only need Google products (GA4, Google Ads)
|
||||
- Want lightweight implementation
|
||||
- Comfortable editing HTML/JavaScript
|
||||
|
||||
**Use Google Tag Manager When**:
|
||||
- Need multiple tracking tags
|
||||
- Want flexibility without code changes
|
||||
- Team collaboration required
|
||||
- Need testing/version control
|
||||
- Plan to add more tags later
|
||||
- **Recommended for 90% of websites**
|
||||
|
||||
## Method 1: CMS Plugin Installation
|
||||
|
||||
### WordPress Installation
|
||||
|
||||
**Recommended Plugins**:
|
||||
- **Site Kit by Google** (Official Google plugin)
|
||||
- **GA Google Analytics** (MonsterInsights)
|
||||
- **ExactMetrics** (formerly GoogleAnalytics by Yoast)
|
||||
- **Insert Headers and Footers** (manual code injection)
|
||||
|
||||
#### Site Kit by Google (Recommended)
|
||||
|
||||
**Step 1: Install Plugin**
|
||||
|
||||
1. WordPress Admin → Plugins → Add New
|
||||
2. Search "Site Kit by Google"
|
||||
3. Click "Install Now"
|
||||
4. Click "Activate"
|
||||
|
||||
**Step 2: Connect Google Account**
|
||||
|
||||
1. Site Kit → Start Setup
|
||||
2. Sign in with Google Account (must have GA4 access)
|
||||
3. Allow Site Kit permissions
|
||||
|
||||
**Step 3: Configure Analytics**
|
||||
|
||||
1. Site Kit will detect existing GA4 properties
|
||||
2. Select property to connect, or create new
|
||||
3. If creating new:
|
||||
- Enter website URL
|
||||
- Select timezone
|
||||
- Confirm settings
|
||||
4. Activate Analytics module
|
||||
|
||||
**Step 4: Verify Installation**
|
||||
|
||||
1. Site Kit dashboard shows Analytics data
|
||||
2. Check GA4 Realtime reports
|
||||
3. Confirm events appearing
|
||||
|
||||
**Benefits**:
|
||||
- Official Google plugin
|
||||
- Automatic updates
|
||||
- Shows data in WordPress dashboard
|
||||
- Easy setup wizard
|
||||
|
||||
#### MonsterInsights/ExactMetrics
|
||||
|
||||
**Installation**:
|
||||
1. Install plugin from WordPress repository
|
||||
2. Activate plugin
|
||||
3. Run setup wizard
|
||||
4. Connect Google Account
|
||||
5. Select GA4 property
|
||||
6. Configure tracking options
|
||||
|
||||
**Features**:
|
||||
- Enhanced ecommerce tracking (premium)
|
||||
- Form tracking
|
||||
- User-friendly dashboard
|
||||
- Popular posts widget
|
||||
|
||||
### Shopify Installation
|
||||
|
||||
**Native Integration (Recommended)**:
|
||||
|
||||
**Step 1: Access Settings**
|
||||
|
||||
1. Shopify Admin → Settings
|
||||
2. Click "Customer events"
|
||||
|
||||
**Step 2: Add GA4**
|
||||
|
||||
1. Click "Add custom pixel"
|
||||
2. Select "Google Analytics 4"
|
||||
3. Enter Measurement ID (G-XXXXXXXXXX)
|
||||
4. Name pixel (e.g., "GA4 Tracking")
|
||||
5. Save
|
||||
|
||||
**Step 3: Verify**
|
||||
|
||||
1. Preview store
|
||||
2. Check GA4 DebugView
|
||||
3. Confirm page views and events
|
||||
|
||||
**Manual Installation (Advanced)**:
|
||||
|
||||
**Step 1: Access Theme Code**
|
||||
|
||||
1. Online Store → Themes
|
||||
2. Actions → Edit code
|
||||
3. Open `theme.liquid`
|
||||
|
||||
**Step 2: Add gtag.js**
|
||||
|
||||
Insert before `</head>`:
|
||||
|
||||
```liquid
|
||||
<!-- 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>
|
||||
```
|
||||
|
||||
**Step 3: Save and Publish**
|
||||
|
||||
### Wix Installation
|
||||
|
||||
**Step 1: Access Tracking & Analytics**
|
||||
|
||||
1. Wix Dashboard → Settings
|
||||
2. Marketing & SEO → Marketing Integrations
|
||||
3. Google Analytics
|
||||
|
||||
**Step 2: Connect GA4**
|
||||
|
||||
1. Click "Connect"
|
||||
2. Choose "Connect to existing account"
|
||||
3. Sign in to Google
|
||||
4. Select GA4 property
|
||||
5. Click "Connect"
|
||||
|
||||
**Step 3: Configure Settings**
|
||||
|
||||
1. Enable "Track events"
|
||||
2. Select events to track
|
||||
3. Save settings
|
||||
|
||||
**Alternative: Manual Installation**
|
||||
|
||||
1. Settings → Custom Code
|
||||
2. Add code to "Header"
|
||||
3. Paste gtag.js snippet
|
||||
4. Apply to all pages
|
||||
|
||||
### Squarespace Installation
|
||||
|
||||
**Step 1: Access Analytics**
|
||||
|
||||
1. Settings → Analytics
|
||||
2. Google Analytics
|
||||
|
||||
**Step 2: Add Measurement ID**
|
||||
|
||||
1. Select "Google Analytics 4"
|
||||
2. Enter Measurement ID
|
||||
3. Save
|
||||
|
||||
**Step 3: Additional Tracking**
|
||||
|
||||
1. Settings → Advanced → Code Injection
|
||||
2. Add custom event tracking if needed
|
||||
|
||||
## Method 2: gtag.js Direct Installation
|
||||
|
||||
### Overview
|
||||
|
||||
gtag.js (Google Tag) is JavaScript library for implementing GA4 directly without tag management system.
|
||||
|
||||
### Full Installation Code
|
||||
|
||||
```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>
|
||||
```
|
||||
|
||||
### Placement Requirements
|
||||
|
||||
**Location**: `<head>` section of HTML
|
||||
|
||||
**Position**:
|
||||
- Immediately after `<head>` opening tag
|
||||
- Before all other scripts (except meta tags)
|
||||
- Above any custom gtag() calls
|
||||
|
||||
**Complete HTML Example**:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>My Website</title>
|
||||
|
||||
<!-- Google tag (gtag.js) - MUST BE FIRST -->
|
||||
<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>
|
||||
|
||||
<!-- Other scripts after gtag -->
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<!-- Your content -->
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### Configuration Options
|
||||
|
||||
**Basic Configuration**:
|
||||
```javascript
|
||||
gtag('config', 'G-XXXXXXXXXX');
|
||||
```
|
||||
|
||||
**With Additional Settings**:
|
||||
```javascript
|
||||
gtag('config', 'G-XXXXXXXXXX', {
|
||||
'page_title': 'Custom Page Title',
|
||||
'page_location': 'https://example.com/custom-url',
|
||||
'send_page_view': true, // Default: true
|
||||
'allow_google_signals': true, // For demographics
|
||||
'allow_ad_personalization_signals': true
|
||||
});
|
||||
```
|
||||
|
||||
### Custom Event Tracking
|
||||
|
||||
**Simple Event**:
|
||||
```javascript
|
||||
gtag('event', 'button_click', {
|
||||
'button_name': 'Subscribe',
|
||||
'button_location': 'header'
|
||||
});
|
||||
```
|
||||
|
||||
**Purchase Event**:
|
||||
```javascript
|
||||
gtag('event', 'purchase', {
|
||||
'transaction_id': 'TXN_12345',
|
||||
'value': 99.99,
|
||||
'currency': 'USD',
|
||||
'tax': 5.00,
|
||||
'shipping': 10.00,
|
||||
'items': [
|
||||
{
|
||||
'item_id': 'SKU_123',
|
||||
'item_name': 'Product Name',
|
||||
'price': 99.99,
|
||||
'quantity': 1
|
||||
}
|
||||
]
|
||||
});
|
||||
```
|
||||
|
||||
### Common Implementation Patterns
|
||||
|
||||
**Track Button Click**:
|
||||
```html
|
||||
<button onclick="trackButtonClick()">Subscribe</button>
|
||||
|
||||
<script>
|
||||
function trackButtonClick() {
|
||||
gtag('event', 'button_click', {
|
||||
'button_name': 'Subscribe',
|
||||
'button_location': 'homepage_hero'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
**Track Form Submission**:
|
||||
```html
|
||||
<form id="contact-form" onsubmit="trackFormSubmit(event)">
|
||||
<input type="email" name="email" required>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function trackFormSubmit(e) {
|
||||
e.preventDefault();
|
||||
|
||||
gtag('event', 'form_submit', {
|
||||
'form_name': 'Contact Form',
|
||||
'form_id': 'contact-form'
|
||||
});
|
||||
|
||||
// Submit form after tracking
|
||||
setTimeout(() => {
|
||||
e.target.submit();
|
||||
}, 100);
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
### Multiple GA4 Properties
|
||||
|
||||
**Track to Multiple Properties**:
|
||||
```javascript
|
||||
// First property
|
||||
gtag('config', 'G-XXXXXXXXXX');
|
||||
|
||||
// Second property
|
||||
gtag('config', 'G-YYYYYYYYYY');
|
||||
|
||||
// Events automatically sent to both
|
||||
gtag('event', 'purchase', {
|
||||
'value': 99.99,
|
||||
'currency': 'USD'
|
||||
});
|
||||
```
|
||||
|
||||
## Method 3: Google Tag Manager Installation
|
||||
|
||||
### Overview
|
||||
|
||||
GTM provides centralized tag management with no code changes for updates. Recommended for most implementations.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
**Required**:
|
||||
- GTM container created at tagmanager.google.com
|
||||
- Container ID (format: GTM-XXXXXXX)
|
||||
- Admin/Editor access to GTM container
|
||||
|
||||
### GTM Container Installation
|
||||
|
||||
**Step 1: Get Container Code**
|
||||
|
||||
1. Log in to tagmanager.google.com
|
||||
2. Open your container
|
||||
3. Click container ID (GTM-XXXXXXX) at top
|
||||
4. Copy both code snippets
|
||||
|
||||
**Step 2: Install on Website**
|
||||
|
||||
**Snippet 1: Head Section**
|
||||
|
||||
Place immediately after `<head>`:
|
||||
|
||||
```html
|
||||
<!-- Google Tag Manager -->
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
```
|
||||
|
||||
**Snippet 2: Body Section**
|
||||
|
||||
Place immediately after `<body>`:
|
||||
|
||||
```html
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
|
||||
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
```
|
||||
|
||||
**Complete HTML Example**:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>My Website</title>
|
||||
|
||||
<!-- Google Tag Manager -->
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
</head>
|
||||
<body>
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
|
||||
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
|
||||
<!-- Your content -->
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### GA4 Configuration Tag Setup
|
||||
|
||||
**Step 1: Create GA4 Configuration Tag**
|
||||
|
||||
1. GTM Workspace → Tags → New
|
||||
2. Click "Tag Configuration"
|
||||
3. Select "Google Tag"
|
||||
4. Enter GA4 Measurement ID in "Tag ID" field
|
||||
5. Configure settings (optional):
|
||||
- Configuration settings
|
||||
- Fields to set
|
||||
|
||||
**Step 2: Set Trigger**
|
||||
|
||||
1. Click "Triggering"
|
||||
2. Select "Initialization - All Pages"
|
||||
3. Save tag
|
||||
|
||||
**Tag Name**: "GA4 - Configuration" or "GA4 - Base Tag"
|
||||
|
||||
**Tag Configuration**:
|
||||
```
|
||||
Tag Type: Google Tag
|
||||
Tag ID: G-XXXXXXXXXX
|
||||
Configuration Settings:
|
||||
- Allow Google Signals: true (optional)
|
||||
- Allow ad personalization signals: true (optional)
|
||||
```
|
||||
|
||||
**Step 3: Test in Preview Mode**
|
||||
|
||||
1. Click "Preview" (top-right)
|
||||
2. Connect to your website
|
||||
3. Verify tag fires on Initialization
|
||||
4. Check GA4 DebugView for events
|
||||
|
||||
**Step 4: Publish**
|
||||
|
||||
1. Click "Submit" (top-right)
|
||||
2. Enter version name: "GA4 Initial Setup"
|
||||
3. Add description
|
||||
4. Click "Publish"
|
||||
|
||||
### GA4 Event Tag Setup
|
||||
|
||||
**Create Custom Event Tag**:
|
||||
|
||||
1. Tags → New
|
||||
2. Tag Configuration → Google Tag
|
||||
3. Tag ID: G-XXXXXXXXXX
|
||||
4. Event Name: "button_click"
|
||||
5. Event Parameters:
|
||||
- Parameter: button_name → Value: {{Click Text}}
|
||||
- Parameter: button_location → Value: "header"
|
||||
6. Triggering: Click trigger
|
||||
7. Save tag
|
||||
|
||||
### GTM Best Practices
|
||||
|
||||
**Tag Naming**:
|
||||
- Use prefix: "GA4 - "
|
||||
- Examples: "GA4 - Configuration", "GA4 - Purchase", "GA4 - Form Submit"
|
||||
|
||||
**Container Organization**:
|
||||
- Folder for GA4 tags
|
||||
- Folder for GA4 variables
|
||||
- Clear naming conventions
|
||||
|
||||
**Testing Before Publishing**:
|
||||
- Always use Preview mode
|
||||
- Test all triggers
|
||||
- Verify event parameters
|
||||
- Check DebugView
|
||||
|
||||
## Installation Verification (All Methods)
|
||||
|
||||
### Quick Verification Steps
|
||||
|
||||
**Step 1: Enable Google Analytics Debugger**
|
||||
|
||||
1. Install "Google Analytics Debugger" Chrome extension
|
||||
2. Enable extension
|
||||
3. Visit your website
|
||||
|
||||
**Step 2: Check DebugView**
|
||||
|
||||
1. GA4 Property → Admin → DebugView
|
||||
2. Select your device from dropdown
|
||||
3. Confirm events appearing:
|
||||
- session_start
|
||||
- first_visit (if new user)
|
||||
- page_view
|
||||
|
||||
**Step 3: Check Realtime Reports**
|
||||
|
||||
1. GA4 Property → Reports → Realtime
|
||||
2. Confirm showing 1+ active users
|
||||
3. Verify events by name
|
||||
|
||||
**Step 4: Verify Event Parameters**
|
||||
|
||||
1. DebugView → Click event
|
||||
2. Review parameters panel
|
||||
3. Confirm all expected parameters present
|
||||
|
||||
## Troubleshooting Installation
|
||||
|
||||
### No Data Appearing
|
||||
|
||||
**Checklist**:
|
||||
- [ ] Correct Measurement ID (G-XXXXXXXXXX)?
|
||||
- [ ] Code in correct location (`<head>` for gtag/GTM)?
|
||||
- [ ] Website published/live?
|
||||
- [ ] Tracking code on all pages?
|
||||
- [ ] Ad blockers disabled for testing?
|
||||
- [ ] Waited 24 hours? (DebugView is instant, reports delayed)
|
||||
|
||||
**Solutions**:
|
||||
1. Verify Measurement ID matches Data Stream
|
||||
2. Check browser console for errors
|
||||
3. Use Tag Assistant to diagnose
|
||||
4. Test in incognito mode
|
||||
5. Check if ad blocker blocking
|
||||
|
||||
### Data Only in DebugView
|
||||
|
||||
**Cause**: Debug mode parameter enabled
|
||||
|
||||
**Solution**:
|
||||
- Remove `debug_mode: true` from events
|
||||
- Disable Google Analytics Debugger extension
|
||||
- GTM: Exit Preview mode
|
||||
- Wait 24-48 hours for standard reports
|
||||
|
||||
### Duplicate Events
|
||||
|
||||
**Cause**: Multiple tracking implementations
|
||||
|
||||
**Solutions**:
|
||||
1. Check for both gtag.js AND GTM (remove one)
|
||||
2. Check for plugin AND manual code (remove one)
|
||||
3. Verify not tracking to same ID twice
|
||||
4. Check theme and plugins for conflicts
|
||||
|
||||
### Wrong Data Stream
|
||||
|
||||
**Symptoms**: Events appear but in wrong property/stream
|
||||
|
||||
**Solution**:
|
||||
1. Verify Measurement ID
|
||||
2. Check Data Streams list
|
||||
3. Confirm using correct ID for platform
|
||||
4. Update code with correct ID
|
||||
|
||||
## Migration from Universal Analytics
|
||||
|
||||
### Running Both UA and GA4
|
||||
|
||||
**Recommended**: Run both during transition period
|
||||
|
||||
**Implementation**:
|
||||
|
||||
**If using gtag.js**:
|
||||
```html
|
||||
<!-- Universal Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-X"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'UA-XXXXXXXXX-X');
|
||||
gtag('config', 'G-XXXXXXXXXX'); // GA4
|
||||
</script>
|
||||
```
|
||||
|
||||
**If using GTM**:
|
||||
1. Keep existing UA tag
|
||||
2. Add new GA4 Configuration tag
|
||||
3. Both fire simultaneously
|
||||
4. No conflicts between UA and GA4
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- Official Google: Installation Guide
|
||||
- Official Google: Verify Installation
|
||||
- See verification-checklist.md for detailed testing procedures
|
||||
- See ga4-gtm-integration skill for advanced GTM configurations
|
||||
348
skills/ga4-setup/references/property-creation-guide.md
Normal file
348
skills/ga4-setup/references/property-creation-guide.md
Normal file
@@ -0,0 +1,348 @@
|
||||
# GA4 Property Creation Guide
|
||||
|
||||
Complete step-by-step guide for creating Google Analytics 4 accounts, properties, and data streams.
|
||||
|
||||
## Account Hierarchy
|
||||
|
||||
GA4 uses a three-level hierarchy:
|
||||
|
||||
```
|
||||
Google Account (Login credentials)
|
||||
└── Analytics Account (Container for properties)
|
||||
└── GA4 Property (Analytics container for website/app)
|
||||
└── Data Stream (Platform-specific: Web, iOS, Android)
|
||||
└── Events & Parameters
|
||||
```
|
||||
|
||||
## Understanding the Hierarchy
|
||||
|
||||
### Level 1: Google Account
|
||||
- Your Gmail/Google Workspace login
|
||||
- Required to access Google Analytics
|
||||
- Can own multiple Analytics accounts
|
||||
- No configuration needed (use existing account)
|
||||
|
||||
### Level 2: Analytics Account
|
||||
- Container for organizing properties
|
||||
- Typically one per business or organization
|
||||
- Limit: Up to 2,000 properties per account
|
||||
- Shared settings: data sharing, account-level users, change history
|
||||
|
||||
### Level 3: GA4 Property
|
||||
- Container for a specific website, app, or business unit
|
||||
- Can have multiple data streams
|
||||
- Property-specific settings: timezone, currency, industry, objectives
|
||||
- Limit: 2,000 properties per account
|
||||
|
||||
### Level 4: Data Stream
|
||||
- Tracks specific platform (web, iOS, or Android)
|
||||
- Each stream has unique Measurement ID (G-XXXXXXXXXX)
|
||||
- Limit: Up to 1,000 data streams per property
|
||||
|
||||
## Creating an Analytics Account
|
||||
|
||||
### When to Create a New Account
|
||||
|
||||
Create a new Analytics account when:
|
||||
|
||||
- Starting analytics for a new organization
|
||||
- Separating client work (agencies)
|
||||
- Requiring distinct permission boundaries
|
||||
- Organizationally separating business units
|
||||
|
||||
### Account Creation Steps
|
||||
|
||||
1. Navigate to https://analytics.google.com
|
||||
2. Click "Start measuring" or Admin → Create Account
|
||||
3. Enter account name (e.g., "Acme Corporation")
|
||||
4. Configure account data sharing settings:
|
||||
- Google products & services (recommended: enabled)
|
||||
- Benchmarking (recommended: enabled)
|
||||
- Technical support (recommended: enabled)
|
||||
- Account specialists (optional)
|
||||
5. Click "Next" to proceed to property creation
|
||||
|
||||
### Account Data Sharing Settings
|
||||
|
||||
**Google Products & Services**:
|
||||
- Shares data to improve Google products
|
||||
- Enables product recommendations
|
||||
|
||||
**Benchmarking**:
|
||||
- Allows comparison with industry peers
|
||||
- Anonymously shares data for aggregate reports
|
||||
|
||||
**Technical Support**:
|
||||
- Google support can access account for troubleshooting
|
||||
- Recommended for faster issue resolution
|
||||
|
||||
**Account Specialists**:
|
||||
- Share with Google account managers
|
||||
- Only relevant if you have dedicated account rep
|
||||
|
||||
## Creating a GA4 Property
|
||||
|
||||
### Property Details
|
||||
|
||||
**Step 1: Property Name**
|
||||
|
||||
Enter a descriptive property name:
|
||||
- Use clear naming: "Main Website", "Mobile App", "E-commerce Site"
|
||||
- Include environment if applicable: "Production Website" vs "Test Website"
|
||||
- Keep under 100 characters
|
||||
|
||||
**Step 2: Reporting Time Zone**
|
||||
|
||||
Select your primary business timezone:
|
||||
- Used for day boundaries in reports
|
||||
- Example: "United States - Pacific Time"
|
||||
- **Critical**: Cannot be changed retroactively affects historical data
|
||||
- Choose carefully based on where business operates
|
||||
|
||||
**Step 3: Currency**
|
||||
|
||||
Select reporting currency:
|
||||
- Used for revenue and monetary value reporting
|
||||
- Example: "US Dollar (USD)" or "Euro (EUR)"
|
||||
- All monetary values converted to this currency
|
||||
- Can be changed later without affecting historical data
|
||||
|
||||
### Advanced Settings
|
||||
|
||||
**Step 4: Industry Category (Optional)**
|
||||
|
||||
Select relevant industry:
|
||||
- Automotive
|
||||
- Business & Industrial Markets
|
||||
- Finance
|
||||
- Healthcare
|
||||
- Technology
|
||||
- Travel
|
||||
- Real Estate
|
||||
- And more...
|
||||
|
||||
**Purpose**: Influences default reports and recommendations
|
||||
|
||||
**Step 5: Business Size (Optional)**
|
||||
|
||||
Select company size:
|
||||
- Small (1-100 employees)
|
||||
- Medium (100-500 employees)
|
||||
- Large (500+ employees)
|
||||
|
||||
### Business Objectives
|
||||
|
||||
**Step 6: Select Objectives**
|
||||
|
||||
Choose objectives that match business goals:
|
||||
|
||||
**Option 1: Get baseline reports**
|
||||
- Default reports for all businesses
|
||||
- Choose if unsure or want standard setup
|
||||
- Recommended for first-time GA4 users
|
||||
|
||||
**Option 2: Examine user behavior**
|
||||
- User engagement and retention reports
|
||||
- Path exploration tools
|
||||
|
||||
**Option 3: Measure customer actions**
|
||||
- Conversion tracking emphasis
|
||||
- Ecommerce-focused reports
|
||||
|
||||
**Option 4: Get insights on customers**
|
||||
- Demographics and interests
|
||||
- Requires Google Signals
|
||||
|
||||
**Option 5: Improve marketing ROI**
|
||||
- Advertising and attribution reports
|
||||
- Google Ads integration
|
||||
|
||||
**Note**: Can select multiple objectives; influences default reporting UI
|
||||
|
||||
### Accepting Terms
|
||||
|
||||
**Step 7: Review and Accept**
|
||||
|
||||
- Google Analytics Terms of Service
|
||||
- Data Processing Amendment (GDPR)
|
||||
- Country-specific terms if applicable
|
||||
|
||||
Read and check acceptance boxes, then click "Create"
|
||||
|
||||
## Property Settings Configuration
|
||||
|
||||
After property creation, configure additional settings:
|
||||
|
||||
### Navigate to Property Settings
|
||||
|
||||
1. Admin → Property → Property Settings
|
||||
2. Review and adjust:
|
||||
- Property name (can change later)
|
||||
- Industry category
|
||||
- Time zone (CRITICAL - choose correctly first time)
|
||||
- Currency (can change)
|
||||
- Property ID (read-only, format: properties/XXXXXXXXXX)
|
||||
|
||||
### Enable Google Signals (Optional)
|
||||
|
||||
**Location**: Admin → Data Settings → Data Collection
|
||||
|
||||
**Purpose**:
|
||||
- Collect demographics (age, gender)
|
||||
- Enable cross-device tracking
|
||||
- Requires users signed into Google accounts
|
||||
|
||||
**Requirements**:
|
||||
- User consent for ad personalization
|
||||
- Compliance with privacy regulations
|
||||
|
||||
**Enable Steps**:
|
||||
1. Admin → Data Settings → Data Collection
|
||||
2. Click "Get Started" under Google Signals
|
||||
3. Review requirements
|
||||
4. Click "Activate"
|
||||
|
||||
**Impact**:
|
||||
- Demographics & interests reports available
|
||||
- Cross-device user tracking
|
||||
- Enhanced audience building
|
||||
|
||||
### Configure Data Retention
|
||||
|
||||
**Location**: Admin → Data Settings → Data Retention
|
||||
|
||||
**Options**:
|
||||
- 2 months (default)
|
||||
- 14 months (recommended for most)
|
||||
- 26 months (GA4 360 only)
|
||||
- 38 months (GA4 360 only)
|
||||
- 50 months (GA4 360 only)
|
||||
|
||||
**What's Affected**:
|
||||
- User-level data in Explorations
|
||||
- Event-level data in Explorations
|
||||
- User Explorer report
|
||||
|
||||
**Not Affected**:
|
||||
- Standard reports (aggregated data retained indefinitely)
|
||||
- Conversion data
|
||||
- Audience data
|
||||
|
||||
**Recommendation**: Set to 14 months for year-over-year analysis
|
||||
|
||||
### Reset User Data on New Activity
|
||||
|
||||
**Toggle Option**: ON or OFF
|
||||
|
||||
**ON (Default)**:
|
||||
- Retention timer resets with each new event from user
|
||||
- User data persists as long as user remains active
|
||||
|
||||
**OFF**:
|
||||
- Data deleted after retention period regardless of activity
|
||||
- Use for stricter privacy compliance
|
||||
|
||||
## Property Best Practices
|
||||
|
||||
### Naming Conventions
|
||||
|
||||
Use consistent, descriptive names:
|
||||
|
||||
**Good Examples**:
|
||||
- "Acme Corp - Production Website"
|
||||
- "Acme Corp - iOS App"
|
||||
- "Acme Corp - Test Environment"
|
||||
|
||||
**Bad Examples**:
|
||||
- "Website 1"
|
||||
- "Test"
|
||||
- "Property123"
|
||||
|
||||
### Environment Separation
|
||||
|
||||
**Create Separate Properties For**:
|
||||
- Production website/app
|
||||
- Staging/test environment
|
||||
- Development environment
|
||||
|
||||
**Why**: Prevents test data from polluting production analytics
|
||||
|
||||
### Property Organization
|
||||
|
||||
**Single Business**:
|
||||
- One property per major digital property (website, app)
|
||||
- Multiple data streams within property for subdomains
|
||||
|
||||
**Multiple Businesses/Clients**:
|
||||
- Separate Analytics accounts for each
|
||||
- Or separate properties within agency account
|
||||
|
||||
### Documentation
|
||||
|
||||
**Document for Each Property**:
|
||||
- Property ID and name
|
||||
- Measurement IDs for all data streams
|
||||
- Timezone and currency selections
|
||||
- Business objectives chosen
|
||||
- Setup date and responsible person
|
||||
- Installation method used
|
||||
|
||||
## Common Property Creation Issues
|
||||
|
||||
### Issue: Cannot Create Property
|
||||
|
||||
**Causes**:
|
||||
- Reached 2,000 property limit
|
||||
- Insufficient permissions
|
||||
- Account suspended
|
||||
|
||||
**Solutions**:
|
||||
- Delete unused properties
|
||||
- Request Admin access from account owner
|
||||
- Contact Google support for suspension issues
|
||||
|
||||
### Issue: Wrong Timezone Selected
|
||||
|
||||
**Problem**: Cannot change timezone after creation
|
||||
|
||||
**Solutions**:
|
||||
- Delete and recreate property (if just created)
|
||||
- Export data and create new property (if has historical data)
|
||||
- Accept timezone and use data studio for reporting in different timezone
|
||||
|
||||
### Issue: Don't Know Which Industry Category
|
||||
|
||||
**Solution**: Choose "Other" or most relevant category
|
||||
- Not critical for functionality
|
||||
- Can be changed later
|
||||
- Only affects suggested reports
|
||||
|
||||
### Issue: Multiple Properties vs Multiple Data Streams
|
||||
|
||||
**Decision Framework**:
|
||||
|
||||
**Use Multiple Data Streams (Same Property)** when:
|
||||
- Same business entity
|
||||
- Want combined reporting
|
||||
- Example: main site + blog subdomain
|
||||
|
||||
**Use Multiple Properties** when:
|
||||
- Different business entities
|
||||
- Different permission requirements
|
||||
- Test vs production
|
||||
- Example: separate brands, client sites
|
||||
|
||||
## Next Steps After Property Creation
|
||||
|
||||
1. **Create Data Stream** (see data-streams-configuration.md)
|
||||
2. **Install Tracking Code** (see installation-methods.md)
|
||||
3. **Verify Installation** (see verification-checklist.md)
|
||||
4. **Configure Enhanced Measurement**
|
||||
5. **Set up Internal Traffic Filters**
|
||||
6. **Create First Custom Events**
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- Official Google: GA4 Property Setup
|
||||
- Official Google: Account Structure Best Practices
|
||||
- Official Google: Data Retention Settings
|
||||
493
skills/ga4-setup/references/verification-checklist.md
Normal file
493
skills/ga4-setup/references/verification-checklist.md
Normal file
@@ -0,0 +1,493 @@
|
||||
# GA4 Installation Verification Checklist
|
||||
|
||||
Comprehensive checklist and procedures for verifying GA4 installation across all implementation methods.
|
||||
|
||||
## Pre-Launch Verification Workflow
|
||||
|
||||
### Phase 1: Immediate Verification (0-5 minutes)
|
||||
|
||||
✅ **Task 1: Verify Code Placement**
|
||||
|
||||
**For gtag.js**:
|
||||
- [ ] Code in `<head>` section
|
||||
- [ ] Before other scripts
|
||||
- [ ] After opening `<head>` tag
|
||||
- [ ] Correct Measurement ID (G-XXXXXXXXXX)
|
||||
|
||||
**For GTM**:
|
||||
- [ ] Head snippet after opening `<head>` tag
|
||||
- [ ] Body snippet after opening `<body>` tag
|
||||
- [ ] Correct Container ID (GTM-XXXXXXX)
|
||||
- [ ] GA4 Configuration tag created in GTM
|
||||
- [ ] Tag triggers on "Initialization - All Pages"
|
||||
|
||||
**For CMS/Plugin**:
|
||||
- [ ] Plugin installed and activated
|
||||
- [ ] Connected to correct GA4 property
|
||||
- [ ] Measurement ID matches Data Stream
|
||||
|
||||
✅ **Task 2: Browser Console Check**
|
||||
|
||||
1. Open website in Chrome
|
||||
2. Press F12 (Developer Tools)
|
||||
3. Console tab
|
||||
4. Look for:
|
||||
- [ ] No JavaScript errors related to gtag/GTM
|
||||
- [ ] "Google Analytics" or "gtag" messages
|
||||
- [ ] GTM: "Tag Manager loaded" message
|
||||
|
||||
✅ **Task 3: Network Tab Verification**
|
||||
|
||||
1. Developer Tools → Network tab
|
||||
2. Reload page
|
||||
3. Filter: "google-analytics" or "analytics"
|
||||
4. Look for:
|
||||
- [ ] Request to `www.google-analytics.com/g/collect`
|
||||
- [ ] Status: 200 (success)
|
||||
- [ ] Query parameters include `&tid=G-XXXXXXXXXX`
|
||||
|
||||
### Phase 2: DebugView Verification (5-15 minutes)
|
||||
|
||||
✅ **Task 4: Enable Debug Mode**
|
||||
|
||||
**Option 1: Google Analytics Debugger Extension (Easiest)**
|
||||
1. [ ] Install from Chrome Web Store
|
||||
2. [ ] Enable extension (icon turns blue)
|
||||
3. [ ] Reload website
|
||||
|
||||
**Option 2: GTM Preview Mode**
|
||||
1. [ ] GTM → Click "Preview"
|
||||
2. [ ] Enter website URL
|
||||
3. [ ] Click "Connect"
|
||||
4. [ ] Tag Assistant tab opens
|
||||
|
||||
**Option 3: Manual Debug Parameter (gtag.js)**
|
||||
```javascript
|
||||
gtag('config', 'G-XXXXXXXXXX', {
|
||||
'debug_mode': true
|
||||
});
|
||||
```
|
||||
|
||||
✅ **Task 5: Access DebugView**
|
||||
|
||||
1. [ ] GA4 Property → Admin → DebugView
|
||||
2. [ ] Select device from dropdown (top)
|
||||
3. [ ] Wait 10-30 seconds for data
|
||||
|
||||
✅ **Task 6: Verify Automatic Events**
|
||||
|
||||
Look for these events in DebugView:
|
||||
|
||||
**session_start**:
|
||||
- [ ] Event appears on first page load
|
||||
- [ ] Parameters present: `session_id`, `engagement_time_msec`
|
||||
|
||||
**first_visit** (new users only):
|
||||
- [ ] Appears for users never visited before
|
||||
- [ ] Clear cookies to test
|
||||
|
||||
**page_view**:
|
||||
- [ ] Fires on every page load
|
||||
- [ ] Check parameters:
|
||||
- [ ] `page_location` (full URL)
|
||||
- [ ] `page_referrer` (if applicable)
|
||||
- [ ] `page_title` (page title)
|
||||
|
||||
✅ **Task 7: Verify Enhanced Measurement Events**
|
||||
|
||||
**If Enhanced Measurement Enabled**:
|
||||
|
||||
**scroll** (requires scrolling 90% down page):
|
||||
- [ ] Scroll to bottom of long page
|
||||
- [ ] Event appears in DebugView
|
||||
- [ ] Parameters: `engagement_time_msec`
|
||||
|
||||
**click** (outbound links):
|
||||
- [ ] Click link to external domain
|
||||
- [ ] Event appears
|
||||
- [ ] Parameters: `link_url`, `link_domain`, `outbound: true`
|
||||
|
||||
**file_download**:
|
||||
- [ ] Click link to PDF, DOC, or ZIP file
|
||||
- [ ] Event appears
|
||||
- [ ] Parameters: `file_name`, `file_extension`
|
||||
|
||||
**form_start / form_submit**:
|
||||
- [ ] Interact with form field
|
||||
- [ ] Submit form
|
||||
- [ ] Both events appear
|
||||
- [ ] Parameters: `form_id`, `form_name`
|
||||
|
||||
✅ **Task 8: Inspect Event Parameters**
|
||||
|
||||
Click any event in DebugView, verify parameters section shows:
|
||||
|
||||
**Automatically Collected**:
|
||||
- [ ] `page_location`
|
||||
- [ ] `page_referrer`
|
||||
- [ ] `page_title`
|
||||
- [ ] `language`
|
||||
- [ ] `screen_resolution`
|
||||
- [ ] `engagement_time_msec`
|
||||
|
||||
**User Properties**:
|
||||
- [ ] `first_visit_time` (new users)
|
||||
- [ ] Any custom user properties configured
|
||||
|
||||
### Phase 3: Realtime Reports Verification (15-30 minutes)
|
||||
|
||||
✅ **Task 9: Check Realtime Overview**
|
||||
|
||||
1. [ ] Reports → Realtime
|
||||
2. [ ] Confirm showing "1" active user (or more)
|
||||
3. [ ] User location appears on map
|
||||
4. [ ] Recent events list shows `page_view`
|
||||
|
||||
✅ **Task 10: Verify Event Counts**
|
||||
|
||||
Click "Event count by Event name" card:
|
||||
- [ ] `page_view` events present
|
||||
- [ ] `session_start` events present
|
||||
- [ ] `first_visit` (if testing as new user)
|
||||
- [ ] Any custom events configured
|
||||
|
||||
✅ **Task 11: Test Multi-Page Navigation**
|
||||
|
||||
1. [ ] Navigate to 2-3 different pages
|
||||
2. [ ] Each navigation triggers new `page_view`
|
||||
3. [ ] Realtime shows updated event counts
|
||||
4. [ ] Page titles/paths update in real-time
|
||||
|
||||
### Phase 4: Standard Reports Verification (24-48 hours)
|
||||
|
||||
⚠️ **Note**: Standard reports have 24-48 hour delay
|
||||
|
||||
✅ **Task 12: User Acquisition Report**
|
||||
|
||||
After 24-48 hours:
|
||||
1. [ ] Reports → Acquisition → User acquisition
|
||||
2. [ ] Data appears for "Direct" traffic (minimum)
|
||||
3. [ ] Users and sessions counted
|
||||
|
||||
✅ **Task 13: Engagement Reports**
|
||||
|
||||
1. [ ] Reports → Engagement → Pages and screens
|
||||
2. [ ] Website pages listed
|
||||
3. [ ] Views counted
|
||||
4. [ ] Average engagement time shown
|
||||
|
||||
✅ **Task 14: Events Report**
|
||||
|
||||
1. [ ] Reports → Engagement → Events
|
||||
2. [ ] All events listed (page_view, session_start, etc.)
|
||||
3. [ ] Event counts shown
|
||||
4. [ ] Event parameters accessible (click event)
|
||||
|
||||
## Advanced Verification
|
||||
|
||||
### Custom Event Verification
|
||||
|
||||
✅ **Task 15: Test Custom Events** (if implemented)
|
||||
|
||||
For each custom event:
|
||||
1. [ ] Trigger event action (click button, submit form, etc.)
|
||||
2. [ ] Event appears in DebugView within seconds
|
||||
3. [ ] Event name matches expected
|
||||
4. [ ] All parameters present with correct values
|
||||
5. [ ] Event appears in Realtime report
|
||||
6. [ ] After 24-48 hours, appears in Events report
|
||||
|
||||
### Ecommerce Tracking Verification
|
||||
|
||||
✅ **Task 16: Test Ecommerce Events** (if implemented)
|
||||
|
||||
**view_item**:
|
||||
1. [ ] View product page
|
||||
2. [ ] Event fires in DebugView
|
||||
3. [ ] Parameters: `currency`, `value`, `items` array
|
||||
4. [ ] Items array contains `item_id`, `item_name`, `price`
|
||||
|
||||
**add_to_cart**:
|
||||
1. [ ] Add product to cart
|
||||
2. [ ] Event fires
|
||||
3. [ ] Items array populated
|
||||
4. [ ] Quantity and price correct
|
||||
|
||||
**purchase**:
|
||||
1. [ ] Complete test purchase
|
||||
2. [ ] Event fires
|
||||
3. [ ] `transaction_id` unique
|
||||
4. [ ] `value` matches total
|
||||
5. [ ] `currency` correct (ISO code)
|
||||
6. [ ] Items array complete
|
||||
7. [ ] Check Monetization reports after 24-48 hours
|
||||
|
||||
### Cross-Domain Tracking Verification
|
||||
|
||||
✅ **Task 17: Test Cross-Domain** (if configured)
|
||||
|
||||
1. [ ] Navigate from domain1.com to domain2.com
|
||||
2. [ ] Check Network tab for `_gl` parameter in URL
|
||||
3. [ ] DebugView shows same user across domains
|
||||
4. [ ] Session ID remains consistent
|
||||
|
||||
### User ID Tracking Verification
|
||||
|
||||
✅ **Task 18: Test User ID** (if implemented)
|
||||
|
||||
1. [ ] User logs in
|
||||
2. [ ] DebugView shows `user_id` parameter in events
|
||||
3. [ ] User ID matches expected format
|
||||
4. [ ] User ID persists across pages
|
||||
5. [ ] User ID not PII (no email, name, etc.)
|
||||
|
||||
## Tag Assistant Verification
|
||||
|
||||
✅ **Task 19: Google Tag Assistant**
|
||||
|
||||
1. [ ] Install "Tag Assistant Companion" Chrome extension
|
||||
2. [ ] Visit website
|
||||
3. [ ] Click extension icon
|
||||
4. [ ] Verify:
|
||||
- [ ] GA4 tag detected
|
||||
- [ ] Tag status: Green (working)
|
||||
- [ ] Measurement ID correct
|
||||
- [ ] Events firing
|
||||
|
||||
## GTM-Specific Verification
|
||||
|
||||
### Preview Mode Testing
|
||||
|
||||
✅ **Task 20: GTM Preview Mode**
|
||||
|
||||
1. [ ] GTM → Preview
|
||||
2. [ ] Connect to website
|
||||
3. [ ] Tag Assistant window opens
|
||||
4. [ ] Summary tab shows:
|
||||
- [ ] Container loaded
|
||||
- [ ] GA4 Configuration tag fired
|
||||
- [ ] All expected GA4 Event tags fired
|
||||
|
||||
✅ **Task 21: GTM Data Layer**
|
||||
|
||||
In Preview Mode:
|
||||
1. [ ] Variables tab
|
||||
2. [ ] Click "Data Layer"
|
||||
3. [ ] Verify:
|
||||
- [ ] `gtm.start` present
|
||||
- [ ] `event: gtm.js` present
|
||||
- [ ] Custom dataLayer pushes present (if applicable)
|
||||
|
||||
✅ **Task 22: Trigger Verification**
|
||||
|
||||
For each GA4 Event tag:
|
||||
1. [ ] Perform trigger action
|
||||
2. [ ] Tags tab shows tag fired
|
||||
3. [ ] Data Layer shows custom event
|
||||
4. [ ] GA4 DebugView shows event
|
||||
|
||||
## Mobile App Verification
|
||||
|
||||
### iOS App Verification
|
||||
|
||||
✅ **Task 23: iOS Debug Mode**
|
||||
|
||||
1. [ ] Xcode: Edit Scheme
|
||||
2. [ ] Arguments Passed On Launch: `-FIRDebugEnabled`
|
||||
3. [ ] Run app
|
||||
4. [ ] DebugView shows device
|
||||
5. [ ] Events appear (`session_start`, `screen_view`)
|
||||
|
||||
✅ **Task 24: iOS Console Logs**
|
||||
|
||||
Xcode console shows:
|
||||
- [ ] "Firebase Analytics enabled"
|
||||
- [ ] "Firebase configuration loaded"
|
||||
- [ ] No Firebase errors
|
||||
|
||||
### Android App Verification
|
||||
|
||||
✅ **Task 25: Android Debug Mode**
|
||||
|
||||
```bash
|
||||
adb shell setprop debug.firebase.analytics.app com.example.app
|
||||
```
|
||||
|
||||
1. [ ] Run command
|
||||
2. [ ] Launch app
|
||||
3. [ ] DebugView shows device
|
||||
4. [ ] Events appear
|
||||
|
||||
✅ **Task 26: Android Logcat**
|
||||
|
||||
Logcat shows:
|
||||
- [ ] "FA" (Firebase Analytics) logs
|
||||
- [ ] "Analytics initialized"
|
||||
- [ ] Event logging messages
|
||||
|
||||
## Common Issues & Solutions
|
||||
|
||||
### Issue: No Data in DebugView
|
||||
|
||||
**Checklist**:
|
||||
- [ ] Debug mode actually enabled?
|
||||
- [ ] Google Analytics Debugger extension ON?
|
||||
- [ ] Correct GA4 property selected?
|
||||
- [ ] Device dropdown set to correct device?
|
||||
- [ ] Ad blocker disabled?
|
||||
- [ ] Waiting 30+ seconds?
|
||||
|
||||
**Solutions**:
|
||||
1. Refresh page with debugger enabled
|
||||
2. Try incognito mode
|
||||
3. Check browser console for errors
|
||||
4. Verify Measurement ID correct
|
||||
|
||||
### Issue: Data in DebugView but Not Realtime
|
||||
|
||||
**Causes**:
|
||||
- Realtime has slight delay (30-60 seconds)
|
||||
- Internal traffic filter blocking data
|
||||
|
||||
**Solutions**:
|
||||
1. Wait 2-3 minutes
|
||||
2. Check: Admin → Data Settings → Data Filters
|
||||
3. Verify IP not in "Internal Traffic" filter
|
||||
4. Test from different network
|
||||
|
||||
### Issue: Data in Realtime but Not Standard Reports
|
||||
|
||||
**Expected Behavior**: Standard reports have 24-48 hour delay
|
||||
|
||||
**Verify**:
|
||||
- [ ] At least 24 hours passed since installation
|
||||
- [ ] Check date range in report includes today
|
||||
- [ ] Data collection not paused (Admin → Data Settings)
|
||||
|
||||
### Issue: Duplicate Events
|
||||
|
||||
**Causes**:
|
||||
- Multiple tracking implementations
|
||||
- Both gtag.js AND GTM installed
|
||||
- Plugin AND manual code
|
||||
|
||||
**Solutions**:
|
||||
1. Remove duplicate implementations
|
||||
2. Choose one method (GTM recommended)
|
||||
3. Check Network tab for multiple collect requests
|
||||
4. Review all tracking code locations
|
||||
|
||||
### Issue: Enhanced Measurement Not Working
|
||||
|
||||
**Checklist**:
|
||||
- [ ] Enhanced Measurement toggle ON?
|
||||
- [ ] Admin → Data Streams → Stream → Enhanced Measurement
|
||||
- [ ] Specific event toggle enabled?
|
||||
- [ ] Meeting trigger requirements? (e.g., 90% scroll)
|
||||
- [ ] YouTube videos use JS API enabled?
|
||||
|
||||
**Solutions**:
|
||||
1. Enable Enhanced Measurement
|
||||
2. Check individual event toggles
|
||||
3. Test specific interactions
|
||||
4. Allow 24-48 hours for reports
|
||||
|
||||
## Post-Launch Monitoring
|
||||
|
||||
### Week 1 Checklist
|
||||
|
||||
- [ ] Day 1: Verify DebugView and Realtime working
|
||||
- [ ] Day 2: Check standard reports starting to populate
|
||||
- [ ] Day 3: Verify all pages tracking correctly
|
||||
- [ ] Day 7: Review acquisition sources
|
||||
- [ ] Day 7: Check engagement metrics baseline
|
||||
- [ ] Day 7: Verify conversions/goals tracking
|
||||
|
||||
### Month 1 Checklist
|
||||
|
||||
- [ ] Review top pages and content
|
||||
- [ ] Validate traffic sources accuracy
|
||||
- [ ] Check for data anomalies
|
||||
- [ ] Review custom events performance
|
||||
- [ ] Verify ecommerce tracking (if applicable)
|
||||
- [ ] Set up alerts for data gaps
|
||||
|
||||
## Verification Tools Summary
|
||||
|
||||
### Browser Extensions
|
||||
- **Google Analytics Debugger**: Enable debug mode
|
||||
- **Tag Assistant Companion**: Validate tag installation
|
||||
- **GA4 Event Inspector** (3rd party): View events in-page
|
||||
|
||||
### GA4 Interface Tools
|
||||
- **DebugView**: Real-time event validation
|
||||
- **Realtime Reports**: Live user activity
|
||||
- **DebugView**: Event parameter inspection
|
||||
|
||||
### GTM Tools
|
||||
- **Preview Mode**: Tag firing verification
|
||||
- **Tag Assistant**: Connected testing
|
||||
- **Debug Console**: Data layer inspection
|
||||
|
||||
### Developer Tools
|
||||
- **Chrome DevTools**: Network and console inspection
|
||||
- **Xcode Console**: iOS debugging
|
||||
- **Android Logcat**: Android debugging
|
||||
|
||||
## Verification Documentation Template
|
||||
|
||||
**Property**: [Property Name]
|
||||
**Measurement ID**: G-XXXXXXXXXX
|
||||
**Installation Method**: [gtag.js / GTM / Plugin]
|
||||
**Verification Date**: [Date]
|
||||
|
||||
**Installation Verified**:
|
||||
- [x] Code placement correct
|
||||
- [x] DebugView showing events
|
||||
- [x] Realtime showing users
|
||||
- [x] Enhanced Measurement working
|
||||
- [x] Custom events firing (if applicable)
|
||||
|
||||
**Verified Events**:
|
||||
- [x] session_start
|
||||
- [x] page_view
|
||||
- [x] scroll
|
||||
- [x] click (outbound)
|
||||
- [x] [custom event name]
|
||||
|
||||
**Issues Found**: [List any issues]
|
||||
|
||||
**Resolution**: [How issues were fixed]
|
||||
|
||||
**Next Steps**: [Monitor standard reports in 24-48 hours]
|
||||
|
||||
**Verified By**: [Name]
|
||||
|
||||
## Final Verification Sign-Off
|
||||
|
||||
Before considering GA4 installation complete:
|
||||
|
||||
- [ ] All automatic events firing correctly
|
||||
- [ ] Enhanced Measurement configured and working
|
||||
- [ ] Custom events tested and validated
|
||||
- [ ] Ecommerce tracking verified (if applicable)
|
||||
- [ ] Cross-domain tracking tested (if applicable)
|
||||
- [ ] User ID tracking working (if applicable)
|
||||
- [ ] Internal traffic filters configured
|
||||
- [ ] Data retention settings configured
|
||||
- [ ] Documentation updated with Measurement IDs
|
||||
- [ ] Team trained on DebugView and reports
|
||||
- [ ] Monitoring plan established
|
||||
|
||||
**Status**: ✅ Installation Verified | ⚠️ Issues Found | ❌ Not Working
|
||||
|
||||
**Date**: _________________
|
||||
|
||||
**Verified By**: _________________
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- Official Google: Verify GA4 Installation
|
||||
- Official Google: DebugView Guide
|
||||
- Official Google: Tag Assistant Help
|
||||
- See ga4-debugview skill for advanced debugging
|
||||
Reference in New Issue
Block a user