How to use Dropconfig for A/B testing

A/B testing is about offerring different features and configurations to different segments of visitors.

Dropconfig can help make that process easy.

Step One

Create one dropconfig for every variant of features you want to test.

Step two

Segment your users in some way.

This process is really up to you. You split them by country or day of the week or even randomly.

After you decide on segmenting logic, you have to assign a cookie to each segment.

The value of this cookie will be the URL for a dropconfig with a variant of features corresponding to this segment.

This is important: you want to reliably associate a variant with the user, and cookies are great for that.

Segment 1

Set-Cookie: web_config=

Segment 2

Set-Cookie: web_config=

Step Three

Now, when user lands on your website, you can request the dropconfig using the URL in the cookie, and use this dropconfig to dynamically adjust user’s experience.

function getCookie(name) {
  var value = "; " + document.cookie;
  var parts = value.split("; " + name + "=");
  if (parts.length == 2) return parts.pop().split(";").shift();
const configUrl = getCookie("web_config");

const req = await fetch(configUrl);
const config = await req.json();

Now we have our config data ready to use for our A/B tests.