5 min read

How to Track Audiences in Google Analytics 4

Audiences in Google Analytics 4 let you group users based on their behavior, so you can analyze specific segments or retarget them in Google Ads. But building meaningful audiences requires tracking the right events first — without proper instrumentation, your audiences will be incomplete or too broad to be useful. If you're setting up GA4 or trying to segment your users more effectively, you need to know how to define audiences that actually reflect your business goals and user behavior patterns.

Set Up Event Tracking

Audiences are built on events. Before you create an audience in GA4, make sure you're tracking the events that matter — purchases, signups, feature usage, plan downgrades, or whatever defines your user segments. Without good event tracking, your audiences will be shallow and unreliable.

Install gtag.js and configure your measurement ID

Add the Google tag to your site's head, or via a tag manager. Replace GA_MEASUREMENT_ID with your actual measurement ID from Admin > Data Streams > Web.

javascript
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'GA_MEASUREMENT_ID');
</script>
Basic GA4 setup via gtag.js

Track custom events

Capture the behaviors that define your audiences. Send event data with gtag('event', 'event_name') and include parameters that describe the action. For example, track when someone views a premium feature, completes a workflow, downloads a report, or engages with a specific content type. Parameters should be meaningful — include product type, feature category, duration, or any detail that helps you build better audience segments later.

javascript
// Track a feature view
gtag('event', 'view_feature', {
  'feature_name': 'premium_dashboard',
  'user_tier': 'free'
});

// Track a conversion or signup
gtag('event', 'sign_up', {
  'method': 'email',
  'plan': 'pro'
});

// Track an engagement event
gtag('event', 'engagement', {
  'engagement_type': 'query_builder',
  'duration_seconds': 120
});
Custom events sent to GA4

Set user properties for segmentation

User properties let you tag users with custom attributes that persist across sessions. Set these early so you can build audiences around user characteristics, not just one-off events.

javascript
// Set user properties
gtag('set', {'user_properties': {
  'subscription_status': 'active',
  'industry': 'saas',
  'usage_level': 'high'
}});

// Or use gtag('config') to set user ID
gtag('config', 'GA_MEASUREMENT_ID', {
  'user_id': 'user_12345',
  'user_properties': {
    'company_size': 'enterprise'
  }
});
User properties for audience segmentation
Tip: Set user properties as soon as you identify the user (after login). GA4 can then retroactively apply those properties to sessions, but you lose data if you set them after the user leaves.

Create Audiences in GA4

Once your events are flowing, go to GA4 and define audiences based on user behavior or properties.

Navigate to the Audiences builder

In GA4, go to Admin > Audiences. Click Create audience. You'll see the audience builder with three main options: segment by user traits (like country or device), by behavior (like specific event history), or by advanced conditions combining both. Pick the approach that matches your use case.

javascript
// Example: audience criteria via the Admin API
// You can create audiences programmatically using the Google Analytics Admin API
const audience = {
  displayName: 'Power Users',
  description: 'Users with 10+ sessions in the last 30 days',
  membershipDurationDays: 30,
  eventCondition: {
    eventName: 'engagement',
    eventParameterCondition: {
      parameterName: 'duration_seconds',
      value: '60',
      matchType: 'GREATER_THAN'
    }
  }
};
Admin API structure for audience creation (reference)

Define audience conditions

Choose between Include (users who match any condition) or Exclude (remove users from the audience). Add conditions based on events, user properties, or cohorts. For example: users who viewed premium features AND spent more than 5 minutes on the site.

javascript
// Track events that feed into audience conditions
gtag('event', 'view_premium_feature', {
  'feature_category': 'analytics',
  'timestamp': new Date().getTime()
});

gtag('event', 'page_view', {
  'page_title': 'Dashboard',
  'session_duration': 300 // 5 minutes in seconds
});
Events used to build audience conditions

Save and test your audience

Click Create audience. GA4 shows an estimate of how many users match the criteria. It takes 24-48 hours for audiences to populate with historical data. You can then view the audience composition under Explore using the User dimension.

Use Audiences for Analysis

Once your audiences are live, use them to analyze user behavior and export them for remarketing.

Filter reports by audience

In any GA4 report, use the Segment filter to compare users in your audience against all users. Go to a standard report like Engagement or Conversion, click + Add segment, and select your audience. GA4 will show you side-by-side metrics for that audience versus all users — engagement rate, event count, average session duration, or conversion rate, depending on the report. This makes it easy to spot patterns in how different user segments behave.

javascript
// Query audience data via the Google Analytics Data API v1
const request = {
  property: 'properties/GA_PROPERTY_ID',
  dateRanges: [
    {
      startDate: '2024-01-01',
      endDate: '2024-03-26'
    }
  ],
  dimensions: [
    { name: 'city' },
    { name: 'deviceCategory' }
  ],
  metrics: [
    { name: 'activeUsers' },
    { name: 'eventCount' },
    { name: 'engagementRate' }
  ],
  dimensionFilter: {
    filter: {
      fieldName: 'audienceName',
      stringFilter: {
        matchType: 'EXACT',
        value: 'Power Users'
      }
    }
  }
};
// Send to analyticData.properties.runReport(request)
Query audience data using the Data API

Export audiences to Google Ads for remarketing

Go to Admin > Linked products and link your Google Ads account (one-time setup). Then go to Audiences and click Share next to your audience. Select the destination (Google Ads, Display & Video 360, etc.) and GA4 syncs your audience automatically. In Google Ads, the audience appears under Audiences, and you can use it in remarketing campaigns, search ads, or audience lists for bid adjustments and targeting.

javascript
// After linking GA4 to Ads, track conversion events that feed back into GA4
// This helps you measure remarketing effectiveness

gtag('event', 'conversion', {
  'value': 99.99,
  'currency': 'USD',
  'transaction_id': 'txn_12345'
});

// Track source of conversion for attribution
gtag('event', 'purchase', {
  'value': 49.99,
  'currency': 'USD',
  'source': 'remarketing'
});
Tracking conversions from remarketing campaigns
Tip: Audiences are additive — they include everyone who met the criteria at any point in the membership duration window (default 30 days). Users may leave the audience if they fall outside the window or no longer match the conditions.

Common Pitfalls

  • Creating audiences without enough event data: GA4 needs at least 100 events per audience member to populate it. Start with broad conditions and narrow down once you have data.
  • Not setting user properties before identifying the user: If you set user_id after an event, that event won't have the user_id attached retroactively.
  • Confusing audience membership with real-time behavior: Audiences show historical matches, not live activity. A user in your 'active users' audience may have gone inactive yesterday.
  • Overlooking the membership duration window: By default, audiences expire after 30 days of inactivity. Users drop out even if they matched criteria once — adjust this in audience settings if you need longer retention.

Wrapping Up

You now have audiences tracking real user behavior in GA4. Use them to understand your best users, find patterns in who converts, and which features drive engagement. Export segments for remarketing in Google Ads or other platforms. Audience data is only useful if it's accurate and maintained — check your audiences quarterly and prune any that no longer align with your business. If you want to sync audiences automatically across Google Analytics, Amplitude, Mixpanel, and other analytics 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