crowrap
v1.0.29
Published
Wrapper for Optimizely CLI, Clearhead, and other tools.
Downloads
7
Keywords
Readme
crowrap
Crowrap is the product of several tools being brought together for the purposes of A/B testing with optimizely. It combines Optimizely CLI, various Clearhead Tools, etc.
High Level Features
- Host variation code locally (injected into target site)
- Push variations and experiments to Optimizely
- Write in ES6
- Import common functions from github.com/crometrics/crometrics (http://github.com/crometrics/crometrics)
This command line tool will allow you to write code using ES6, which will be compiled and minified for production use.
This tool is a work in progress. Feedback and bug reports are always welcome.
Dependencies
You'll need to have node.js installed, and either the Tampermonkey or Greasemonkey extensions to use the host command.
Installation
npm install -g crowrap
Developer Installation
You can use the latest development version if you first clone this repo to your local machine, and then pull in the node packages using:
npm install
Then you can give yourself access to the command by making a symlink to your local copy (on Linux or Mac):
cd /usr/local/bin
ln -s [path to repo]/crowrap/bin/crowrap.js crom
CROWrap Commands
This tool wraps the optcli
command line tool, and so you can use the same commands:
Initialize a new Optimizely project locally (use -r for remote):crowrap init [options] [project_id]
Host a variation locally:crowrap host [path] [port]
- Once you've run the command, point your browser at http(s)://localhost:8080 (default port) for further usage info.
- This command uses the
edit_url
variable from your experiment.json file. The command looks for "https" in the url in order to turn on SSL hosting. - If no path is specified, the working directory will be used.
Create a new experiment or variation:crowrap new [experiment|variation|exp|var|json] [path|code]
Options:
experiment|exp
: Create a new experiment directory, guided by the console wizard.variation|var
: Create a new variation directory, guided by the console wizard.json
: This is a specialized command which accepts a Base64 encoded json string which will initialize a new experiment, and it's variations. See the associated bookmarklet for more info.
Clone an existing experiment folder:crowrap clone [source] [destination]
Aliases: copy
, cp
- This command will copy an experiment directory and strip out the id values in
experiment.json
and anyvariation.json
files. This acts as a failsafe against accidentally pushing new code to old/existing experiment ids.
Output meta-information about an experiment:crowrap info [path]
- This inspects the experment.json file, and pulls out some useful info, such as the edit url, and experiment description.
- If no path is specified, the working directory will be used.
Example output:
$ crowrap info
OMG-5: Utilize cool beans (Desktop)
https://trello.com/c/xQvBOCyz/15-omg-5-utilize-cool-beans-desktop
https://app.optimizely.com/edit?experiment_id=6323522632
The --trello [-t] flag will output the experiment information in a format appropriate for copy/paste to our trello cards. It includes the Preview, Browserstack, and Edit links, in a format that looks something like this:
**Preview:**
- https://website.com/?optimizely_x6236141326=0
- https://website.com/?optimizely_x6236141326=1
- https://website.com/?optimizely_x6236141326=2
**Cross Browser testing:**
- https://www.browserstack.com/start#url=https%3A%2F%2Fwebsite.com%2F%3Foptimizely_x6236141326%3D0
- https://www.browserstack.com/start#url=https%3A%2F%2Fwebsite.com%2F%3Foptimizely_x6236141326%3D1
- https://www.browserstack.com/start#url=https%3A%2F%2Fwebsite.com%2F%3Foptimizely_x6236141326%3D2
**Edit:**
https://app.optimizely.com/edit?experiment_id=6236141326
Legacy OptCLI commands
It is recommended that you use the newer commands provided above.
Create a local experiment:crowrap experiment <folder> <description> <url>
See the new
command.
Create a local variation:crowrap variation <experiment> <folder> <description>
See the new
command.
Push a local experiment to Optimizely.:crowrap push-experiment <path>
See the push
command.
Push a local variation to Optimizely:crowrap push-variation <path>
See the push
command.
Generator functions
Running any of these commands will prompt you for more information such as experiment name, description, etc.
These are deprecated: use new
instead.
Generate a new experiment:crowrap experimentwiz
Generate a new variation:crowrap variationwiz
##Dev Wishlist##
Fix path awareness of crowrap new variation
: it shouldn't ask for experiment directory if the active directory is an experiment directory.
Have the host command host both http and https automatically. It's silly that we always have to specify.
Redo the host command to be instead of optcli=activate
to be something like crowrap=2
for the second variation, etc.
It would be nice if we had an experiment clone function which would duplicate the code, removing/replacing the ids in the json files. It would be nice if it also cloned the original experiment in optimizely, keeping the goals, etc.