Use ABlyftExperiments

Variations

Variation types, the baseline "Original", how to create, edit, clone and delete variations, and how to build redirect and multi-page experiments.

A variation is one version of your page that takes part in an experiment. Every experiment compares at least two variations: the baseline (the unchanged page) and one or more changed versions.

Creating, editing, cloning and deleting variations requires the role member, admin or owner.

The Variations card

The Variations card on the experiment page ("WHAT changes do you want to test?") lists all variations:

ColumnDescription
Color dotA color that identifies the variation. ABlyft assigns it automatically by the position in the list.
NameName and description. The baseline carries the badge Baseline.
TypeThe variation type. Hover over it to see when to use it.
Traffic allocationThe share of the experiment's traffic.
SizeThe combined size of the code and changes of the variation.
Last updatedWhen and by whom the variation was changed.

The baseline "Original"

When you create the first variation of an experiment, ABlyft also creates the variation Original automatically. It has the type Unchanged and is marked as Baseline. All other variations are compared against the baseline in the results.

If you delete the baseline, the oldest remaining variation becomes the new baseline.

Variation types

TypeUse it to
Visual EditorMake quick visual or content changes without writing code: headlines, images, colors, layouts or buttons on your existing page. See Visual editor.
RedirectTest an entirely new landing page or different URL parameters. Visitors in this variation are redirected to the URL you provide.
CodeAdd your own JavaScript and CSS, for dynamic changes or changes beyond what the Visual Editor can do.
UnchangedShow the page exactly as it is. Use it as the original (control) variation.
FullStackRun your own code anywhere in your application. Only available if the experiment has Enable FullStack for this experiment switched on. See FullStack.
Shopify ThemeShow a draft theme of your Shopify store. See Shopify variations.
Shopify TemplateShow an alternative template for a page type of your Shopify store. See Shopify variations.

Create a variation

  1. On the experiment page, click new variation in the Variations card.
  2. Step General: enter a Name (ABlyft suggests Variation #1, Variation #2 and so on) and optionally a Description. For the first variation of an experiment, the note explains that Original is created automatically.
  3. Step Type: choose how you want to build the variation. Click an option to read when to choose it.
  4. Click Create variation.

What happens next depends on the type:

  • Visual Editor: your example URL opens in the editor. See Visual editor.
  • All other types: the variation settings open, where you enter the redirect URL, your code or the Shopify details.

When you create or delete a variation, ABlyft distributes the experiment's traffic evenly across all variations again. Check Traffic Split & Distribution in the experiment settings if you need an uneven split.

Edit a variation

Every row has an Edit button. For a Visual Editor variation it opens the editor, for all other types it opens the variation settings. The menu next to the button offers:

ActionDescription
Edit settingsOpens the variation settings for every type, including Visual Editor variations.
Show in browserOpens the variation on your example URL. Only available while the experiment is in Preview or Running.
CloneCreates a copy of the variation. The copy is never the baseline.
DeleteDeletes the variation.

Settings

The variation settings are grouped into sections:

SectionContent
GeneralName, API Name (only needed for advanced users), Description and Type.
Redirect to a different URLOnly for type Redirect.
CodeFor the types Code, FullStack and Visual Editor.
FullStackOnly for type FullStack: custom key/value properties.
Shopify Theme / Shopify TemplateOnly for the Shopify types.
MetadataKey/value pairs, only visible if your project defines variation metadata under Project → Settings → Metadata.

Code

The Code section contains JS code, CSS code and Reset JS code, plus Settings from Visual Editor: the JSON generated by the Visual Editor, required for the type Visual Editor. Edit it only if you know what you are doing.

What each field does, the Code Helper, the run order, the 32,768 character limit and the code of the whole experiment (Experiment Level Codes) are described in Custom JavaScript.

Wait for elements

The code of a variation can run before the page is fully built. Do not rely on document.querySelector() finding your element right away. Use ablyftTools.waitForElement instead.

Redirect variations

With the type Redirect, visitors in the variation are sent to another URL. This is useful for split URL tests, where the variation is a completely different page.

Example: an experiment runs on https://example.com/overview, and the variation should show https://example.com/overview2.

  1. Create a variation of the type Redirect.
  2. In the section Redirect to a different URL, enter the Redirect URL. This is either a full URL (https://...) or a query string that starts with ?, to test URL parameters.
  3. Keep Preserve query parameters checked (default) if the parameters of the current URL should be passed on. If both URLs contain the same parameter, the value of the redirect URL wins.
  4. Save.

The visitor is redirected as early as possible and ABlyft hides the page meanwhile to avoid flicker. Loop protection and other details: redirect.

Install the snippet on the target page

The snippet must also be installed on the redirect target, otherwise goals reached there cannot be measured.

Multi-page (funnel) experiments

Sometimes one experiment needs different changes on different pages, for example a banner on the homepage and changed texts on product pages. You do this with one experiment, several pages and variation code that checks where it is running.

Any entry page. The visitor sees the changes on every targeted page:

  1. Attach all relevant pages to the experiment (Pages card), for example "Homepage" and "Product Pages".

  2. In the variation code, branch by page:

    const path = window.location.pathname;
    
    if (path === '/') {
      // Code for "Add banner"
    } else if (path.startsWith('/product/')) {
      // Code for "Text changes inside boxes"
    }

    Instead of the path you can also check a CSS class, whether an element exists or a data layer value.

Specific entry page. The visitor should see the product page changes only after having seen the homepage banner:

  1. In the variation code of the homepage, store a flag when the change is applied:

    window.localStorage.setItem('homepage_banner_added', 'true');
  2. Create an additional page, for example "Product Pages (after homepage banner)", with the product page URL rule. Under Advanced Targeting, enter a condition that checks the flag:

    return window.localStorage.getItem('homepage_banner_added') === 'true';
  3. Attach this page to the experiment instead of the plain product page, and keep the product branch in your code.

The flag only works on the same domain. For visitors who switch domains, use the bucketing URL parameter to hand over the assignment, or contact ABlyft support.

Delete a variation

Open the menu of the variation and click Delete. ABlyft redistributes the traffic automatically and, if you deleted the baseline, makes the oldest remaining variation the new baseline. Check the traffic split afterwards. Remember that an experiment needs at least one variation to be started, see Before you can preview or start.

Next steps

On this page