Performance Max campaigns support the following types of criteria:

- [`AD_SCHEDULE`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionTypeEnum.CriterionType.md.txt#ad_schedule) ([learn more](https://support.google.com/google-ads/answer/2404244))
- [`AGE_RANGE`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionTypeEnum.CriterionType.md.txt#age_range)
- [`BRAND`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionTypeEnum.CriterionType.md.txt#brand)
- [`DEVICE`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionTypeEnum.CriterionType.md.txt#device)
- [`KEYWORD`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionTypeEnum.CriterionType.md.txt#keyword)
- [`LANGUAGE`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionTypeEnum.CriterionType.md.txt#language) ([learn more](https://support.google.com/google-ads/answer/1722078)): [`LanguageInfo`](https://developers.google.com/google-ads/api/reference/rpc/v26/LanguageInfo.md.txt) criteria on Performance Max campaigns apply to non-Search channels; ads shown on Google Search automatically match to users based on the language of your ad creatives and landing pages alongside user language preferences (see [Language targeting criteria](https://developers.google.com/google-ads/api/docs/targeting/criteria.md.txt#language-targeting)). Performance Max campaigns validate targeted languages against the campaign's country code. Attempting to target an unsupported language throws a [`CriterionError.CANNOT_TARGET_LANGUAGE`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionErrorEnum.CriterionError.md.txt#cannot_target_language) error.
- [`LOCATION`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionTypeEnum.CriterionType.md.txt#location) ([learn more](https://support.google.com/google-ads/answer/2453995))
- [`LOCATION_GROUP`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionTypeEnum.CriterionType.md.txt#location_group) ([learn more](https://support.google.com/google-ads/answer/2453995))
- [`WEBPAGE`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionTypeEnum.CriterionType.md.txt#webpage)

Both positive and negative criteria can be used, except for the `BRAND` and
`KEYWORD` criterion type, which can only be used as negative to exclude brands
and keywords from targeting.

For [location targeting](https://developers.google.com/google-ads/api/docs/targeting/location-targeting.md.txt), a campaign with no specified location or location
groups defaults to including all regions. However, Local Services Performance
Max campaigns must retain at least one positive location criterion. Attempting
to remove all positive location criteria from a Local Services Performance Max
campaign results in a
[`CampaignCriterionError.CANNOT_REMOVE_ALL_LOCATIONS_FROM_LOCAL_SERVICES_PMAX_CAMPAIGN`](https://developers.google.com/google-ads/api/reference/rpc/v26/CampaignCriterionErrorEnum.CampaignCriterionError.md.txt#CANNOT_REMOVE_ALL_LOCATIONS_FROM_LOCAL_SERVICES_PMAX_CAMPAIGN)
error.

Performance Max campaigns can have up to 10,000 negative keywords.

Negative `WEBPAGE` criteria can be used to exclude specific URLs from [final URL
expansion](https://developers.google.com/google-ads/api/performance-max/optimizations#final-url). Learn more about [Final URL expansion](https://support.google.com/google-ads/answer/14337539) and
[URL Exclusion](https://support.google.com/google-ads/answer/14337773).


### Java

```java
/** Creates a list of MutateOperations that create new campaign criteria. */
private List<MutateOperation> createCampaignCriterionOperations(long customerId) {
  String campaignResourceName =
      ResourceNames.campaign(customerId, PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID);
  List<CampaignCriterion> campaignCriteria = new ArrayList<>();
  // Sets the LOCATION campaign criteria.
  // Targets all of New York City except Brooklyn.
  // Location IDs are listed here:
  // https://developers.google.com/google-ads/api/reference/data/geotargets
  // and they can also be retrieved using the GeoTargetConstantService as shown
  // here: https://developers.google.com/google-ads/api/docs/targeting/location-targeting
  //
  // We will add one positive location target for New York City (ID=1023191)
  // and one negative location target for Brooklyn (ID=1022762).
  // First, adds the positive (negative = False) for New York City.
  campaignCriteria.add(
      CampaignCriterion.newBuilder()
          .setCampaign(campaignResourceName)
          .setLocation(
              LocationInfo.newBuilder()
                  .setGeoTargetConstant(ResourceNames.geoTargetConstant(1023191))
                  .build())
          .setNegative(false)
          .build());
  // Next adds the negative target for Brooklyn.
  campaignCriteria.add(
      CampaignCriterion.newBuilder()
          .setCampaign(campaignResourceName)
          .setLocation(
              LocationInfo.newBuilder()
                  .setGeoTargetConstant(ResourceNames.geoTargetConstant(1022762))
                  .build())
          .setNegative(true)
          .build());
  // Sets the LANGUAGE campaign criterion.
  campaignCriteria.add(
      CampaignCriterion.newBuilder()
          .setCampaign(campaignResourceName)
          // Sets the language.
          // For a list of all language codes, see:
          // https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7
          .setLanguage(
              LanguageInfo.newBuilder()
                  .setLanguageConstant(ResourceNames.languageConstant(1000)) // English
                  .build())
          .build());
  // Returns a list of mutate operations with one operation per criterion.
  return campaignCriteria.stream()
      .map(
          criterion ->
              MutateOperation.newBuilder()
                  .setCampaignCriterionOperation(
                      CampaignCriterionOperation.newBuilder().setCreate(criterion).build())
                  .build())
      .collect(Collectors.toList());
}

      
```

### C#

```c#
/// <summary>
/// Creates a list of MutateOperations that create new campaign criteria.
/// </summary>
/// <param name="campaignResourceName">The campaign resource name.</param>
/// <returns>A list of MutateOperations that create new campaign criteria.</returns>
private List<MutateOperation> CreateCampaignCriterionOperations(
    string campaignResourceName)
{
    List<MutateOperation> operations = new List<MutateOperation>();

    // Set the LOCATION campaign criteria.
    // Target all of New York City except Brooklyn.
    // Location IDs are listed here:
    // https://developers.google.com/google-ads/api/reference/data/geotargets
    // and they can also be retrieved using the GeoTargetConstantService as shown
    // here: https://developers.google.com/google-ads/api/docs/targeting/location-targeting
    //
    // We will add one positive location target for New York City (ID=1023191)
    // and one negative location target for Brooklyn (ID=1022762).
    // First, add the positive (negative = False) for New York City.
    MutateOperation operation1 = new MutateOperation()
    {
        CampaignCriterionOperation = new CampaignCriterionOperation()
        {
            Create = new CampaignCriterion()
            {
                Campaign = campaignResourceName,
                Location = new LocationInfo()
                {
                    GeoTargetConstant = ResourceNames.GeoTargetConstant(1023191)
                },

                Negative = false
            }
        }
    };

    operations.Add(operation1);

    // Next add the negative target for Brooklyn.
    MutateOperation operation2 = new MutateOperation()
    {
        CampaignCriterionOperation = new CampaignCriterionOperation()
        {
            Create = new CampaignCriterion()
            {
                Campaign = campaignResourceName,
                Location = new LocationInfo()
                {
                    GeoTargetConstant = ResourceNames.GeoTargetConstant(1022762)
                },

                Negative = true
            }
        }
    };

    operations.Add(operation2);

    // Set the LANGUAGE campaign criterion.
    MutateOperation operation3 = new MutateOperation()
    {
        CampaignCriterionOperation = new CampaignCriterionOperation()
        {
            Create = new CampaignCriterion()
            {
                Campaign = campaignResourceName,

                // Set the language.
                // For a list of all language codes, see:
                // https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7
                Language = new LanguageInfo()
                {
                    LanguageConstant = ResourceNames.LanguageConstant(1000) // English
                },
            }
        }
    };

    operations.Add(operation3);

    return operations;
}

      
```

### PHP

```php
private static function createCampaignCriterionOperations(int $customerId): array
{
    $operations = [];
    // Set the LOCATION campaign criteria.
    // Target all of New York City except Brooklyn.
    // Location IDs are listed here:
    // https://developers.google.com/google-ads/api/reference/data/geotargets
    // and they can also be retrieved using the GeoTargetConstantService as shown
    // here: https://developers.google.com/google-ads/api/docs/targeting/location-targeting
    //
    // We will add one positive location target for New York City (ID=1023191)
    // and one negative location target for Brooklyn (ID=1022762).
    // First, adds the positive (negative = false) for New York City.
    $operations[] = new MutateOperation(
        [
        'campaign_criterion_operation' => new CampaignCriterionOperation(
            [
            'create' => new CampaignCriterion(
                [
                'campaign' => ResourceNames::forCampaign(
                    $customerId,
                    self::PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
                ),
                'location' => new LocationInfo(
                    [
                    'geo_target_constant' => ResourceNames::forGeoTargetConstant(1023191)
                    ]
                ),
                'negative' => false
                ]
            )
            ]
        )
        ]
    );

    // Next adds the negative target for Brooklyn.
    $operations[] = new MutateOperation(
        [
        'campaign_criterion_operation' => new CampaignCriterionOperation(
            [
            'create' => new CampaignCriterion(
                [
                'campaign' => ResourceNames::forCampaign(
                    $customerId,
                    self::PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
                ),
                'location' => new LocationInfo(
                    [
                    'geo_target_constant' => ResourceNames::forGeoTargetConstant(1022762)
                    ]
                ),
                'negative' => true
                ]
            )
            ]
        )
        ]
    );

    // Sets the LANGUAGE campaign criterion.
    $operations[] = new MutateOperation(
        [
        'campaign_criterion_operation' => new CampaignCriterionOperation(
            [
            'create' => new CampaignCriterion(
                [
                'campaign' => ResourceNames::forCampaign(
                    $customerId,
                    self::PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
                ),
                // Set the language.
                // For a list of all language codes, see:
                // https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7
                'language' => new LanguageInfo(
                    [
                    'language_constant' => ResourceNames::forLanguageConstant(1000)  // English
                    ]
                )
                ]
            )
            ]
        )
        ]
    );

    return $operations;
}
      
```

### Python

```python
def create_campaign_criterion_operations(
    client: GoogleAdsClient,
    customer_id: str,
) -> List[MutateOperation]:
    """Creates a list of MutateOperations that create new campaign criteria.

    Args:
        client: an initialized GoogleAdsClient instance.
        customer_id: a client customer ID.

    Returns:
        a list of MutateOperations that create new campaign criteria.
    """
    campaign_service: CampaignServiceClient = client.get_service(
        "CampaignService"
    )
    geo_target_constant_service: GeoTargetConstantServiceClient = (
        client.get_service("GeoTargetConstantService")
    )
    googleads_service: GoogleAdsServiceClient = client.get_service(
        "GoogleAdsService"
    )

    operations: List[MutateOperation] = []
    # Set the LOCATION campaign criteria.
    # Target all of New York City except Brooklyn.
    # Location IDs are listed here:
    # https://developers.google.com/google-ads/api/reference/data/geotargets
    # and they can also be retrieved using the GeoTargetConstantService as shown
    # here: https://developers.google.com/google-ads/api/docs/targeting/location-targeting
    #
    # We will add one positive location target for New York City (ID=1023191)
    # and one negative location target for Brooklyn (ID=1022762).
    # First, add the positive (negative = False) for New York City.
    mutate_operation: MutateOperation = client.get_type("MutateOperation")
    campaign_criterion: CampaignCriterion = (
        mutate_operation.campaign_criterion_operation.create
    )
    campaign_criterion.campaign = campaign_service.campaign_path(
        customer_id, _PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
    )
    campaign_criterion.location.geo_target_constant = (
        geo_target_constant_service.geo_target_constant_path("1023191")
    )
    campaign_criterion.negative = False
    operations.append(mutate_operation)

    # Next add the negative target for Brooklyn.
    mutate_operation: MutateOperation = client.get_type("MutateOperation")
    campaign_criterion: CampaignCriterion = (
        mutate_operation.campaign_criterion_operation.create
    )
    campaign_criterion.campaign = campaign_service.campaign_path(
        customer_id, _PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
    )
    campaign_criterion.location.geo_target_constant = (
        geo_target_constant_service.geo_target_constant_path("1022762")
    )
    campaign_criterion.negative = True
    operations.append(mutate_operation)

    # Set the LANGUAGE campaign criterion.
    mutate_operation: MutateOperation = client.get_type("MutateOperation")
    campaign_criterion: CampaignCriterion = (
        mutate_operation.campaign_criterion_operation.create
    )
    campaign_criterion.campaign = campaign_service.campaign_path(
        customer_id, _PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
    )
    # Set the language.
    # For a list of all language codes, see:
    # https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7
    campaign_criterion.language.language_constant = (
        googleads_service.language_constant_path("1000")
    )  # English
    operations.append(mutate_operation)

    return operations
      
```

### Ruby

```ruby
# Creates a list of MutateOperations that create new campaign criteria.
def create_campaign_criterion_operations(client, customer_id)
  operations = []

  # Set the LOCATION campaign criteria.
  # Target all of New York City except Brooklyn.
  # Location IDs are listed here:
  # https://developers.google.com/google-ads/api/reference/data/geotargets
  # and they can also be retrieved using the GeoTargetConstantService as shown
  # here: https://developers.google.com/google-ads/api/docs/targeting/location-targeting
  #
  # We will add one positive location target for New York City (ID=1023191)
  # and one negative location target for Brooklyn (ID=1022762).
  # First, add the positive (negative = false) for New York City.
  operations << client.operation.mutate do |m|
    m.campaign_criterion_operation =
      client.operation.create_resource.campaign_criterion do |cc|
      cc.campaign = client.path.campaign(
        customer_id, PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)
      cc.location = client.resource.location_info do  |li|
        li.geo_target_constant = client.path.geo_target_constant("1023191")
      end
      cc.negative = false
    end
  end

  # Next add the negative target for Brooklyn.
  operations << client.operation.mutate do |m|
    m.campaign_criterion_operation =
      client.operation.create_resource.campaign_criterion do |cc|
      cc.campaign = client.path.campaign(
        customer_id, PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)
      cc.location = client.resource.location_info do  |li|
        li.geo_target_constant = client.path.geo_target_constant("1022762")
      end
      cc.negative = true
    end
  end

  # Set the LANGUAGE campaign criterion.
  operations << client.operation.mutate do |m|
    m.campaign_criterion_operation =
      client.operation.create_resource.campaign_criterion do |cc|
      cc.campaign = client.path.campaign(
        customer_id, PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID)
      # Set the language.
      # For a list of all language codes, see:
      # https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7
      cc.language = client.resource.language_info do |li|
        li.language_constant = client.path.language_constant("1000")  # English
      end
    end
  end

  operations
end
      
```

### Perl

```perl
sub create_campaign_criterion_operations {
  my ($customer_id) = @_;

  my $operations = [];
  # Set the LOCATION campaign criteria.
  # Target all of New York City except Brooklyn.
  # Location IDs are listed here:
  # https://developers.google.com/google-ads/api/reference/data/geotargets
  # and they can also be retrieved using the GeoTargetConstantService as shown
  # here: https://developers.google.com/google-ads/api/docs/targeting/location-targeting.
  #
  # We will add one positive location target for New York City (ID=1023191)
  # and one negative location target for Brooklyn (ID=1022762).
  # First, add the positive (negative = false) for New York City.
  push @$operations,
    Google::Ads::GoogleAds::V26::Services::GoogleAdsService::MutateOperation->
    new({
      campaignCriterionOperation =>
        Google::Ads::GoogleAds::V26::Services::CampaignCriterionService::CampaignCriterionOperation
        ->new({
          create =>
            Google::Ads::GoogleAds::V26::Resources::CampaignCriterion->new({
              campaign =>
                Google::Ads::GoogleAds::V26::Utils::ResourceNames::campaign(
                $customer_id, PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
                ),
              location =>
                Google::Ads::GoogleAds::V26::Common::LocationInfo->new({
                  geoTargetConstant =>
                    Google::Ads::GoogleAds::V26::Utils::ResourceNames::geo_target_constant(
                    1023191)}
                ),
              negative => "false"
            })})});

  # Next add the negative target for Brooklyn.
  push @$operations,
    Google::Ads::GoogleAds::V26::Services::GoogleAdsService::MutateOperation->
    new({
      campaignCriterionOperation =>
        Google::Ads::GoogleAds::V26::Services::CampaignCriterionService::CampaignCriterionOperation
        ->new({
          create =>
            Google::Ads::GoogleAds::V26::Resources::CampaignCriterion->new({
              campaign =>
                Google::Ads::GoogleAds::V26::Utils::ResourceNames::campaign(
                $customer_id, PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
                ),
              location =>
                Google::Ads::GoogleAds::V26::Common::LocationInfo->new({
                  geoTargetConstant =>
                    Google::Ads::GoogleAds::V26::Utils::ResourceNames::geo_target_constant(
                    1022762)}
                ),
              negative => "true"
            })})});

  # Set the LANGUAGE campaign criterion.
  push @$operations,
    Google::Ads::GoogleAds::V26::Services::GoogleAdsService::MutateOperation->
    new({
      campaignCriterionOperation =>
        Google::Ads::GoogleAds::V26::Services::CampaignCriterionService::CampaignCriterionOperation
        ->new({
          create =>
            Google::Ads::GoogleAds::V26::Resources::CampaignCriterion->new({
              campaign =>
                Google::Ads::GoogleAds::V26::Utils::ResourceNames::campaign(
                $customer_id, PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
                ),
              # Set the language.
              # For a list of all language codes, see:
              # https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7.
              language =>
                Google::Ads::GoogleAds::V26::Common::LanguageInfo->new({
                  languageConstant =>
                    Google::Ads::GoogleAds::V26::Utils::ResourceNames::language_constant(
                    1000)    # English
                })})})});

  return $operations;
}
      
```

### curl

> [!NOTE]
> **Note:** While a direct REST code sample for this step isn't provided here, you can achieve this using a manual REST request.   
>
> Refer to the Google Ads API REST interface documentation and the method-specific reference pages. You will need to construct the JSON payload based on the proto definitions.   
>
> Key Resources:
>
> - [Using REST](https://developers.google.com/google-ads/api/rest/overview.md.txt)
> - [REST Interface Structure](https://developers.google.com/google-ads/api/rest/design/overview.md.txt)
> - [JSON Field Mappings](https://developers.google.com/google-ads/api/rest/design/json-mappings.md.txt)
> - Consult the [REST API Reference](https://developers.google.com/google-ads/api/reference/rpc/latest/overview) for the specific service and method.

<br />