GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - cloud9ide/outplan

This repository was archived by the owner on Apr 6, 2021. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

35 Commits
35 Commits

Folders and files

NameName
Last commit message
Last commit date
lib
lib
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package.json
package.json
 
 
test.js
test.js
 
 
webpack.config.js
webpack.config.js
 
 

Repository files navigation

OutPlan

OutPlan is an A/B testing framework based on Facebook's PlanOut. It's designed to work with Node and client-side JavaScript.

OutPlan is based on PlanOut.js, which does all the hard work. Thanks! OutPlan however "outclasses" classic PlanOut by not using classes. The resulting API is clean and simple.

Installation

npm install outplan

Usage

Set up an experiment as follows:

outplan.create("nice-colors", ["A", "B"]);

and then evaluate the experiment using outplan.expose():

var userId = 42; // something unique to the current user
if (outplan.expose("nice-colors", userId) === "A") {
    // Use "A" color variation
} else {
    // Use "B" color variation
}

OutPlan is deterministic so it will always give you the same "A" or "B" for a specific userId.

You can assign complex objects to experiments as well:

outplan.create("cool-buttons", [
    { name: "A", button_color: "#AAA", button_text: "I voted" },
    { name: "B", button_color: "#BBB", button_text: "I am voter" }
]);
var variation = outplan.expose("cool-buttons", userId);
var color = variation.button_color;
var text = variation.button_text;

OutPlan also supports custom distribution operators:

outplan.create("letter-experiment", ["A", "B"], {
    operator: outplan.WeightedChoice,
    weights: [0.6, 0.4],
});

Logging

You can set an event logger using

outplan.configure({
    logFunction: function(e) {
        // ...
    };
};

where e is an object like

{
    event: "exposure",
    name: "cool-buttons",
    inputs: { userId: 42 },
    params: {
        name: "A",
        value: { button_color: "#AAA", button_text: "I voted" }
    },
    time: 1321211
}

Below is an example implementation. It logs events like "cool-buttons - exposure" to some popular analytics services.

function log(e) {
    var label = e.name + " - " + e.event;

    // For Mixpanel
    mixpanel.track(label, { variation: e.params.name });
  
    // For Amplitude
    amplitude.logEvent(label, { variation: e.params.name });
    
    // For Heap Analytics
    heap.track(label, { variation: e.params.name });

    // For Google Analytics
    ga("send", "event", "EXPERIMENT", label, e.params.name);
}
outplan.configure({ logFunction: log });

Hashing Algorithm

OutPlan uses MD5 for hashing. The underlying Planout.js library can also use SHA1, but it's a bit more heavy-weight for client-side applications. If you want to use SHA1, try the following:

var outplan = require("outplan/dist/outplan_full");

// For compatibility with non-JS implementations of PlanOut (even slower):
outplan.configure({ compatibleHash: true });

License

MIT

About

www.npmjs.com/package/outplan

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

2 stars

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.