# Create experiments

> Creating an experiment automatically generates a campaign with the same name. This campaign appears in your main campaign list and contributes to the analytics data related to your campaigns. All campaigns generated by creating an experiment are standard campaigns by default.

> For the complete documentation index, see [llms.txt](https://docs.talon.one/llms.txt).

## Create an experiment

To create an experiment:

1. Select the Application where you want to create your experiment.
1. From the left-side menu, click <Experiment className="icon"/> **Experiments**.
1. Click <Add className="icon"/> **Create experiment**.
1. In **Name**, type a name for the experiment.
1. (Optional) In **Description**, enter some information to help you identify the
   experiment.
1. In **Schedule**, define a start date, end date, or both:
   - **Start date**: Date and time when the experiment starts <StateLabel type="running"
     name="Running" />.
   - **End date**: Date and time when the experiment becomes <StateLabel type="expired"
     name="Expired" />.

    You can modify an experiment schedule at any point.

    :::note
    For the most reliable results, we recommend running an experiment for a duration of
    **at least two weeks**.
    :::

1. In **Experiment type**, select between two options:
   - **Random variant assignment**: Select this to allow Talon.One to randomly assign
     customers to Variant A or Variant B.
   - **External variant assignment**: Select this if you are using an external platform,
     such as your own CRM or a third-party testing tool, to decide which variant a
     customer is assigned to.

     To assign a customer to a variant, your development team must pass the experiment ID
     and variant ID for each experiment in the `experimentVariantAllocations` array of
     each
     [session update](/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2).
     Sessions must contain the customer profile ID to ensure they are consistently
     assigned to one variant.

     You can find the experiment ID and variant ID in the Campaign Manager as follows:

     - **Experiment ID**: In the
       [experiment dashboard](/docs/product/campaigns/experiments/manage-experiments#evaluate-experiment-results),
       this ID is shown under the experiment name. Click <Copy className="icon" /> next to
       it to copy the value.
     - **Variant ID**: In the [Rule Builder](#create-rules-for-the-experiment), under
       **Variant split**, the ID for each variant is shown in the **Variant ID** field.

     In this example, we'll use the following payload to show an external variant
     assignment session:

     ```json
     {
       "customerSession": {
         "profileId": "customer456",
         "experimentVariantAllocations": [
           {
             "experimentID": 661,
             "variantID": 2
           },
           {
             "experimentID": 3,
             "variantID": 5
           }
         ],
         "cartItems": [
           {"sku": "PROD002", "quantity": 1}
         ]
       }
     }
     ```

1. Click **Next**.
1. (Optional) In **Features**, select which features you want to enable, for example
   **Coupons** or **Loyalty**.

   :::note
   You can
   [enable or disable a feature](/docs/product/campaigns/settings/manage-campaign-features.md)
   after creating an experiment.
   :::

1. In **Goal**, set the [goal](/docs/product/campaigns/experiments/experiment-goals.md)
   for the experiment:
   - Select the
     [goal type](/docs/product/campaigns/experiments/experiment-goals#goal-types-and-primary-metrics)
     that matches your objective.
   - (Optional) In [**Hypothesis**](/docs/product/campaigns/experiments/experiment-goals#hypothesis), enter the assumption you want to test.

   :::note
   You can [set or edit a goal](#set-or-edit-an-experiment-goal) any time before you
   activate the experiment.
   :::

1. Click **Create experiment**.

## Create rules for the experiment

After you've created an experiment, you can test the two variants using the same set of
[rules](/docs/product/rules/overview). For example, you can test a **10% discount**
against a **$5 discount** for all customers whose session total is over $50.

To open the Rule Builder, click an experiment and select <RuleBuilder className="icon"/>
**Rule Builder**. You can then create rules for the experiment as follows:

1. In **Conditions**, set a [condition](/docs/product/rules/conditions/overview) that
   applies to both variants.
1. In **Variant split**, choose from the following options:
   - In **Variant name**, set names for each variant. The
     [experiment dashboard](/docs/product/campaigns/experiments/manage-experiments.md)
     displays these names in the column header of each variant respectively.
   - The **Allocation** fields appear when you are using the **Random variant assignment**
     experiment type. You can set the percentage of customer traffic allocated to each
     variant in these fields.
   - The **Variant ID** fields appear when you are using the **External variant
     assignment** experiment type. You can enter the ID from the CRM or third-party
     testing tool that references the respective variant in each session.
1. In **Effects**, set [effects](/docs/product/rules/effects/overview) that apply to each
   variant's customer sessions respectively. Do not set effects for a variant that you
   want to use as a control group.
1. In the top-right corner of the page, click **Save Rules**.

Rules are evaluated as long as the experiment is active.

## Set or edit an experiment goal

Before you activate an experiment, you can set or edit its goal.

To set or edit an experiment goal:

1. From the left-side menu, click <Experiment className="icon"/> **Experiments**.
1. Click the name of an experiment.
1. On the left-side menu of the experiment, under **Settings**, click <Goal
   className="icon"/> **Goal**.
1. In **Experiment strategy**, select a goal type.
1. (Optional) In **Hypothesis**, enter the outcome you want to test.
1. Click **Save**.

## Activate an experiment

After you create rules for an experiment, you can activate it at any time.

To activate an experiment:

1. On the left-side menu of the experiment, click <Dashboard className="icon"/>
   **Dashboard**.
1. Click **Activate experiment**.

You cannot edit an experiment's goal, conditions, variant split, or effects
after you activate it. Note that this restriction remains in place if you disable
the experiment. This guarantees the validity of the data you are collecting. You can still
update an active experiment's schedule, features, and other settings, in the same way as
[campaign settings](/docs/product/campaigns/settings/overview).

 To disable an experiment:

1. On the left-side menu of the experiment, click <Dashboard className="icon"/>
   **Dashboard**.
1. Click **Disable experiment**.

## Related pages

- [Experiment goals](/docs/product/campaigns/experiments/experiment-goals.md)
- [Manage experiments](/docs/product/campaigns/experiments/manage-experiments.md)
- [Campaigns](/docs/product/campaigns/overview.md)
- [Rules](/docs/product/rules/overview)
