Stay organized with collections
Save and categorize content based on your preferences.
Experiments are an interface to manage experimental campaigns related to a base
campaign. Experiment campaigns are full-fledged campaigns that can serve ads
and accrue clicks, cost, and other metrics.
The first step in running an experiment using the Google Ads API is to create an
Experiment. This resource defines some key
information about the experiment you want to run, such as a name and experiment
type. You do not specify any of the campaigns involved in the experiment at
this step.
Here's an overview of some key fields for an Experiment:
name: Each experiment must have a unique name.
description: An optional field that you can use to reference later. Does
not affect how the experiment runs.
suffix: The suffix will be appended to the end of the names of the
treatment campaigns so you can distinguish them from the control campaign.
These concepts will be explained further in the experiment
arms page.
type: What type of experiment to run. There are many types here, but most
of them are system experiments. For your custom experiments, you'll want to
specify either SEARCH_CUSTOM or DISPLAY_CUSTOM.
status: When creating an experiment, set this field to SETUP. Later on,
once you begin the experiment, this field will let you check what it's
currently doing
start_date and end_date: Specify when the experiment should start and
end.
sync_enabled: Disabled by default. If set to true, changes made to the
original campaign while your experiment is running are automatically copied
to the experiment campaign. Learn
more.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[[["\u003cp\u003eExperiments in Google Ads allow you to create and manage experimental campaigns to test variations against a base campaign.\u003c/p\u003e\n"],["\u003cp\u003eExperiment campaigns function as independent campaigns, accumulating performance data like clicks, costs, and other metrics.\u003c/p\u003e\n"],["\u003cp\u003eThe initial step involves defining the experiment's parameters, such as name, type, and schedule, using the \u003ccode\u003eExperiment\u003c/code\u003e resource.\u003c/p\u003e\n"],["\u003cp\u003eTo distinguish them from the base campaign, experiment campaigns will have a defined suffix appended to their names.\u003c/p\u003e\n"],["\u003cp\u003eChanges to the original campaign can be automatically synchronized with experiment campaigns by enabling the \u003ccode\u003esync_enabled\u003c/code\u003e option.\u003c/p\u003e\n"]]],[],null,["Experiments are an interface to manage experimental campaigns related to a base\ncampaign. Experiment campaigns are full-fledged campaigns that can serve ads\nand accrue clicks, cost, and other metrics.\n\nThe first step in running an experiment using the Google Ads API is to create an\n[`Experiment`](/google-ads/api/reference/rpc/v20/Experiment). This resource defines some key\ninformation about the experiment you want to run, such as a name and experiment\ntype. You do not specify any of the campaigns involved in the experiment at\nthis step.\n\nHere's an overview of some key fields for an `Experiment`:\n\n- `name`: Each experiment must have a unique name.\n- `description`: An optional field that you can use to reference later. Does not affect how the experiment runs.\n- `suffix`: The suffix will be appended to the end of the names of the treatment campaigns so you can distinguish them from the control campaign. These concepts will be explained further in the [experiment\n arms](/google-ads/api/docs/experiments/experiment-arms) page.\n- `type`: What type of experiment to run. There are many types here, but most of them are system experiments. For your custom experiments, you'll want to specify either `SEARCH_CUSTOM` or `DISPLAY_CUSTOM`.\n- `status`: When creating an experiment, set this field to `SETUP`. Later on, once you begin the experiment, this field will let you check what it's currently doing\n- `start_date` and `end_date`: Specify when the experiment should start and end.\n- `sync_enabled`: Disabled by default. If set to `true`, changes made to the original campaign while your experiment is running are automatically copied to the experiment campaign. [Learn\n more](//support.google.com/google-ads/answer/10575537).\n\nHere's an example of creating an experiment:\n\n\nJava \n\n```java\nprivate String createExperimentResource(GoogleAdsClient googleAdsClient, long customerId) {\n ExperimentOperation operation =\n ExperimentOperation.newBuilder()\n .setCreate(\n Experiment.newBuilder()\n // Name must be unique.\n .setName(\"Example Experiment #\" + getPrintableDateTime())\n .setType(ExperimentType.SEARCH_CUSTOM)\n .setSuffix(\"[experiment]\")\n .setStatus(ExperimentStatus.SETUP)\n .build())\n .build();\n\n try (ExperimentServiceClient experimentServiceClient =\n googleAdsClient.getLatestVersion().createExperimentServiceClient()) {\n MutateExperimentsResponse response =\n experimentServiceClient.mutateExperiments(\n Long.toString(customerId), ImmutableList.of(operation));\n String experiment = response.getResults(0).getResourceName();\n System.out.printf(\"Created experiment with resource name '%s'%n\", experiment);\n return experiment;\n }\n}https://github.com/googleads/google-ads-java/blob/318a8db046aa77145522a5f462f5e648b01c7b0f/google-ads-examples/src/main/java/com/google/ads/googleads/examples/campaignmanagement/CreateExperiment.java#L126-L148\n \n```\n\nC# \n\n```c#\n/// \u003csummary\u003e\n/// Creates the experiment.\n/// \u003c/summary\u003e\n/// \u003cparam name=\"client\"\u003eThe Google Ads client.\u003c/param\u003e\n/// \u003cparam name=\"customerId\"\u003eThe customer ID for which the call is made.\u003c/param\u003e\n/// \u003creturns\u003eThe resource name of the newly created experiment.\u003c/returns\u003e\nprivate static string CreateAnExperiment(GoogleAdsClient client, long customerId)\n{\n // Get the ExperimentService.\n ExperimentServiceClient experimentService = client.GetService(\n Services.V20.ExperimentService);\n\n // Creates the experiment.\n Experiment experiment = new Experiment()\n {\n // Name must be unique.\n Name = $\"Example Experiment #{ExampleUtilities.GetRandomString()}\",\n Type = ExperimentType.SearchCustom,\n Suffix = \"[experiment]\",\n Status = ExperimentStatus.Setup\n };\n\n // Creates the operation.\n ExperimentOperation operation = new ExperimentOperation()\n {\n Create = experiment\n };\n\n // Makes the API call.\n MutateExperimentsResponse response = experimentService.MutateExperiments(\n customerId.ToString(), new[] { operation });\n\n // Displays the result.\n string experimentResourceName = response.Results.First().ResourceName;\n\n Console.WriteLine($\"Created experiment with resource name \" +\n $\"'{experimentResourceName}'.\");\n return experimentResourceName;\n}\nhttps://github.com/googleads/google-ads-dotnet/blob/cefffc9e307398f114d40ffd2e408416bc6d4414/Google.Ads.GoogleAds/examples/CampaignManagement/CreateExperiment.cs#L114-L153\n \n```\n\nPHP \n\n```php\nprivate static function createExperimentResource(\n ExperimentServiceClient $experimentServiceClient,\n int $customerId\n): string {\n // Creates an experiment and its operation.\n $experiment = new Experiment([\n // Name must be unique.\n 'name' =\u003e 'Example Experiment #' . Helper::getPrintableDatetime(),\n 'type' =\u003e ExperimentType::SEARCH_CUSTOM,\n 'suffix' =\u003e '[experiment]',\n 'status' =\u003e ExperimentStatus::SETUP\n ]);\n $experimentOperation = new ExperimentOperation(['create' =\u003e $experiment]);\n\n // Issues a request to create the experiment.\n $response = $experimentServiceClient-\u003emutateExperiments(\n MutateExperimentsRequest::build($customerId, [$experimentOperation])\n );\n $experimentResourceName = $response-\u003egetResults()[0]-\u003egetResourceName();\n print \"Created experiment with resource name '$experimentResourceName'\" . PHP_EOL;\n\n return $experimentResourceName;\n} \nhttps://github.com/googleads/google-ads-php/blob/45840387f17d062046cf39ff5e7043257c865259/examples/CampaignManagement/CreateExperiment.php#L147-L169\n\n \n```\n\nPython \n\n```python\ndef create_experiment_resource(client, customer_id):\n \"\"\"Creates a new experiment resource.\n\n Args:\n client: an initialized GoogleAdsClient instance.\n customer_id: a client customer ID.\n\n Returns:\n the resource name for the new experiment.\n \"\"\"\n experiment_operation = client.get_type(\"ExperimentOperation\")\n experiment = experiment_operation.create\n\n experiment.name = f\"Example Experiment #{uuid.uuid4()}\"\n experiment.type_ = client.enums.ExperimentTypeEnum.SEARCH_CUSTOM\n experiment.suffix = \"[experiment]\"\n experiment.status = client.enums.ExperimentStatusEnum.SETUP\n\n experiment_service = client.get_service(\"ExperimentService\")\n response = experiment_service.mutate_experiments(\n customer_id=customer_id, operations=[experiment_operation]\n )\n\n experiment_resource_name = response.results[0].resource_name\n print(f\"Created experiment with resource name {experiment_resource_name}\")\n\n return experiment_resource_name \nhttps://github.com/googleads/google-ads-python/blob/276b8433a7df6e340cdf36b34158c0b858ed5975/examples/campaign_management/create_experiment.py#L55-L81\n \n```\n\nRuby \n\n```ruby\ndef create_experiment_resource(client, customer_id)\n operation = client.operation.create_resource.experiment do |e|\n # Name must be unique.\n e.name = \"Example Experiment #{(Time.new.to_f * 1000).to_i}\"\n e.type = :SEARCH_CUSTOM\n e.suffix = '[experiment]'\n e.status = :SETUP\n end\n\n response = client.service.experiment.mutate_experiments(\n customer_id: customer_id,\n operations: [operation],\n )\n\n experiment = response.results.first.resource_name\n puts \"Created experiment with resource name #{experiment}.\"\n\n experiment\nend \nhttps://github.com/googleads/google-ads-ruby/blob/8fc9f290d3227df81164520a7b419148e102cfcf/examples/campaign_management/create_experiment.rb#L43-L61\n\n \n```\n\nPerl \n\n```perl\nsub create_experiment_resource {\n my ($api_client, $customer_id) = @_;\n\n my $experiment = Google::Ads::GoogleAds::V20::Resources::Experiment-\u003enew({\n # Name must be unique.\n name =\u003e \"Example Experiment #\" . uniqid(),\n type =\u003e SEARCH_CUSTOM,\n suffix =\u003e \"[experiment]\",\n status =\u003e SETUP\n });\n\n my $operation =\n Google::Ads::GoogleAds::V20::Services::ExperimentService::ExperimentOperation\n -\u003enew({\n create =\u003e $experiment\n });\n\n my $response = $api_client-\u003eExperimentService()-\u003emutate({\n customerId =\u003e $customer_id,\n operations =\u003e [$operation]});\n\n my $resource_name = $response-\u003e{results}[0]{resourceName};\n printf \"Created experiment with resource name '%s'.\\n\", $resource_name;\n return $resource_name;\n}https://github.com/googleads/google-ads-perl/blob/d6411a678e7ccdbc9dcd2d143dd89aff109b6487/examples/campaign_management/create_experiment.pl#L70-L94\n \n```\n\n\u003cbr /\u003e"]]