npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

abatar

v0.4.1

Published

A/B testing minion

Downloads

11

Readme

abatar A/B testing framework

A workflow for testing and releasing application features.

Build Status: Travis

Example

I've got a web app that I'd like to do some A/B testing on.

App

In the app js that runs in the browser I do something like this:

// Initialize an AB instance with some session data
var ab = AB.create({
  niceCaptchaEnabled: false //default value
})
ab.subject.sessionId = session.id

//...

if (ab.choose('niceCaptchaEnabled')) {
  ui.showCaptcha()
}

//...
// At some point send a report of ab activity to an be analyzed.
// The details of which are beyond the scope of this library.
analyser.send(otherMetrics, ab.report())

Experiment

On the server I deploy a new experiment that looks like this:

{
  name: 'captcha',
  hypothesis: 'a niceCaptcha does not negatively affect signups',
  startDate: '2014-12-15',
  subjectAttributes: ['sessionId'],
  independentVariables: ['niceCaptchaEnabled'],
  eligibilityFunction: function (subject) {
    // a random sampling of 10% of sessions will be in the experiment
    return this.bernoulliTrial(0.1, subject.sessionId)
  },
  groupingFunction: function (subject) {
    // 50% of participants will see a niceCaptcha the rest are the control group
    return {
      niceCaptchaEnabled: this.bernoulliTrial(0.5, subject.sessionId)
    }
  }
}

niceCaptchaEnabled is the variable that the app uses to determine whether to display the captcha. Before the experiment goes live it will use the default value, false. Once the experiment is live, it will use the sessionId set by the app to determine whether it is eligible with the eligibilityFunction; if not it will get the default, otherwise it gets enrolled in the experiment and the groupingFunction determines the value. In this example 5% of sessions will have niceCaptchaEnabled set to true.

The analysis to test the hypothesis is beyond the scope of this library at this time but a simple report of experiments can be created with ab.report() and sent to an existing logging system.

See the "Lifecycle" section for details on how experiments are concluded.

For more examples see doc/cookbook.md

Format

Experiments are defined with javascript objects. Since experimentation is a process, not just a static declaration, the experiment will change properties over time through its lifecycle. Not all experiments include all of these properties and an individual experiment will add properties over time.

Properties

name

A short unique string for identifing the experiment.

hypothesis

A text description of the experiment.

startDate

The date when the experiment starts. (ISO 8601 format)

endDate

The date when the experiment ends. (ISO 8601 format)

subjectAttributes

The variables provided by the application to the experiment.
These are typically used by experiments to determine eligibility
and which experimental group the subject should be in.

independentVariables

The variables provided by the experiment to the application.
These are the variables the application needs for its configuration.

eligibilityFunction

A javascript function that may use `subjectAttributes` to determine
if the subject is eligible for the experiment.

groupingFunction

A javascript function that returns values for the `independentVariables`
based on the `subjectAttributes`.

conclusion

The final values for `independentVariables` after the experiment
is complete.

release

The dates and strategy for releasing the `conclusion` to all clients.

Lifecycle

Phases

  1. New
  2. Live
  3. Concluded
  4. Releasing
  5. Complete

New

An experiment whose startDate is in the future is new. Unsurprisingly, it will not do anything or affect other experiments, but is useful for iterating on the details before unleashing it on the world. It is the starting state of all experiments.

Live

An experiment can transition to live when time catches up to the startDate.

Concluded

An experiment is concluded when analysis has determined a conclusion. An experiment with no conclusion but with an endDate skips directly to complete and is considered aborted.

The conclusion is not automatically released. If an endDate is set, the conclusion will be released all at once on that date and become complete. If a release is set the experiment will transition to releasing.

If neither endDate nor release are set the experiment will continue running as if no conclusion has been reached. This may be useful when analysis has determined a conclusion but the descision about how to release it has not yet been made.

Releasing

An experiment that has reached a conclusion and is in the process of releasing it to all subjects whether they were part of the experiment during the live phase or not.

Complete

The experiment is complete and the conclusion can be made the default value in the application.