{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/comments/38480070","id":38480070,"diff_hunk":"@@ -0,0 +1,164 @@\n+/* This Source Code Form is subject to the terms of the Mozilla Public\n+ * License, v. 2.0. If a copy of the MPL was not distributed with this\n+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n+\n+// An experiment interface.\n+\n+define([\n+  'underscore',\n+  'lib/storage',\n+  'lib/url'\n+],\n+function (_, Storage, Url) {\n+  'use strict';\n+\n+  var FORCE_GROUP_TYPE = 'forceExperimentGroup';\n+  var storage = Storage.factory('localStorage');\n+\n+  function BaseExperiment() {\n+    // nothing to do.\n+  }\n+\n+  _.extend(BaseExperiment.prototype, {}, {\n+    /**\n+     * Name of the experiment. Used in metrics and view logic.\n+     */\n+    _name: null,\n+    /**\n+     * The A/B testing group type, see https://en.wikipedia.org/wiki/A/B_testing for details.\n+     */\n+    _groupType: null,\n+    /**\n+     * Initialize the experiment\n+     *\n+     * @returns {boolean}\n+     *  Returns 'true' when the experiment successfully initialized. Otherwise 'false'.\n+     */\n+    initialize: function () {\n+      // should be extended\n+      return false;\n+    },\n+    /**\n+     * Setup the experiment environment\n+     *\n+     * @param {String} name - name of the experiment\n+     * @param {Object} options\n+     * @returns {boolean}\n+     *  Returns 'true' when the experiment successfully started. Otherwise 'false'.\n+     */\n+    start: function (name, options) {\n+      // all experiments require these options\n+      if (! name || ! options || ! options.window || ! options.metrics || ! options.able || ! options.user) {\n+        return false;\n+      }\n+\n+      this.window = options.window;\n+      this.able = options.able;\n+      this.metrics = options.metrics;\n+      this.user = options.user;\n+      this.extraAbleOptions = options.extraAbleOptions || {};\n+\n+      var abData = {\n+        isMetricsEnabledValue: this.metrics.isCollectionEnabled(),\n+        uniqueUserId: this.user.get('uniqueUserId'),\n+        // the window parameter will override any ab testing features\n+        forceExperimentGroup: Url.searchParam(FORCE_GROUP_TYPE, this.window.location.search)\n+      };\n+\n+      abData = _.extend(abData, this.extraAbleOptions);\n+\n+      this._name = name;\n+      this._groupType = this.able.choose(this._name, abData) || null;\n+      if (! this._groupType) {\n+        return false;\n+      }\n+\n+      this._loggingNamespace = 'experiment.' + this._groupType + '.' + this._name + '.';\n+      this._storageNamespace = 'experiment.' + this._name;\n+      this._initialized = true;\n+      this.saveState('enrolled');\n+\n+      return true;\n+    },\n+    /**\n+     * Checks the experiment name\n+     *\n+     * @param name\n+     * @returns {boolean}\n+     */\n+    is: function (name) {\n+      return !! name && name === this._name;\n+    },\n+    /**\n+     * Checks the experiment group\n+     *\n+     * @param groupType\n+     * @returns {boolean}\n+     */\n+    isGroup: function (groupType) {\n+      return !! groupType && groupType === this._groupType;\n+    },\n+    /**\n+     * Returns the extra context of an experiment\n+     *\n+     * @returns {Object}\n+     */\n+    getContext: function () {\n+      // context should be extended\n+      return {};\n+    },\n+    /**\n+     * Series of actions that an experiment can perform\n+     *\n+     * @param action\n+     * @param options\n+     */\n+    performAction: function (action, options) {\n+      // actions should be extended\n+    },\n+    /**\n+     * Log an experiment event\n+     *\n+     * @param event\n+     */\n+    logEvent: function (event) {\n+      if (this._initialized && event) {\n+        this.metrics.logEvent(this._loggingNamespace + event);\n+      }\n+    },\n+    /**\n+     * Save that some experiment state occurred and\n+     * log an event if it was the first time it happened\n+     *\n+     * @param state\n+     */\n+    saveState: function (state) {\n+      if (! state) {\n+        return;\n+      }\n+\n+      var store = JSON.parse(storage.get(this._storageNamespace)) || {};\n+      if (! store[state]) {\n+        this.logEvent(state);\n+      }\n+      store[state] = true;\n+      storage.set(this._storageNamespace, JSON.stringify(store));\n+    },\n+    /**\n+     * Check if the experiment had some state occur\n+     *\n+     * @param state\n+     * @returns {boolean}\n+     */\n+    hasState: function (state) {","path":"app/scripts/lib/experiments/base.js","position":153,"original_position":153,"commit_id":"9736bb877c02d80772491200234e2f0fa09e286d","original_commit_id":"9736bb877c02d80772491200234e2f0fa09e286d","user":{"login":"vladikoff","id":128755,"avatar_url":"https://avatars.githubusercontent.com/u/128755?v=3","gravatar_id":"","url":"https://api.github.com/users/vladikoff","html_url":"https://github.com/vladikoff","followers_url":"https://api.github.com/users/vladikoff/followers","following_url":"https://api.github.com/users/vladikoff/following{/other_user}","gists_url":"https://api.github.com/users/vladikoff/gists{/gist_id}","starred_url":"https://api.github.com/users/vladikoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladikoff/subscriptions","organizations_url":"https://api.github.com/users/vladikoff/orgs","repos_url":"https://api.github.com/users/vladikoff/repos","events_url":"https://api.github.com/users/vladikoff/events{/privacy}","received_events_url":"https://api.github.com/users/vladikoff/received_events","type":"User","site_admin":false},"body":"Not using \"getState\" for now because only booleans are stored in it (might change in the future, but do not want extra complexity for now)","created_at":"2015-09-01T22:28:54Z","updated_at":"2015-09-01T22:28:54Z","html_url":"https://github.com/mozilla/fxa-content-server/pull/2943#discussion_r38480070","pull_request_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2943","_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/comments/38480070"},"html":{"href":"https://github.com/mozilla/fxa-content-server/pull/2943#discussion_r38480070"},"pull_request":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2943"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2943","id":42316957,"html_url":"https://github.com/mozilla/fxa-content-server/pull/2943","diff_url":"https://github.com/mozilla/fxa-content-server/pull/2943.diff","patch_url":"https://github.com/mozilla/fxa-content-server/pull/2943.patch","issue_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues/2943","number":2943,"state":"open","locked":false,"title":"feat(verification): organize verification experiments","user":{"login":"vladikoff","id":128755,"avatar_url":"https://avatars.githubusercontent.com/u/128755?v=3","gravatar_id":"","url":"https://api.github.com/users/vladikoff","html_url":"https://github.com/vladikoff","followers_url":"https://api.github.com/users/vladikoff/followers","following_url":"https://api.github.com/users/vladikoff/following{/other_user}","gists_url":"https://api.github.com/users/vladikoff/gists{/gist_id}","starred_url":"https://api.github.com/users/vladikoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladikoff/subscriptions","organizations_url":"https://api.github.com/users/vladikoff/orgs","repos_url":"https://api.github.com/users/vladikoff/repos","events_url":"https://api.github.com/users/vladikoff/events{/privacy}","received_events_url":"https://api.github.com/users/vladikoff/received_events","type":"User","site_admin":false},"body":"Fixes #2673 \r\n\r\n### Old Chart: https://www.lucidchart.com/documents/edit/14e5d8e2-4610-4dba-ad18-9a4f53c91061\r\n### MANA: https://mana.mozilla.org/wiki/display/CLOUDSERVICES/Detailed+Experiment+Reports\r\n### Depends on https://github.com/mozilla/fxa-content-experiments/pull/28","created_at":"2015-08-13T05:47:56Z","updated_at":"2015-09-01T22:28:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c8354e675cae8b73aced27af9b706d107b71031c","assignee":{"login":"vladikoff","id":128755,"avatar_url":"https://avatars.githubusercontent.com/u/128755?v=3","gravatar_id":"","url":"https://api.github.com/users/vladikoff","html_url":"https://github.com/vladikoff","followers_url":"https://api.github.com/users/vladikoff/followers","following_url":"https://api.github.com/users/vladikoff/following{/other_user}","gists_url":"https://api.github.com/users/vladikoff/gists{/gist_id}","starred_url":"https://api.github.com/users/vladikoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladikoff/subscriptions","organizations_url":"https://api.github.com/users/vladikoff/orgs","repos_url":"https://api.github.com/users/vladikoff/repos","events_url":"https://api.github.com/users/vladikoff/events{/privacy}","received_events_url":"https://api.github.com/users/vladikoff/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/mozilla/fxa-content-server/milestones/64","html_url":"https://github.com/mozilla/fxa-content-server/milestones/FxA-0:%20quality","labels_url":"https://api.github.com/repos/mozilla/fxa-content-server/milestones/64/labels","id":1265659,"number":64,"title":"FxA-0: quality","description":"An ongoing milestone into which we can schedule maintenance tasks, tech-debt paydown, and other code-quality-related issues.","creator":{"login":"rfk","id":34695,"avatar_url":"https://avatars.githubusercontent.com/u/34695?v=3","gravatar_id":"","url":"https://api.github.com/users/rfk","html_url":"https://github.com/rfk","followers_url":"https://api.github.com/users/rfk/followers","following_url":"https://api.github.com/users/rfk/following{/other_user}","gists_url":"https://api.github.com/users/rfk/gists{/gist_id}","starred_url":"https://api.github.com/users/rfk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfk/subscriptions","organizations_url":"https://api.github.com/users/rfk/orgs","repos_url":"https://api.github.com/users/rfk/repos","events_url":"https://api.github.com/users/rfk/events{/privacy}","received_events_url":"https://api.github.com/users/rfk/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":2,"state":"open","created_at":"2015-08-21T02:49:53Z","updated_at":"2015-08-28T07:51:50Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2943/commits","review_comments_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2943/comments","review_comment_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues/2943/comments","statuses_url":"https://api.github.com/repos/mozilla/fxa-content-server/statuses/9736bb877c02d80772491200234e2f0fa09e286d","head":{"label":"vladikoff:i2673-gmail-button","ref":"i2673-gmail-button","sha":"9736bb877c02d80772491200234e2f0fa09e286d","user":{"login":"vladikoff","id":128755,"avatar_url":"https://avatars.githubusercontent.com/u/128755?v=3","gravatar_id":"","url":"https://api.github.com/users/vladikoff","html_url":"https://github.com/vladikoff","followers_url":"https://api.github.com/users/vladikoff/followers","following_url":"https://api.github.com/users/vladikoff/following{/other_user}","gists_url":"https://api.github.com/users/vladikoff/gists{/gist_id}","starred_url":"https://api.github.com/users/vladikoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladikoff/subscriptions","organizations_url":"https://api.github.com/users/vladikoff/orgs","repos_url":"https://api.github.com/users/vladikoff/repos","events_url":"https://api.github.com/users/vladikoff/events{/privacy}","received_events_url":"https://api.github.com/users/vladikoff/received_events","type":"User","site_admin":false},"repo":{"id":15786683,"name":"fxa-content-server","full_name":"vladikoff/fxa-content-server","owner":{"login":"vladikoff","id":128755,"avatar_url":"https://avatars.githubusercontent.com/u/128755?v=3","gravatar_id":"","url":"https://api.github.com/users/vladikoff","html_url":"https://github.com/vladikoff","followers_url":"https://api.github.com/users/vladikoff/followers","following_url":"https://api.github.com/users/vladikoff/following{/other_user}","gists_url":"https://api.github.com/users/vladikoff/gists{/gist_id}","starred_url":"https://api.github.com/users/vladikoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladikoff/subscriptions","organizations_url":"https://api.github.com/users/vladikoff/orgs","repos_url":"https://api.github.com/users/vladikoff/repos","events_url":"https://api.github.com/users/vladikoff/events{/privacy}","received_events_url":"https://api.github.com/users/vladikoff/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vladikoff/fxa-content-server","description":"Firefox Accounts","fork":true,"url":"https://api.github.com/repos/vladikoff/fxa-content-server","forks_url":"https://api.github.com/repos/vladikoff/fxa-content-server/forks","keys_url":"https://api.github.com/repos/vladikoff/fxa-content-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vladikoff/fxa-content-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vladikoff/fxa-content-server/teams","hooks_url":"https://api.github.com/repos/vladikoff/fxa-content-server/hooks","issue_events_url":"https://api.github.com/repos/vladikoff/fxa-content-server/issues/events{/number}","events_url":"https://api.github.com/repos/vladikoff/fxa-content-server/events","assignees_url":"https://api.github.com/repos/vladikoff/fxa-content-server/assignees{/user}","branches_url":"https://api.github.com/repos/vladikoff/fxa-content-server/branches{/branch}","tags_url":"https://api.github.com/repos/vladikoff/fxa-content-server/tags","blobs_url":"https://api.github.com/repos/vladikoff/fxa-content-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vladikoff/fxa-content-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vladikoff/fxa-content-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/vladikoff/fxa-content-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vladikoff/fxa-content-server/statuses/{sha}","languages_url":"https://api.github.com/repos/vladikoff/fxa-content-server/languages","stargazers_url":"https://api.github.com/repos/vladikoff/fxa-content-server/stargazers","contributors_url":"https://api.github.com/repos/vladikoff/fxa-content-server/contributors","subscribers_url":"https://api.github.com/repos/vladikoff/fxa-content-server/subscribers","subscription_url":"https://api.github.com/repos/vladikoff/fxa-content-server/subscription","commits_url":"https://api.github.com/repos/vladikoff/fxa-content-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/vladikoff/fxa-content-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/vladikoff/fxa-content-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/vladikoff/fxa-content-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/vladikoff/fxa-content-server/contents/{+path}","compare_url":"https://api.github.com/repos/vladikoff/fxa-content-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vladikoff/fxa-content-server/merges","archive_url":"https://api.github.com/repos/vladikoff/fxa-content-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vladikoff/fxa-content-server/downloads","issues_url":"https://api.github.com/repos/vladikoff/fxa-content-server/issues{/number}","pulls_url":"https://api.github.com/repos/vladikoff/fxa-content-server/pulls{/number}","milestones_url":"https://api.github.com/repos/vladikoff/fxa-content-server/milestones{/number}","notifications_url":"https://api.github.com/repos/vladikoff/fxa-content-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vladikoff/fxa-content-server/labels{/name}","releases_url":"https://api.github.com/repos/vladikoff/fxa-content-server/releases{/id}","created_at":"2014-01-10T02:53:37Z","updated_at":"2015-04-02T19:22:44Z","pushed_at":"2015-09-01T21:03:20Z","git_url":"git://github.com/vladikoff/fxa-content-server.git","ssh_url":"git@github.com:vladikoff/fxa-content-server.git","clone_url":"https://github.com/vladikoff/fxa-content-server.git","svn_url":"https://github.com/vladikoff/fxa-content-server","homepage":"","size":11707,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"d4080dfd539392b7c52547d70f0d7a7ca8a24d11","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":11778024,"name":"fxa-content-server","full_name":"mozilla/fxa-content-server","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/fxa-content-server","description":"Firefox Accounts Content Server","fork":false,"url":"https://api.github.com/repos/mozilla/fxa-content-server","forks_url":"https://api.github.com/repos/mozilla/fxa-content-server/forks","keys_url":"https://api.github.com/repos/mozilla/fxa-content-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/fxa-content-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/fxa-content-server/teams","hooks_url":"https://api.github.com/repos/mozilla/fxa-content-server/hooks","issue_events_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/fxa-content-server/events","assignees_url":"https://api.github.com/repos/mozilla/fxa-content-server/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/fxa-content-server/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/fxa-content-server/tags","blobs_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/fxa-content-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/fxa-content-server/languages","stargazers_url":"https://api.github.com/repos/mozilla/fxa-content-server/stargazers","contributors_url":"https://api.github.com/repos/mozilla/fxa-content-server/contributors","subscribers_url":"https://api.github.com/repos/mozilla/fxa-content-server/subscribers","subscription_url":"https://api.github.com/repos/mozilla/fxa-content-server/subscription","commits_url":"https://api.github.com/repos/mozilla/fxa-content-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/fxa-content-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/fxa-content-server/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/fxa-content-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/fxa-content-server/merges","archive_url":"https://api.github.com/repos/mozilla/fxa-content-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/fxa-content-server/downloads","issues_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/fxa-content-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/fxa-content-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/fxa-content-server/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/fxa-content-server/releases{/id}","created_at":"2013-07-30T23:35:35Z","updated_at":"2015-08-31T00:04:54Z","pushed_at":"2015-09-01T21:05:30Z","git_url":"git://github.com/mozilla/fxa-content-server.git","ssh_url":"git@github.com:mozilla/fxa-content-server.git","clone_url":"https://github.com/mozilla/fxa-content-server.git","svn_url":"https://github.com/mozilla/fxa-content-server","homepage":"","size":28593,"stargazers_count":73,"watchers_count":73,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":170,"forks":47,"open_issues":170,"watchers":73,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2943"},"html":{"href":"https://github.com/mozilla/fxa-content-server/pull/2943"},"issue":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/issues/2943"},"comments":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/issues/2943/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2943/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2943/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/statuses/9736bb877c02d80772491200234e2f0fa09e286d"}}}}