Create & clone experiences

This is for:

Developer

In this article, we’ll show you how to create and upload experiences with Qubit CLI.

Running your first experience

Step 1

Create a directory:

$ mkdir demo
$ cd demo

Step 2

Create a new experience:

$ qubit create

Step 3

The output from the create command should tell you the name of the folder that was created cd into that folder and run your local experience server by calling qubit with the name of your variation file:

cd {experience-folder}
$ qubit variation-1234.js

Alternatively, running just qubit will automatically select your most recently created variation:

cd {experience-folder}
$ qubit

Step 4

Open Chrome and select the Chrome extension icon. The page background should turn yellow. Change the background declaration in variation.css to green.

The page background should update on the fly.

Creating a new experience

You can create a new experience by executing qubit create.

If you have access to more than one property, you can select the property you want to create the experience for. You can also pass in your property Id.

$ qubit create
$ qubit create 2499

You can pass in additional parameters when creating experiences, bypassing prompts, to further integrate into your CI/CD pipeline. The following parameters can be used:

  • property Id - the property in which to create the experience

  • experience name - the name of the experience

  • traffic split - ratio of traffic to route into control as a decimal value (for example, 0.8 for pilot, 0.5 for split, 0.05 for supervised, 1 for all traffic)

  • template Id - optionally, the template to base the experience on

In the following example, the user is creating an experience called myExperience, for the property 2499, with a 50/50 traffic split:

$ qubit create 2499 myExperience 0.5

If you need to specify an existing template you can pass in the template Id as well. In the following example this is 196961:

$ qubit create 2499 myExperience 0.5 196961

Cloning existing experiences

The qubit clone command allows you to copy down all the files from an existing experience so that you can work on it locally.

If you have access to more than one property, you’ll be able to select the property you want to clone the experience from and then you’ll be able to search for that experience using the terminal prompt.

You can also navigate to the experience in your browser, since the Qubit CLI extension will detect which experience you’re working on and ask if you would like to clone that one.

Finally, if you know the Ids or have the URL to hand, you can simply paste these in as an argument and Qubit CLI will understand which experience you wish to clone.

For example, if you know the experience Id:

$ qubit clone
$ qubit clone 2499 1234
$ qubit clone https://app.qubit.com/p/2499/experiences/1234