From 82796e89c5a75ded549c0c22db6c7ff10c3a86a0 Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Wed, 13 Apr 2016 08:44:48 +0000 Subject: [PATCH] Update to outplan 0.0.4 --- plugins/c9.ide.abtesting/abtesting.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/plugins/c9.ide.abtesting/abtesting.js b/plugins/c9.ide.abtesting/abtesting.js index ef732e62..ef011cf0 100644 --- a/plugins/c9.ide.abtesting/abtesting.js +++ b/plugins/c9.ide.abtesting/abtesting.js @@ -37,8 +37,11 @@ define(function(require, exports, module) { return outplan.create(name, choices, options); } - function get(experimentName, overrideUserId) { - return outplan.get(experimentName, overrideUserId == null ? userId : overrideUserId); + function expose(experimentName, overrideUserId, options) { + if (overrideUserId && typeof overrideUserId === "object") + return expose(experimentName, null, options); + + return outplan.expose(experimentName, overrideUserId == null ? userId : overrideUserId, options); } function isUserCreatedAfter(experimentDate) { @@ -71,16 +74,15 @@ define(function(require, exports, module) { create: create, /** - * Get the selected variation of an experiment. Alias for require("outplan").get() - * but doesn't require a userId + * Get the selected variation of an experiment, and call the log function with + * an "expose" event to track its exposure. * - * As a side effect, this calls the log function with an "expose" event - * with the selected experiment variation. - * - * @param {String} name The experiment name. - * @param {String|Number} [userId] A unique identifier for the current user. + * @param {String} name The experiment name. + * @param {Number} [userId] A unique identifier for the current user. + * @param {Object} [options] Options + * @param {Boolean} [options.log=true] Whether to log an "exposure event" */ - get: get, + expose: expose, /** * Helper to determine if the current user was created after the start of an experiment.