Home/Blog/GA4 Implementation
GA4 Implementation10 min read

GA4 Event Tracking: The Complete Guide to the GA4 Event Model

Everything you need to know about GA4 event tracking. Covers automatic events, enhanced measurement, recommended events, and custom events with code examples.

GA4, event tracking, custom events, dataLayer, GTM

The GA4 event model is fundamentally different from Universal Analytics. In UA, events had a rigid Category/Action/Label structure. In GA4, everything is an event — including pageviews, scrolls, and sessions — and each event can carry up to 25 custom parameters. Understanding this model is the foundation of any correct GA4 implementation.

The Four Tiers of GA4 Events

GA4 events fall into four categories, each with different implementation requirements.

1. Automatically Collected Events

These fire automatically when you install GA4 without any additional configuration:

EventTrigger
`first_visit`User's first visit to your site
`session_start`New session begins
`page_view`Page loads or browser history changes
`user_engagement`User has 1+ second of focus on page

These require no code. They're always on.

2. Enhanced Measurement Events

These are automatic but need to be enabled in your data stream settings (Admin → Data Streams → your stream → Enhanced Measurement):

EventTrigger
`scroll`User reaches 90% of page depth
`click`Outbound link clicks
`view_search_results`Site search results page
`video_start`, `video_progress`, `video_complete`YouTube embeds
`file_download`Clicks on document, PDF, image links
`form_start`, `form_submit`Form interactions

Enable all of these. They provide significant engagement signal with zero implementation effort.

One caveat: Enhanced Measurement's form_submit event is unreliable for custom-built forms (React forms, multi-step forms, AJAX submissions). For those, implement custom events.

3. Recommended Events

These are events Google defines with a standard schema — standard event names with standard parameter names. Using recommended event names ensures maximum compatibility with GA4 reports, predictive features, and Google Ads.

Key recommended events for lead gen/SaaS:

// User signs up for account
gtag('event', 'sign_up', {
  method: 'email'  // or 'google', 'facebook'
javascript

// User logs in gtag('event', 'login', { method: 'email' });

// Lead generated (form submission, demo request) gtag('event', 'generate_lead', { currency: 'USD', value: 50.00 // estimated lead value }); `

Key recommended events for e-commerce:

// Product viewed
gtag('event', 'view_item', {
  currency: 'USD',
  value: 49.99,
  items: [{
    item_id: 'SKU_001',
    item_name: 'Product Name',
    item_category: 'Category',
    price: 49.99,
    quantity: 1
  }]
javascript

// Add to cart gtag('event', 'add_to_cart', { currency: 'USD', value: 49.99, items: [{ item_id: 'SKU_001', item_name: 'Product Name', price: 49.99, quantity: 1 }] });

// Purchase completed gtag('event', 'purchase', { transaction_id: 'T_12345', value: 49.99, currency: 'USD', items: [{ item_id: 'SKU_001', item_name: 'Product Name', price: 49.99, quantity: 1 }] }); `

4. Custom Events

Custom events are for anything not covered by recommended events. They can carry any parameters you define.

// Custom event: user clicks a specific CTA
gtag('event', 'cta_click', {
  cta_location: 'hero',
  cta_text: 'Start Audit',
  page_type: 'landing'
javascript

// Custom event: user filters a product list gtag('event', 'filter_applied', { filter_type: 'price_range', filter_value: '0-100' }); `

Custom events do NOT appear in standard GA4 reports until you register their parameters as custom dimensions. See the section on custom dimensions below.

Implementing Events via GTM vs Direct gtag

Via Google Tag Manager (Recommended for Most Teams)

Using GTM's dataLayer gives you the cleanest separation between developers and analysts. Developers push structured data; analysts build tags without touching code.

// Developer pushes this from the application
window.dataLayer = window.dataLayer || [];
dataLayer.push({
  event: 'generate_lead',
  lead_source: 'contact_form',
  lead_value: 50,
  form_id: 'contact-main'
});
javascript

In GTM, you then create: - A Custom Event trigger listening for generate_lead - DataLayer variables for lead_source, lead_value, form_id - A GA4 Event tag with event name generate_lead and the variables mapped as parameters

Via Direct gtag.js

If you don't use GTM, call gtag('event', ...) directly from your application code:

// After form submission succeeds
document.getElementById('contact-form').addEventListener('submit', function(e) {
  e.preventDefault();
  // ... handle form submission ...
  gtag('event', 'generate_lead', {
    lead_source: 'contact_form',
    value: 50,
    currency: 'USD'
  });
});
javascript

Custom Dimensions and Metrics

Event parameters are collected by GA4 but they don't appear in reports until you register them as custom dimensions (for string values) or custom metrics (for numeric values).

To register a custom dimension: 1. Go to Admin → Custom definitions 2. Click Create custom dimension 3. Enter the dimension name (what appears in reports), scope (Event or User), and the exact parameter name from your events 4. Save — it can take up to 24 hours to appear in reports

Scope choices:

- Event scope: The parameter value applies only to the event it was sent with (e.g., `cta_text`)

- User scope: The parameter value persists on the user profile and applies to future events (e.g., `user_plan`, `account_type`)

// Setting a user-scoped property (persists across sessions)
gtag('set', 'user_properties', {
  account_type: 'premium',
  user_industry: 'ecommerce'
});
javascript

GA4 allows up to 50 event-scoped custom dimensions and 25 user-scoped custom dimensions per property on the standard tier.

Marking Events as Key Events (Conversions)

In GA4, conversions are called key events. To mark any event as a key event:

  1. Go to Admin → Key events
  2. Click Create key event
  3. Enter the exact event name
  4. Choose the counting method: Once per session (typically for leads) or Multiple times per session (for e-commerce)

Key events you should configure for most businesses: - generate_lead — once per session - purchase — multiple times per session - sign_up — once per session - begin_checkout — once per session (for funnel analysis)

Common Event Tracking Mistakes

Sending PII in event parameters: Never send email addresses, names, or phone numbers as event parameters. This violates GA4's terms of service and privacy regulations. Use user IDs instead.

Inconsistent event naming: `Add_To_Cart`, `addToCart`, and `add_to_cart` are three different events in GA4. Standardize on snake_case and document your naming convention.

Forgetting to register custom dimensions: You send a `cta_click` event with a `cta_location` parameter, but it never appears in reports because you forgot to register the custom dimension.

No deduplication on purchase events: If your thank-you page can be refreshed or revisited, the `purchase` event fires multiple times for the same transaction. Use session storage to check if you've already fired the event for a given `transaction_id`.

// Prevent duplicate purchase events
const tid = 'T_12345';
if (!sessionStorage.getItem('purchase_fired_' + tid)) {
  gtag('event', 'purchase', { transaction_id: tid, value: 49.99, currency: 'USD', items: [] });
  sessionStorage.setItem('purchase_fired_' + tid, '1');
}
javascript

Audit whether your GA4 events are correctly structured and firing on the right actions — run a property audit →

Check your GA4 implementation

Run a free AI-powered audit to see how your tracking stacks up.

Start Free Audit