Managing audience exclusions across multiple Google Ads campaigns can be time-consuming and error-prone when done manually. Whether you’re excluding career page visitors, existing customers, or low-performing segments, doing this one campaign at a time is inefficient.

This guide shows you how to use Google Ads Scripts to automatically exclude specific audiences from all campaigns in your account—saving hours of manual work and ensuring consistent exclusion logic across your advertising strategy.

Why Exclude Audiences from Google Ads Campaigns?

Audience exclusions are a critical optimization technique that prevents wasted ad spend and improves campaign performance. Here are the most common scenarios where you’d want to exclude audiences:

1. Exclude Existing Customers

If you’re running acquisition campaigns, you don’t want to show ads to people who already purchased. Excluding existing customers prevents:

  • Wasted budget on users who already converted
  • Poor user experience (showing acquisition offers to existing customers)
  • Inflated costs without incremental value

2. Exclude Career Page Visitors

Job seekers visiting your careers page aren’t your target customers. Excluding this audience from remarketing campaigns improves:

  • Conversion rates (fewer non-buyers in your remarketing pools)
  • Ad relevance scores
  • Cost efficiency

3. Exclude Low-Intent Segments

Audiences that consistently don’t convert should be excluded to optimize budget allocation. Use GA4 attribution analysis to identify poor-performing segments before excluding them.

4. Exclude Competitors and Partners

If you’ve created audiences of competitor employees or partner companies, excluding them prevents skewed metrics and wasted impressions.


The Manual Way vs. Automated Script Approach

Manual Exclusion (Time-Consuming)

To exclude an audience manually across campaigns, you’d need to:

  1. Open each campaign individually
  2. Navigate to Audiences
  3. Click “Exclusions”
  4. Search for the audience
  5. Add exclusion
  6. Save
  7. Repeat for every campaign

Time required: 2-3 minutes per campaign × 50 campaigns = 100-150 minutes

Automated Script (Efficient)

With Google Ads Scripts, you can exclude an audience from all campaigns in seconds:

  1. Paste the script
  2. Set the audience name
  3. Run once

Time required: 2 minutes total (regardless of campaign count)


The Complete Google Ads Audience Exclusion Script

This script automatically excludes a specified audience from all campaigns in your Google Ads account. It’s particularly useful when onboarding new accounts or performing regular audience hygiene audits.

//Exclude audiences from Google ads - Geek-KB - Meni Lavie

function main() {
  // Set the audience name you want to exclude
  var audienceName = "Audience_to_exclude";

  // Get the Google Ads account
  var account = AdsApp.currentAccount();

  // Get all campaigns in the account
  var campaigns = AdsApp.campaigns().get();

  // Iterate through each campaign
  while (campaigns.hasNext()) {
    var campaign = campaigns.next();

    // Exclude the audience from the campaign
    excludeAudienceFromCampaign(campaign, audienceName);
  }
}

// Function to exclude audience from a campaign
function excludeAudienceFromCampaign(campaign, audienceName) {
  // Get the audience criterion to exclude
  var audienceCriterion = getAudienceCriterionByName(audienceName);

  // If the audience criterion exists, exclude it from the campaign
  if (audienceCriterion) {
    campaign.excludeAudience(audienceCriterion);
    Logger.log("Excluded audience '" + audienceName + "' from campaign '" + campaign.getName() + "'.");
  } else {
    Logger.log("Audience '" + audienceName + "' not found.");
  }
}

// Function to get audience criterion by name
function getAudienceCriterionByName(audienceName) {
  var audienceCriterion = null;

  // Get the audience criteria in the account
  var criteria = AdsApp.targeting().audiences().get();

  // Iterate through each criterion
  while (criteria.hasNext()) {
    var criterion = criteria.next();
    var criterionName = criterion.getAudience().getAudienceName();

    // Check if the criterion matches the specified audience name
    if (criterionName === audienceName) {
      audienceCriterion = criterion;
      break;
    }
  }

  return audienceCriterion;
}

Step-by-Step: How to Use the Script

Step 1: Access Google Ads Scripts

  1. Log in to your Google Ads account
  2. Click Tools & Settings (wrench icon)
  3. Under Bulk Actions, select Scripts
  4. Click the + (Plus) button to create a new script

Step 2: Configure the Script

  1. Copy the script code above
  2. Paste it into the Google Ads Scripts editor
  3. Modify line 4: var audienceName = "Audience_to_exclude";
  4. Replace "Audience_to_exclude" with your actual audience name (exact match required)

Example: If you want to exclude “Career Page Visitors”, change it to:

var audienceName = "Career Page Visitors";

Step 3: Preview and Test

  1. Click Preview to run the script in test mode
  2. Check the Logs panel at the bottom
  3. Verify you see: Excluded audience 'Your Audience Name' from campaign 'Campaign Name'
  4. If you see “Audience not found”, check your audience name spelling

