7 min read

How to Track User Acquisition in Google Analytics 4

If you can't answer "where did that user come from?", you're operating blind. GA4 is event-based, not pageview-based, so acquisition tracking works differently than it did in Universal Analytics. Here's how to set it up properly.

Set Up UTM Parameters and Campaign Tracking

GA4 automatically captures UTM parameters from your URLs. The trick is consistency—every link from paid channels, email, social, and partnerships needs the same parameter structure.

Add UTM Parameters to All Traffic Sources

Attach utm_source (where traffic comes from), utm_medium (channel type), utm_campaign (promotion name), utm_content (link variant), and utm_term (for keyword data). GA4 extracts these automatically from the URL—no gtag code needed. The source/medium pair (e.g., google / cpc, linkedin / social) becomes your primary acquisition dimension in reports.

javascript
// Construct URLs with UTM parameters
const baseUrl = 'https://yoursite.com/signup';
const params = {
  utm_source: 'twitter',
  utm_medium: 'social',
  utm_campaign: 'product_launch',
  utm_content: 'hero_button',
  utm_term: 'product_analytics'
};

const url = new URL(baseUrl);
Object.entries(params).forEach(([key, value]) => {
  url.searchParams.append(key, value);
});

console.log(url.toString());
// Output: https://yoursite.com/signup?utm_source=twitter&utm_medium=social&utm_campaign=product_launch&utm_content=hero_button&utm_term=product_analytics
GA4 auto-parses UTM parameters from the URL—no tracking code required.

Verify UTM Capture in GA4

Open Reports > Acquisition > Overview to see traffic broken down by source/medium and campaign. If a traffic source doesn't appear, either the UTM parameters weren't attached to the link or traffic came through a different path. Check All traffic to see the full breakdown.

javascript
// GA4 automatically captures these session-level parameters:
// utm_source, utm_medium, utm_campaign, utm_content, utm_term

// In gtag, you can verify capture by logging:
gtag('event', 'page_view', {
  'page_path': '/signup',
  'page_title': 'Sign Up'
  // utm_* parameters are captured automatically by GA4
  // and appear in reports under Acquisition dimensions
});

// Query these in GA4 reports:
// Dimensions: sourceMedium, campaign, source, medium, sessionSource
// Metrics: newUsers, users, sessions, sessionEngagementDuration
GA4 captures UTM parameters at the session level—they're available in all acquisition reports.
Watch out: GA4 uses (source / medium) as a unit, not source alone. A source without a medium won't appear in acquisition reports. Always pair source with medium (e.g., google / organic, facebook / social, newsletter / email).

Fire Custom Acquisition Events for Non-UTM Channels

UTM parameters work for web links, but they miss traffic from API integrations, referral partners, and internal tools. Fire a custom event when new users arrive through these channels.

Create a Custom Acquisition Event

When a new user enters your system—via signup, OAuth, or API—fire a new_user_acquisition event with the source as an event parameter. Attach details like source, medium, campaign, or partner_name so you can segment the event in reports.

javascript
// Fire when a new user signs up or enters the system
gtag('event', 'new_user_acquisition', {
  'acquisition_source': 'partner_api',
  'partner_name': 'zapier',
  'signup_method': 'oauth',
  'user_type': 'freemium'
});

// For referral traffic without UTM parameters:
gtag('event', 'new_user_acquisition', {
  'acquisition_source': 'referral',
  'referrer_domain': new URL(document.referrer || '').hostname,
  'landing_page': window.location.pathname
});

// For traffic from email campaigns:
gtag('event', 'new_user_acquisition', {
  'acquisition_source': 'email',
  'email_campaign': 'welcome_series',
  'email_segment': 'beta_testers'
});
Custom acquisition events capture sources outside your UTM parameters.

Set User Properties to Track Acquisition Lifetime

User properties persist for the entire user lifetime in GA4. Set acquisition_channel, acquisition_date, and other properties on the user's first session so you can segment by acquisition source in future reports—even weeks or months later.

javascript
// Set on first visit
gtag('set', {
  'user_properties': {
    'acquisition_channel': 'paid_search',
    'acquisition_campaign': 'q1_brand_awareness',
    'acquisition_date': new Date().toISOString().split('T')[0],
    'user_type': 'new',
    'country': Intl.DateTimeFormat().resolvedOptions().timeZone
  }
});

// These become queryable dimensions in all GA4 reports
// E.g., filter "Conversions" by acquisition_channel to see
// which channels drive highest-quality users
User properties enable lifetime segmentation—filter any report by acquisition channel.

Validate Events in the Events Report

Go to Reports > Events > new_user_acquisition to confirm events are firing. Check Event count by event parameters to see the distribution across your acquisition_source values. If event count is zero, your tracking isn't initialized correctly.

