Skip to main content

Taking your experiments to production

With the experiment configuration out of the way, we need to take this to production. Sidecar makes this easy with just a few clicks.

info

This guide assumes you have followed the previous steps of creating an experiment in Sidecar. Check out Creating Experiments for those instructions.

Step 1: Add script code

You will need to add a single line of code in the <HEAD> portion of your website.

There are many ways to add this script code to your website. Most website builders will allow you to add script tags on your website. Here are some common website builder examples:

The code itself would look like this with your API Key switched.

<script src="https://cdn.jsdelivr.net/npm/statsig-sidecar/dist/index.min.js?apikey=client-xxx"></script>

statsig banner

Step 2: Publish the experiments

Once you have installed sidecar into your code, you are able to start the experimentation configuration. Once you are satisfied with the experiment configuration, go ahead and hit the green Publish button. This will push all the experiment changes to Statsig. If you want to make sure these changes are published, you can on the ... menu and choose Go to Experiment console

statsig banner

The experiment console will look like this, and allows you to configure rich targeting, metrics, and tweak advanced statistical knobs. More on this later.

Step 3: Preview & QA the experiment

At this point, your experiment is in a pre-started state, meaning your experiment will not be active to your site visitors. You can pass a query string to your test page url by using the overrideuser query string parameter.

The override method uses the following convention to force a test & test group:
https://www.DOMAIN.com/?overrideuser=<EXPERIMENT_ID>_<TEST_GROUP_ID>

The image below depicts where you can find the experiment ID and each variation ID. Based on this example, you can force a preview of the Test Group by visiting the following URL:
https://www.DOMAIN.com/?overrideuser=name_color_test_1

statsig banner

Step 4: Start the experiment

Refresh the page on your browser with the script embedded. Sidecar will automatically pick up the experiment you have published and display all the experiment properties.

You can now start the experiment by clicking on the ... menu and clicking on Start Experiment. This will automatically start the experiment, serve the right variants for control and test, and start collecting metrics on your behalf.

statsig banner

Congratulations! You have successfully built and shipped an experiment 🎉