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
- Navigate to Admin > Create Property
- Enter your property name (e.g., "Company Website - Production")
- Select your reporting time zone and currency
- Choose your industry category and business size
- 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:
- Go to Admin > Data Streams > Add Stream > Web
- Enter your website URL
- Name your stream (e.g., "Production Website")
- 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
- Create a new tag: Google Tag (GA4 Configuration)
- Enter your Measurement ID (G-XXXXXXXXXX)
- Set trigger to All Pages
- 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:
- In GA4: Admin > Custom Definitions > User Properties
- 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, notFormSubmit - Be descriptive but concise:
newsletter_signup, notns - Use consistent prefixes:
video_play,video_pause,video_complete - Avoid PII in event names
Step 5: Conversions
Mark Key Events as Conversions
- Go to Admin > Conversions
- Mark important events as conversions
- Typical conversions include:
purchasegenerate_leadsign_upbegin_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:
- Not setting data retention - Defaults to 2 months
- Forgetting to mark conversions - Events must be explicitly marked
- Duplicate implementations - Check for gtag.js AND GTM
- Missing cross-domain tracking - Configure for multi-domain sites
- PII in URLs - Filter or redact sensitive parameters
Next: GTM Best Practices