Step 4: Run the Script

  1. Once preview looks correct, click Save
  2. Name the script: “Exclude [Audience Name] from All Campaigns”
  3. Click Run to execute immediately
  4. Monitor the logs for confirmation

Step 5: Verify Exclusions

  1. Go to any campaign in your account
  2. Click Audiences
  3. Check the Exclusions tab
  4. Confirm your audience appears in the exclusion list

Advanced Use Cases and Modifications

Exclude Multiple Audiences at Once

To exclude several audiences in one script run, modify the code like this:

function main() {
  // List of audiences to exclude
  var audienceNames = [
    "Career Page Visitors",
    "Existing Customers",
    "Competitor Employees"
  ];

  var campaigns = AdsApp.campaigns().get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();

    // Exclude each audience from the campaign
    for (var i = 0; i < audienceNames.length; i++) {
      excludeAudienceFromCampaign(campaign, audienceNames[i]);
    }
  }
}

Exclude from Specific Campaigns Only

To target only campaigns with specific names (e.g., only "Brand" campaigns):

var campaigns = AdsApp.campaigns()
  .withCondition("Name CONTAINS 'Brand'")
  .get();

Exclude from Enabled Campaigns Only

To skip paused or removed campaigns:

var campaigns = AdsApp.campaigns()
  .withCondition("Status = ENABLED")
  .get();

Troubleshooting Common Issues

Error: "Audience not found"

Cause: The audience name doesn't exactly match an existing audience in your account.

Solution:

  • Go to Tools & Settings → Audience Manager
  • Find your audience and copy the exact name (case-sensitive)
  • Paste it into the script's audienceName variable
  • Ensure no extra spaces or special characters

Script Times Out

Cause: Google Ads Scripts have a 30-minute execution limit. Accounts with 1000+ campaigns may hit this limit.

Solution: Process campaigns in batches using .withLimit():

var campaigns = AdsApp.campaigns()
  .withLimit(100) // Process first 100 campaigns
  .get();

Audience Already Excluded

Symptom: Script runs but some campaigns don't show the exclusion.

Cause: The audience may already be excluded from those campaigns. The script won't re-add existing exclusions.

Solution: This is expected behavior. Check the logs to see which campaigns had the exclusion added vs. skipped.


Best Practices for Audience Exclusions

1. Document Your Exclusions

Maintain a spreadsheet of:

  • Audience name
  • Exclusion logic/reason
  • Campaigns excluded from
  • Date applied

2. Test Before Excluding

Before excluding an audience account-wide:

  • Analyze performance in GA4 to understand traffic sources
  • Test exclusion in 1-2 campaigns first
  • Monitor performance for 7-14 days
  • Scale to all campaigns if performance improves

3. Regular Audience Audits

Schedule monthly reviews of:

  • Which audiences are excluded where
  • Whether exclusion logic still applies
  • New audiences that should be excluded

4. Combine with Observation Mode

Before excluding, add the audience in "Observation" mode to:

  • Collect performance data
  • Validate your exclusion hypothesis
  • Make data-driven decisions

When to Run This Script

Use this audience exclusion script in these scenarios:

  • Account onboarding: When taking over a new account, quickly apply standard exclusions
  • New audience creation: After building a new exclusion audience (e.g., purchasers list updated weekly)
  • Campaign launches: Ensure new campaigns inherit proper exclusions from day one
  • Account audits: Verify all campaigns have proper exclusion hygiene
  • Seasonal adjustments: Exclude holiday shoppers from acquisition campaigns post-season

Measuring the Impact of Audience Exclusions

After implementing audience exclusions, track these metrics to validate effectiveness:

Key Performance Indicators

  • Cost per Conversion: Should decrease as wasted spend is eliminated
  • Conversion Rate: Should improve as low-intent users are removed
  • Click-Through Rate: May increase with more relevant audience targeting
  • Impression Share: Budget reallocates to higher-intent audiences

Use GA4 attribution models to understand how audience exclusions impact your conversion paths and optimize accordingly.


Conclusion

Using Google Ads Scripts to exclude audiences from all campaigns simultaneously saves time, reduces manual errors, and ensures consistent audience management across your account. Whether you're excluding existing customers, career page visitors, or low-performing segments, this automation transforms a tedious multi-hour task into a two-minute process.

For maximum impact, combine audience exclusions with proper tracking implementation using GTM for form tracking and comprehensive analysis of traffic sources in GA4.

Next steps:

  1. Identify audiences worth excluding (use GA4 + Google Ads data)
  2. Create those audiences in Google Ads Audience Manager
  3. Run this script to apply exclusions account-wide
  4. Monitor performance for 14-30 days
  5. Iterate and refine your exclusion strategy

Using Google Ads scripts can dramatically speed up account management when onboarding existing accounts, performing audits, or implementing optimization strategies at scale.

Related Articles