KM.ab(propertyName, variations)

KM.ab initiates an A/B test and sets the property that indicates which variation was randomly picked.

Parameters

NameTypeDescription
propertyNamestringThe name of the experiment to record as a property for the current user.
variationsarrayThe list of variations to be randomly assigned to users.

Response

KM.ab returns which variation is picked, to reuse as a JavaScript variable. To remember which variation was used, KM sets a cookie. Please look at our page on Developing Locally if you are testing KM.ab locally.