Google Analytics 4 (GA4) has redefined how marketers and analysts track user behavior. Unlike Universal Analytics (UA), which was session-based, GA4 is fully event-driven. This gives businesses more flexibility and granularity in understanding customer journeys across platforms. In this guide, we’ll explore all types of GA4 tracking, with detailed explanations, examples, and best practices to help you make the most of GA4.
1. Automatic Tracking (Enhanced Measurement)
What it is: GA4 comes with built-in tracking for common interactions through a feature called Enhanced Measurement. This allows you to track key user activities without any code implementation.
Automatically Tracked Events:
- page_view: Tracks page loads
- scroll: Fires when a user scrolls 90% of a page
- click: Tracks outbound clicks
- file_download: Detects when supported file types are downloaded
- site_search: Captures queries made using search functionality on your website
- video_start, video_progress, video_complete: Tracks YouTube video interactions (if embedded)
Example: You embed a YouTube video on your landing page. With Enhanced Measurement enabled, GA4 will automatically track how many users start, progress through, and complete watching it.
Best Practice: Ensure Enhanced Measurement is turned on via the Admin panel > Data Streams > Web > Enhanced Measurement toggle.
2. Recommended Events
What it is: Google provides a list of recommended events for different industries. These are not tracked automatically but are predefined to support advanced features like predictive metrics and reporting.
Categories Include:
- eCommerce:
purchase
,add_to_cart
,begin_checkout
,refund
- General:
sign_up
,login
,generate_lead
- Travel:
search
,select_item
,purchase
Example:
// For an eCommerce checkout
gtag('event', 'begin_checkout', {
currency: 'USD',
value: 150.00,
items: [
{
item_id: 'SKU_12345',
item_name: 'T-Shirt',
quantity: 1
}
]
});
Best Practice: Use recommended event names exactly as documented by Google to ensure compatibility with default GA4 reports and machine learning features.
3. Custom Events
What it is: Custom events allow you to track unique interactions that aren’t included in GA4’s automatic or recommended events. You define both the event name and parameters.
When to Use:
- Button clicks
- Form submissions
- Tab selections
- Accordion toggles
Example:
// Custom event for a form submission
gtag('event', 'form_submit', {
form_name: 'Newsletter Signup',
location: 'Footer'
});
Best Practice: Use consistent naming conventions and parameter structures. Avoid using spaces or capital letters in event names.
4. User Property Tracking
What it is: User properties are attributes assigned to users that persist across sessions and events.
Common Properties:
- user_id
- membership_level
- subscription_status
Example (with gtag.js):
gtag('set', 'user_properties', {
membership_level: 'gold',
user_id: 'U12345'
});
Best Practice: Use user properties to build audiences, segments, and for personalized marketing efforts.
5. eCommerce Tracking
What it is: GA4 supports detailed eCommerce tracking through a set of predefined events and parameters.
Key eCommerce Events:
- view_item
- add_to_cart
- begin_checkout
- purchase
- refund
Example (purchase event):
gtag('event', 'purchase', {
transaction_id: 'T123',
value: 200.0,
currency: 'USD',
items: [
{
item_id: 'SKU_001',
item_name: 'Shoes',
price: 100.0,
quantity: 2
}
]
});
Best Practice: Use Google’s recommended eCommerce schema. Always validate with the GA4 DebugView and Tag Assistant.
6. Conversion Tracking
What it is: In GA4, any event (automatic, recommended, or custom) can be marked as a conversion.
How to Set Up:
- Go to Admin > Events
- Mark any event (e.g.,
form_submit
,purchase
) as a conversion
Example: You create a custom event called demo_request
. In the GA4 UI, mark this as a conversion to track leads.
Best Practice: Limit conversions to key business goals to keep your reports clean and meaningful.
7. Cross-Platform & Cross-Domain Tracking
What it is: GA4 supports tracking users across multiple domains and across platforms (web and app).
Cross-Domain Example: Track users moving between example.com
and checkout.example.com
without session breaks.
Mobile App Example: Using Firebase SDK, track mobile app events and tie them back to GA4 for unified reporting.
Best Practice:
- Use the same Measurement ID across domains
- Use the GA4 Setup Assistant for cross-domain configuration
- Implement Firebase SDK for mobile apps
8. Event Parameters
What it is: Event parameters provide context to events. GA4 allows up to 25 custom parameters per event.
Examples:
- For
button_click
event:button_text
,section_name
- For
view_item
:item_name
,item_id
,category
Example:
gtag('event', 'cta_click', {
button_text: 'Get Started',
section: 'Hero Banner'
});
Best Practice: Use descriptive parameter names and document them internally to avoid confusion.
Conclusion
GA4 offers unparalleled flexibility in tracking and analyzing user behavior. By leveraging all the tracking types—automatic, recommended, custom events, user properties, and more—you can build a comprehensive analytics strategy that drives real insights and business growth.
🎯 Pro Tip: Use Google Tag Manager for implementation flexibility and easier debugging.