# Split testing

## Splitting traffic from the Flow URL&#x20;

To get a quick start on traffic splitting within Formsort itself, you can assign **weights** to individual variants and direct your responders to the **flow** URL, which looks like `https://<client-id>.formsort.app/flow/<flow-name>`. This will serve a pseudo-random variant according to the weights given.&#x20;

#### Variant Weighting

<figure><img src="https://1036686854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJPnL__mOdr_mLZ8nwf%2Fuploads%2F0W1gbDAwsvkwd7KL1fMq%2Fimage.png?alt=media&#x26;token=64dbe07e-a5ab-4ecf-b225-9321615257b4" alt=""><figcaption></figcaption></figure>

Assigning **weight** to deployed variants will distribute flow visitors according to the weight given to the variant. For instance, say a flow has two variants - variant A and variant B - and both have a weight of 50. When the flow URL is loaded, half of the responders will be sent to variant A and the other half to variant B.&#x20;

{% hint style="info" %}
Only *new* traffic is split among variants according to weight. Once the user has interacted with a specific variant, that [variant UUID](https://docs.formsort.com/core-concepts/versioning-in-formsort-deploying/variant-revisions#variant-revision-uuid) will be stored in their browser.&#x20;

If they revisit the form from the same browser at a later time, the cached variant will be loaded for them and weighted variants will no longer be randomly served.
{% endhint %}

## Split testing from Custom Domains

<figure><img src="https://1036686854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJPnL__mOdr_mLZ8nwf%2Fuploads%2FoG9NC9kUY2t1je31BBSa%2Fimage.png?alt=media&#x26;token=55f62ebb-a2aa-487e-9871-055c78f77d69" alt=""><figcaption></figcaption></figure>

Once you have your variants appropriately weighted and your [Custom Domain](https://docs.formsort.com/workspace-management/custom-domains) configured, you can point a flow to your domain and have random variants served to new traffic.&#x20;

In the **Domains** tab of your Studio, pick a flow from the **flow to load for this Hostname** option. Do not specify a variant.&#x20;

{% hint style="info" %}
The flow should have at least 1 deployed variant that can be served to users.&#x20;
{% endhint %}

This is the same process as using a **flow URL** to serve weighted variants, only with an extra layer of addresses. The custom domain points to the flow URL, and Formsort handles splitting incoming traffic.&#x20;

## Split testing via external tools

Another, more comprehensive pattern is to add unique **variant** URLs to an upstream testing tool such as Optimizely. These purpose-built tools are much better at handling traffic splits and can aggregate experiment data that spans across the user journey - either upstream, downstream, or inside of Formsort.

This pattern does not require weight to be added to individual variants, since traffic should be split upstream of Formsort. The only thing you'll need is the [deployed](https://docs.formsort.com/core-concepts/versioning-in-formsort-deploying) variants you want to use, and the URLs for them!  &#x20;

<figure><img src="https://1036686854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJPnL__mOdr_mLZ8nwf%2Fuploads%2FOaFhvKDGndUbOWqScqRz%2Fimage.png?alt=media&#x26;token=77d1e96a-ba7c-4fc4-8311-27fcd0ace6a8" alt=""><figcaption><p>The variant URL</p></figcaption></figure>

{% hint style="info" %}
The variant URL looks the same as a flow URL, only with the path to the variant specified:

`https://<client-id>.formsort.app/flow/<flow-name>/variant/<variant-name>`
{% endhint %}

## Deprecating unused variants

In the process of testing different variants, there will come a point where you'll want to move off a particular variant entirely. The thing to be aware of is that returning responders will still get directed to the variants they have previously interacted with (due to [variant UUID caching](https://docs.formsort.com/core-concepts/versioning-in-formsort-deploying/variant-revisions#pinning)), so it's likely your analytics will pick up events on variants that you thought you deprecated long ago. This can be a problem!&#x20;

The solution here is to [archive](https://docs.formsort.com/flow-variant-management#archiving-flows) the variants you want to deprecate, and set a **redirect to URL**. This pulls old or unwanted variants out of circulation for *all* traffic, and ensures that returning visitors are pushed to the variant you want them to see.&#x20;

But wait, won't [superceding on deployment](https://docs.formsort.com/core-concepts/versioning-in-formsort-deploying#superceding-past-revisions-of-a-variant) push *all* users onto the most recent variant deployment?

For the most part, yes. Deploying a superceding update will:

* ensure *new* users have the most recent variant revision served and,&#x20;
* push users that have previously interacted *with the variant* onto the most recent variant revision.

The users that *will not* get pushed to the "superceded" revision are those that are returning after visiting *a different variant*.&#x20;

#### Example:

Let's say you you're ready to move on from variant A, so you:

* Push a superceding update to variant B.&#x20;
* Point all your links and custom domains to variant B.&#x20;
* Remove the weighting from variant A.

However, there are users have visited variant A already!&#x20;

The returning "A" variant users will still have variant A served when they return to finish their form, even if you've removed weigthing from variant A. This is because the UUID for the variant is still cached in the returning user's browser.&#x20;

At this point, it's time to deprecate variant A entirely:

* [Archive](https://docs.formsort.com/flow-variant-management#archiving-variants) variant A.&#x20;
* During archiving, set the **redirect to URL** to either variant B, [the **flow URL**](#splitting-traffic-from-the-flow-url), or your Custom Domain (which in turn may point to the flow URL).

Once A is archived, **no** users will be able to access it, and returning A variant users will be directed to variant B!&#x20;
