AI Max for Search campaigns is a suite of AI-powered features for
[Google Ads Search campaigns](https://developers.google.com/google-ads/api/docs/campaigns/search-campaigns/getting-started).
It is not a new campaign type, but rather an optimization layer you can enable
within an existing Search campaign. AI Max for Search campaigns is designed to
use Google AI to help advertisers get more conversions and improve performance
by expanding reach, tailoring creatives, and optimizing landing pages.

## Key features and functionalities of AI Max for Search campaigns

- **Search term matching:** Uses Google AI, including broad match and
  "keywordless" technology, to expand your reach beyond your existing
  keywords. It learns from your current keywords, ad creatives, and URLs to
  find new, relevant, and high-performing search queries you might otherwise
  miss.

- **Asset optimization:** Includes two components that work together to
  deliver more tailored creative messages at scale:

  - **Text customization (formerly Automatically Created Assets):** Uses text from your existing ads, landing page copy, and generative AI to create customized ad copy, headlines, and descriptions that are more relevant to a user's search.
  - **Final URL expansion:** Automatically sends users to the most relevant landing page on your website based on their search intent, which can help improve engagement and conversion rates.

  **Asset automation control:** To turn these features on or off with the
  API, set [`AssetAutomationStatusEnum.AssetAutomationStatus`](https://developers.google.com/google-ads/api/reference/rpc/v26/AssetAutomationStatusEnum.AssetAutomationStatus) to
  `OPTED_IN` (enabled) or `OPTED_OUT` (disabled) within
  [`Campaign.asset_automation_settings`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign#asset_automation_settings%5B%5D) for the corresponding
  [`AssetAutomationType`](https://developers.google.com/google-ads/api/reference/rpc/v26/AssetAutomationTypeEnum.AssetAutomationType) (`TEXT_ASSET_AUTOMATION` for text customization
  and `FINAL_URL_EXPANSION_TEXT_ASSET_AUTOMATION` for final URL expansion):
  - **Default status:** In Search campaigns, both `TEXT_ASSET_AUTOMATION` and `FINAL_URL_EXPANSION_TEXT_ASSET_AUTOMATION` default to `OPTED_OUT` (setting [`Campaign.ai_max_setting.enable_ai_max`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.AiMaxSetting#enable_ai_max) to `true` only enables search term matching by default).
  - **AI Max for Search campaigns requirement:** Setting either type to `OPTED_IN` requires [`Campaign.ai_max_setting.enable_ai_max`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.AiMaxSetting#enable_ai_max) to be `true`; otherwise, the mutate fails with [`CampaignError.AI_MAX_MUST_BE_ENABLED`](https://developers.google.com/google-ads/api/reference/rpc/v26/CampaignErrorEnum.CampaignError#ai_max_must_be_enabled).
  - **Final URL expansion dependency:** Setting `FINAL_URL_EXPANSION_TEXT_ASSET_AUTOMATION` to `OPTED_IN` also requires `TEXT_ASSET_AUTOMATION` to be `OPTED_IN`; opting in to final URL expansion while `TEXT_ASSET_AUTOMATION` is `OPTED_OUT` (or explicitly setting `TEXT_ASSET_AUTOMATION` to `OPTED_OUT` while `FINAL_URL_EXPANSION_TEXT_ASSET_AUTOMATION` remains `OPTED_IN`) fails with [`ContextError.OPERATION_NOT_PERMITTED_FOR_CONTEXT`](https://developers.google.com/google-ads/api/reference/rpc/v26/ContextErrorEnum.ContextError#operation_not_permitted_for_context).
- **Enhanced reporting:** AI Max for Search campaigns includes improved reporting to give
  advertisers more transparency into how the AI is performing. The
  [`ai_max_search_term_ad_combination_view`](https://developers.google.com/google-ads/api/reference/rpc/v26/AiMaxSearchTermAdCombinationView) report provides data on
  performance for combinations of search terms, headlines, and landing pages.
  This view shows which search queries triggered your ads and how those
  specific combinations performed. See
  [Reports for AI Max for Search campaigns](https://developers.google.com/google-ads/api/docs/campaigns/ai-max-for-search-campaigns/ai-max-reporting).

- **Additional controls:** AI Max for Search campaigns provides new controls to give
  advertisers more precision. These include:

  - **Location of interest targeting:** Lets you target customers based on their geographical intent at the ad group level by creating a positive (`negative = false`) [`AdGroupCriterion`](https://developers.google.com/google-ads/api/reference/rpc/v26/AdGroupCriterion) with [`location`](https://developers.google.com/google-ads/api/reference/rpc/v26/AdGroupCriterion#location) ([`LocationInfo`](https://developers.google.com/google-ads/api/reference/rpc/v26/LocationInfo)). This feature requires AI Max for Search campaigns to be enabled and is reported in [`matched_location_interest_view`](https://developers.google.com/google-ads/api/fields/v26/matched_location_interest_view).
  - **Brand settings:** Lets you specify which brands your ads are associated with or prevent your ads from appearing alongside specific brands. Configure brand inclusions using [`CampaignCriterion`](https://developers.google.com/google-ads/api/reference/rpc/v26/CampaignCriterion) or [`AdGroupCriterion`](https://developers.google.com/google-ads/api/reference/rpc/v26/AdGroupCriterion) with `brand_list` ([`BrandListInfo`](https://developers.google.com/google-ads/api/reference/rpc/v26/BrandListInfo)) and `negative = false`, or configure campaign-level brand exclusions using [`CampaignCriterion`](https://developers.google.com/google-ads/api/reference/rpc/v26/CampaignCriterion) with `brand_list` and `negative = true` (see [Campaign-level brand exclusions](https://developers.google.com/google-ads/api/docs/campaigns/ai-max-for-search-campaigns/ai-max-reporting#brand-exclusions-config)).
  - **URL inclusions and exclusions:** Lets you include or exclude specific URLs from being used as landing pages (see [Implement page feed
    inclusion lists at the ad group
    level](https://developers.google.com/google-ads/api/docs/campaigns/ai-max-for-search-campaigns/getting-started#implement-page-feed-inclusion-lists) and [Exclude landing
    pages](https://developers.google.com/google-ads/api/docs/campaigns/ai-max-for-search-campaigns/ai-max-reporting#exclude-landing-pages)).
  - **Text guidelines:** Lets you refine brand messages using term exclusions and messaging restrictions.

## Enable AI Max for Search campaigns

To enable AI Max for Search campaigns, set [`Campaign.ai_max_setting.enable_ai_max`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.AiMaxSetting#enable_ai_max) to
`true`.

Query the read-only [`Campaign.ai_max_setting.bundling_required`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.AiMaxSetting#bundling_required)
([`AiMaxBundlingRequired`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.AiMaxSetting.AiMaxBundlingRequired)) field to determine if AI Max for Search campaigns must be
enabled to respect or modify text customization and brand list controls.

Use [`AdGroup.ai_max_ad_group_setting.disable_search_term_matching`](https://developers.google.com/google-ads/api/reference/rpc/v26/AdGroup.AiMaxAdGroupSetting#disable_search_term_matching) to
disable search term matching when a parent campaign has enabled AI Max for Search campaigns.

Starting in **`v25`** , you can also query the read-only
[`Campaign.aca_migration_date_time`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign#aca_migration_date_time) and
[`Campaign.broad_match_migration_date_time`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign#broad_match_migration_date_time) fields to check the timestamp
(`yyyy-MM-dd HH:mm:ss` in the customer's time zone) when an Automatically
Created Assets (ACA) or Broad Match campaign was migrated to AI Max for Search campaigns.

> [!NOTE]
> **Note:** The campaign-level keyword match type setting [`Campaign.keyword_match_type`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign#keyword_match_type) is deprecated (attempting to set it to `BROAD` results in a [`CampaignError.CANNOT_SET_CAMPAIGN_KEYWORD_MATCH_TYPE`](https://developers.google.com/google-ads/api/reference/rpc/v26/CampaignErrorEnum.CampaignError#cannot_set_campaign_keyword_match_type) error). Under AI Max for Search campaigns, all keywords are treated as broad match by default unless search term matching is disabled at the ad group level using [`AdGroup.ai_max_ad_group_setting.disable_search_term_matching`](https://developers.google.com/google-ads/api/reference/rpc/v26/AdGroup.AiMaxAdGroupSetting#disable_search_term_matching), after which the individual keyword match types take effect.

## Disable AI Max for Search campaigns

To disable AI Max for Search campaigns when [`Campaign.ai_max_setting.enable_ai_max`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.AiMaxSetting#enable_ai_max) is
set to `true`, change the value to `false`. If `TEXT_ASSET_AUTOMATION` or
`FINAL_URL_EXPANSION_TEXT_ASSET_AUTOMATION` is `OPTED_IN` in
[`Campaign.asset_automation_settings`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign#asset_automation_settings%5B%5D), you must also set those types to
`OPTED_OUT` in the same request; otherwise, setting `enable_ai_max` to `false`
fails with [`CampaignError.AI_MAX_MUST_BE_ENABLED`](https://developers.google.com/google-ads/api/reference/rpc/v26/CampaignErrorEnum.CampaignError#ai_max_must_be_enabled). Disabling AI Max for Search campaigns
turns off all AI Max for Search campaigns features, and any previously created text
customization assets stop serving. These assets remain available for reporting
if they accumulated impressions.

## Refine brand messages with text guidelines

Text guidelines let you control the output of automatically generated text
assets by specifying term exclusions and messaging restrictions.

To use text guidelines, populate the [`text_guidelines`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign#text_guidelines)
([`Campaign.TextGuidelines`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.TextGuidelines)) field of the [`Campaign`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign) resource:

- **Term exclusions ([`term_exclusions`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.TextGuidelines#term_exclusions%5B%5D)):** Populate `text_guidelines.term_exclusions` with a list of exact words or phrases to be excluded from generated text assets. Each exclusion can be up to 30 characters, with a maximum of 25 exclusions.
- **Messaging restrictions ([`messaging_restrictions`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.TextGuidelines#messaging_restrictions%5B%5D)):** Populate `text_guidelines.messaging_restrictions` with up to 40 [`Campaign.MessagingRestriction`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.MessagingRestriction) objects to guide AI text generation. For each restriction, set [`restriction_text`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.MessagingRestriction#restriction_text) to a unique freeform instruction (1 to 300 characters) and set [`restriction_type`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.MessagingRestriction#restriction_type) to [`RESTRICTION_BASED_EXCLUSION`](https://developers.google.com/google-ads/api/reference/rpc/v26/MessagingRestrictionTypeEnum.MessagingRestrictionType#restriction_based_exclusion) (the only supported restriction type).

## Implement page feed inclusion lists at the ad group level

In the Google Ads UI, you can implement an inclusion list for page feeds at the ad
group level. You can also do this with the Google Ads API.

### Understand the API approach

Unlike the Google Ads UI, the Google Ads API does not have a direct field named
"Inclusion List" for ad groups. Instead, you control which pages from a page
feed can be used for Dynamic Search Ads (DSA) or for features like final URL
expansion within a specific ad group, by creating ad group criteria of type
`WEBPAGE`.

When you set up these `WEBPAGE` criteria, you instruct the system, including
features like AI Max for Search campaigns, to consider only the specified URLs or pages that
match certain custom labels from the campaign's associated page feed for that
particular ad group.

### Implementation steps

1. **Verify campaign prerequisites and link the page feed:**

   - For standard Search ad groups (`AdGroupType.SEARCH_STANDARD`), make sure the parent campaign has both AI Max for Search campaigns enabled ([`Campaign.ai_max_setting.enable_ai_max`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign.AiMaxSetting#enable_ai_max) set to `true`) and text customization opted in (`TEXT_ASSET_AUTOMATION` set to `OPTED_IN` in [`Campaign.asset_automation_settings`](https://developers.google.com/google-ads/api/reference/rpc/v26/Campaign#asset_automation_settings%5B%5D)). Otherwise, creating a `WEBPAGE` `AdGroupCriterion` fails with [`CriterionError.AI_MAX_MUST_BE_ENABLED`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionErrorEnum.CriterionError#ai_max_must_be_enabled).
   - Before you configure ad-group-level inclusions, the page feed, which is represented as an [`AssetSet`](https://developers.google.com/google-ads/api/reference/rpc/v26/AssetSet) of type `PAGE_FEED`, must be linked to the parent campaign.
   - Use [`CampaignAssetSetService`](https://developers.google.com/google-ads/api/reference/rpc/v26/CampaignAssetSetService) to create this association. This link makes the feed's contents available for targeting within the campaign.
2. **Create the ad group criterion as an inclusion list:**

   - To specify which parts of the page feed apply to a specific ad group, use the [`AdGroupCriterionService`](https://developers.google.com/google-ads/api/reference/rpc/v26/AdGroupCriterionService).
   - Create a new [`AdGroupCriterion`](https://developers.google.com/google-ads/api/reference/rpc/v26/AdGroupCriterion) resource with `negative` set to `false` (in `SEARCH_STANDARD` ad groups, only positive `WEBPAGE` criteria are permitted; setting `negative` to `true` fails with [`ContextError.OPERATION_NOT_PERMITTED_FOR_CONTEXT`](https://developers.google.com/google-ads/api/reference/rpc/v26/ContextErrorEnum.ContextError#operation_not_permitted_for_context)).
   - Set the `ad_group` field to the resource name of the target ad group.
   - Set the criterion type to `WEBPAGE` by populating the `webpage` field of the `AdGroupCriterion`.
   - Inside the [`WebpageInfo`](https://developers.google.com/google-ads/api/reference/rpc/v26/WebpageInfo) object, set [`criterion_name`](https://developers.google.com/google-ads/api/reference/rpc/v26/WebpageInfo#criterion_name) (required on `CREATE` operations) and define [`conditions[]`](https://developers.google.com/google-ads/api/reference/rpc/v26/WebpageInfo#conditions%5B%5D) with [`WebpageConditionInfo`](https://developers.google.com/google-ads/api/reference/rpc/v26/WebpageConditionInfo) objects to target specific pages from your feed (in `SEARCH_STANDARD` ad groups, only the `URL` and `CUSTOM_LABEL` [`WebpageConditionOperand`](https://developers.google.com/google-ads/api/reference/rpc/v26/WebpageConditionOperandEnum.WebpageConditionOperand) types are supported; other operands fail with [`ContextError.OPERATION_NOT_PERMITTED_FOR_CONTEXT`](https://developers.google.com/google-ads/api/reference/rpc/v26/ContextErrorEnum.ContextError#operation_not_permitted_for_context)):
     - **Target by URL:** Use `WebpageConditionOperand.URL`, set `operator` ([`WebpageConditionOperator`](https://developers.google.com/google-ads/api/reference/rpc/v26/WebpageConditionOperatorEnum.WebpageConditionOperator)) to `CONTAINS` (the default when `operator` is omitted) or `EQUALS`, and specify the URL in the `argument`. When `operator` is `CONTAINS`, `argument` can be a URL substring or path (such as `"/product/widget-a"`) and can be combined with other conditions (up to three conditions total). When `operator` is `EQUALS`, `argument` must be a full `http://` or `https://` URL with a valid domain (passing a relative path fails with [`CriterionError.WEBPAGE_CONDITION_URL_UNSUPPORTED_PROTOCOL`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionErrorEnum.CriterionError#webpage_condition_url_unsupported_protocol) or [`CriterionError.INVALID_WEBPAGE_CONDITION_URL`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionErrorEnum.CriterionError#invalid_webpage_condition_url)), and a `URL` `EQUALS` condition cannot be combined with any other conditions in [`conditions[]`](https://developers.google.com/google-ads/api/reference/rpc/v26/WebpageInfo#conditions%5B%5D) (doing so fails with a [`WEBPAGE_CRITERION_URL_EQUALS_CAN_HAVE_ONLY_ONE_CONDITION`](https://developers.google.com/google-ads/api/reference/rpc/v26/CriterionErrorEnum.CriterionError#webpage_criterion_url_equals_can_have_only_one_condition) `CriterionError`).
     - **Target by custom label:** Use `WebpageConditionOperand.CUSTOM_LABEL`, set `operator` to `EQUALS` (the only supported operator and the default when `operator` is omitted), and specify the label name in the `argument`.
   - You can add up to three conditions per `WebpageInfo` (logically ANDed, unless using a `URL` `EQUALS` condition, which must be the only condition), and create multiple positive `WEBPAGE` criteria in the ad group. Pages that match any of these positive `WEBPAGE` criteria form the "Inclusion List" for the ad group.

   > [!NOTE]
   > **Note:** The [`conditions[]`](https://developers.google.com/google-ads/api/reference/rpc/v26/WebpageInfo#conditions%5B%5D) field is a list of `WebpageConditionInfo` objects that are logically ANDed together---a webpage must match all conditions in the list to match that `AdGroupCriterion`. To target webpages that match one condition OR another, create separate `AdGroupCriterion` resources (each with its own `webpage` field of type `WebpageInfo`) within the same ad group.

   In this example, this `AdGroupCriterion` tells the ad group to only consider
   pages from the campaign's page feed that have the URL containing
   `/product/widget-a` AND are tagged with the `TopSellers` custom label.

       {
         "ad_group": "customers/CUSTOMER_ID/adGroups/AD_GROUP_ID",
         "webpage": {
           "criterion_name": "Ad group inclusion criterion for top widgets",
           "conditions": [
             {
               "operand": "URL",
               "operator": "CONTAINS",
               "argument": "/product/widget-a"
             },
             {
               "operand": "CUSTOM_LABEL",
               "operator": "EQUALS",
               "argument": "TopSellers"
             }
           ]
         },
         "negative": false
       }