Skip to content

Experiments service for creating A/B tests using lib sixpack-client

Notifications You must be signed in to change notification settings

LucianoNMoreira/abtest-sixpack-client

 
 

Repository files navigation

Experiments Service

Experiments service for creating A/B tests using lib sixpack-js.

Installation

yarn add @felipelealdefaria/experiments-service
# or
npm i @felipelealdefaria/experiments-service

Usage

1) Initialize:

import { experiment } from 'experiments-service'

const session = await experiment.init({ baseUrl: string }): Promise<InitResponse>

2) Experiment Participate:

const res = await experiment.participate({ session, experimentName: string, variationsName: string[], traffic?: number (default: 1) }): Promise<ParticipateResponse>
console.log(res) // { experimentName: string, alternativeName: string }

3) Experiment Convert:

convert({ session, experimentName: string, kpi?: string }): Promise<void>

4) A/B Test:

return (
  <>
    { res.alternativeName === 'variant_option'} ? <ComponentA /> : <ComponentB /> }
  </>
)

[OBS] To force the variation, insert in your browser cookies:

key: force-${experimentName}
value: ${variation_option}

Service's Architecture

Service created using the principles of Clean Architecture with the intention of facilitating maintenance and a possible exchange of lib used to perform A/B tests.

image

About

Experiments service for creating A/B tests using lib sixpack-client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.2%
  • JavaScript 6.8%