javascript
// No code—this is a GA4 UI report
// Path: Reports > Events > new_user_acquisition
// View:
// - Event count (= new users acquired via custom events)
// - Top event parameter values (which channels drive traffic)
// - Breakdown by device, country, or user properties

// To export programmatically, use GA4 Data API:
// GET https://analyticsdata.googleapis.com/v1beta/properties/{propertyId}:runReport

const request = {
  property: 'properties/YOUR_PROPERTY_ID',
  dateRanges: [{ startDate: '2026-03-01', endDate: '2026-03-31' }],
  dimensions: [{ name: 'eventName' }, { name: 'eventParameter:acquisition_source' }],
  metrics: [{ name: 'eventCount' }],
  dimensionFilter: {
    filter: { fieldName: 'eventName', stringFilter: { value: 'new_user_acquisition' } }
  }
};
Use GA4 Reports UI or Data API to validate custom acquisition events.
Tip: Set user properties on the first request before firing other events. Once GA4 starts tracking a session, all events in that session are attributed to the user, so capture acquisition context early to avoid missing data.

Analyze Acquisition and Filter by Channel

Once tracking is live, GA4's Acquisition report shows which sources bring users. Use segments and filters to isolate channel performance on conversions and revenue.

Use the Acquisition Report to Compare Channels

Open Reports > Acquisition > Overview. This shows Users and New users by source/medium. Add a secondary dimension—try Campaign or Device category—to slice by acquisition context. Sort by New users to see which channels are most effective at bringing fresh traffic.

javascript
// Query acquisition data via GA4 Data API
const request = {
  property: 'properties/YOUR_PROPERTY_ID',
  dateRanges: [{ startDate: '2026-01-01', endDate: '2026-03-31' }],
  dimensions: [
    { name: 'sourceMedium' },
    { name: 'campaign' }
  ],
  metrics: [
    { name: 'newUsers' },
    { name: 'users' },
    { name: 'conversions' }
  ],
  orderBys: [{ metric: { metricName: 'newUsers' }, desc: true }],
  limit: 50
};

// Call analyticsdata.properties.runReport(request)
// Response: {rows: [{dimensionValues: ['google / cpc', 'brand'], metricValues: ['1250', '3420', '145']}, ...]}
// (newUsers, users, conversions per source/medium/campaign combo)
Use GA4 Data API to fetch acquisition metrics programmatically for dashboards.

Create a Segment for Paid Traffic

In Admin > Segments, build a segment like "Paid Acquisition Users" with the condition: source/medium contains google / cpc or facebook / cpc. Apply this segment to any report to filter for users acquired via paid channels only. This isolates paid channel performance on conversion, engagement, and retention.

javascript
// Segment condition (created in GA4 UI):
// Name: "Paid Acquisition Users"
// Condition: Include: source/medium exactly matches "google / cpc"
// OR source/medium exactly matches "facebook / cpc"

// To filter reports programmatically via Data API:
const request = {
  property: 'properties/YOUR_PROPERTY_ID',
  dateRanges: [{ startDate: '2026-01-01', endDate: '2026-03-31' }],
  dimensions: [{ name: 'sourceMedium' }],
  metrics: [{ name: 'conversions' }, { name: 'conversionValue' }],
  dimensionFilter: {
    andGroup: {
      expressions: [
        { filter: { fieldName: 'sourceMedium', stringFilter: { matchType: 'CONTAINS', value: 'cpc' } } }
      ]
    }
  }
};
// Returns conversions + conversion value by paid source only
Segments let you filter reports to specific acquisition channels.
Watch out: GA4 defaults to last-click attribution—the source before conversion gets all the credit. If a user clicked an ad, left, then returned via direct traffic and converted, direct gets the conversion. Test first-click or linear attribution in Advertising > Attribution to understand your true channel impact.

Common Pitfalls

  • Missing utm_medium in links—GA4 groups by (source / medium), so a link with only utm_source won't show up in Acquisition reports. Always pair source with medium (e.g., google / organic, linkedin / social).
  • Setting user properties too late—if you set acquisition_channel after the first pageview, earlier events won't have that property attached. Capture acquisition data in the first gtag call.
  • Confusing first-click vs. last-click attribution—GA4's default last-click model means a user who clicks an ad but converts via direct traffic credits the direct channel, not the ad. Verify which attribution model matches your business questions.
  • Ignoring non-UTM acquisition channels—if you rely only on UTM parameters, you'll miss traffic from API partners, email campaigns, and referrals. Always fire a custom event when users arrive outside standard web links.

Wrapping Up

You now have visibility into where every new user comes from—whether through Google Ads, organic search, partners, or email. Set up UTM parameters, fire custom acquisition events, and check the Acquisition report weekly to spot which channels are most effective. If you want to track this automatically across tools, Product Analyst can help.

Track these metrics automatically

Product Analyst connects to your stack and surfaces the insights that matter.

Try Product Analyst — Free