The mutate strategy refers to using
[`AdsApp.mutate`](https://developers.google.com/google-ads/scripts/docs/concepts/mutate) to make API calls
directly, rather than relying on Google Ads scripts specific objects. This has the
benefit of letting you access all features of the API more quickly, and has a
lower barrier to entry if you're already familiar with the API syntax. This is
the only way to modify Search campaigns using Google Ads scripts.

## Create a Search campaign with mutate

This guide assumes that you create the entire campaign in a single atomic
request, rather than creating each individual entity in separate requests. This
means that you'll need to set up and use
[temporary IDs](https://developers.google.com/google-ads/scripts/docs/elements/ids#temporary_ids)
to link resources to each other.

With this in place, create an array to hold all the operations:

    const operations = [];

You will frequently need the customer ID for the customer you're making the
campaign in, since it's required in every resource name.

    const customerId = AdsApp.currentAccount().getCustomerId();

Each time you want to create a new resource, you will use the next temp ID in
the resource name, so that you can reference this object later, and insert the
object created into the array:

    const newOperation = {
        [OPERATION_TYPE_VARIES]: {
            create: {
                resourceName: `customers/${customerId}/[EXACT_PATH_VARIES]/${getNextTempId()}`
                // Other fields, relevant to the resource being created.
            }
        }
    }
    operations.push(newOperation);

You can read more and see an example operation on the
[Google Ads API REST mutate documentation](https://developers.google.com/google-ads/api/rest/common/mutate). Learn
about the [required](https://developers.google.com/google-ads/scripts/docs/campaigns/search/required-components) and [optional](https://developers.google.com/google-ads/scripts/docs/campaigns/search/optional-components)
components of a Search campaign, and create operations for your needs.

Once you have constructed all of your operations, execute them in a single
batch:

    AdsApp.mutateAll(operations);