# abtest

> an A/B test client for node web

Latest version **1.2.0** (published 2016-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install abtest
pnpm add abtest
yarn add abtest
bun add abtest
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2016-07-28 |
| First published | 2014-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 12 |
| Author | dead-horse |
| Maintainers | dead_horse |
| Keywords | web, AB testing |

## Links

- npm: https://www.npmjs.com/package/abtest
- Repository: https://github.com/node-modules/abtest
- Homepage: https://github.com/node-modules/abtest#readme
- Issues: https://github.com/node-modules/abtest/issues
- npm.io page: https://npm.io/package/abtest

## Dependencies (2)

- [crc](https://npm.io/package/crc.md) ~3.4.0
- [debug](https://npm.io/package/debug.md) ~2.2.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2016-07-28
- 1.1.0 — 2014-11-08
- 1.0.2 — 2014-09-29
- 1.0.1 — 2014-09-29
- 1.0.0 — 2014-09-29

## README

abtest
---------------

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![David deps][david-image]][david-url]
[![node version][node-image]][node-url]
[![Gittip][gittip-image]][gittip-url]

[npm-image]: https://img.shields.io/npm/v/abtest.svg?style=flat-square
[npm-url]: https://npmjs.org/package/abtest
[travis-image]: https://img.shields.io/travis/node-modules/abtest.svg?style=flat-square
[travis-url]: https://travis-ci.org/node-modules/abtest
[coveralls-image]: https://img.shields.io/coveralls/node-modules/abtest.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/node-modules/abtest?branch=master
[david-image]: https://img.shields.io/david/node-modules/abtest.svg?style=flat-square
[david-url]: https://david-dm.org/node-modules/abtest
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
[node-url]: http://nodejs.org/download/
[gittip-image]: https://img.shields.io/gittip/dead-horse.svg?style=flat-square
[gittip-url]: https://www.gittip.com/dead-horse/

an A/B test client for node web

## Installation

```bash
$ npm install abtest
```

## Feature

- Random split user into different buckets.
- Record user's bucket in cookie.
- Force choose bucket by query.
- Expire cookie when buckets changed.

## Usage

use with koa:

```js
var ABTest = ABTest();
var app = koa();

app.use(function* (next) {
  this.abtest = ABTest({
    getCookie: function () {},  // custom your getCookie method
    setCookie: function () {},  // custom your setCookie method
    query: this.query
  });
});

app.use(function* (next) {
  this.abtest.configure({
    bucket: {
      a: 9,
      b: 1
    },
    enableQuery: true,
    enableCookie: true
  });
});

app.use(function* (next) {
  this.body = this.abtest.bucket; // 10% a, 90% b
});
```

### License

MIT

---
_Source: https://npm.io/package/abtest · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
