0

I would like to split my users front side and perform A/B testing. What is the best way to split a user in javascript ? Which unique ID could I use ?

The goal is to split the users into two or more groups and each user should always see the same version of my code.

Brams
  • 584
  • 4
  • 9
  • impossible to guarantee percentage of x/y users on each version with just the browser. Store a value in localstorage or cookie. Use that to determine what version to show... – epascarello Sep 16 '16 at 13:11

2 Answers2

0

It will be impossible to guarntee an equal distrubtion of A/B testers with each version with just clientside code.

  1. Page loads, check to see if user has been here
  2. If yes, use value from storage
  3. If no, generate A/B and store value in storage

Where to store, either local storage or a cookie.

epascarello
  • 204,599
  • 20
  • 195
  • 236
0

In order to tareget a user session in a stabile fashion, as already mentioned, you need a stable key, which cannot be generated on the client. In some instances you may be able to take advantage of the HTTP session id, available in a cookie, e.g. JSESSIONID or something similar. Note however that this will only work for the duration of the HTTP session. Even if you drop your own persistent cookie with the targeting information, the same user may return with a different browser or simply clean the cookies.

Igor Urisman
  • 717
  • 1
  • 6
  • 22