-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional check for experiment cookie to persist previously seen v…
…ariations (Fixes #93) (#100) * Add optional check for experiment cookie to persist previously seen variations (Fixes #93)
- Loading branch information
1 parent
06f5725
commit c7e5365
Showing
21 changed files
with
1,931 additions
and
987 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
# HEAD | ||
|
||
- **js:** Add optional check for experiment cookie to persist previously seen variations (#93). | ||
|
||
# 3.0.0 | ||
|
||
- **js:** Remove use of cookies (#56). | ||
- **js:** Migrate ESLint to use new flat config (#42). | ||
- **js:** Migrate JS tests to jasmine-browser-runner (#40). | ||
- **js:** Remove use of cookies (#56). | ||
- **js:** Migrate ESLint to use new flat config (#42). | ||
- **js:** Migrate JS tests to jasmine-browser-runner (#40). | ||
|
||
# 2.0.1 | ||
|
||
- **js:** Update ESLint config to enforce common rules (#13). | ||
- **js:** Transpile code to ES5 before publishing (#12). | ||
- **demo:** Update demo pages to use `@mozmeao/cookie-helper` v1.1.0 (#10). | ||
- **docs:** Update docs import `@mozmeao/cookie-helper`. | ||
- **js:** Update ESLint config to enforce common rules (#13). | ||
- **js:** Transpile code to ES5 before publishing (#12). | ||
- **demo:** Update demo pages to use `@mozmeao/cookie-helper` v1.1.0 (#10). | ||
- **docs:** Update docs import `@mozmeao/cookie-helper`. | ||
|
||
# 2.0.0 | ||
|
||
- **js:** Remove `Mozilla` JS namespace from library (#4). | ||
- **docs:** Update docs to have info about publishing to NPM | ||
- **js:** Remove `Mozilla` JS namespace from library (#4). | ||
- **docs:** Update docs to have info about publishing to NPM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const CookieHelper = require('@mozmeao/cookie-helper'); | ||
|
||
// create namespace | ||
if (typeof window.Mozilla === 'undefined') { | ||
window.Mozilla = {}; | ||
} | ||
|
||
window.Mozilla.Cookies = CookieHelper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,32 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
function setVariationCookie(exp) { | ||
// set cookie to expire in 24 hours | ||
var date = new Date(); | ||
date.setTime(date.getTime() + 1 * 24 * 60 * 60 * 1000); | ||
var expires = date.toUTCString(); | ||
|
||
window.Mozilla.Cookies.setItem( | ||
exp.id, | ||
exp.chosenVariation, | ||
expires, | ||
undefined, | ||
undefined, | ||
false, | ||
'lax' | ||
); | ||
} | ||
|
||
var lou = new window.TrafficCop({ | ||
id: 'my-experiment-id-4', | ||
variations: { | ||
'v=a': 40, | ||
'v=b': 40 | ||
} | ||
}); | ||
|
||
lou.init(); | ||
|
||
setVariationCookie(lou); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const path = require('path'); | ||
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); | ||
|
||
module.exports = { | ||
entry: './src/libs.js', | ||
output: { | ||
filename: 'index.js', | ||
path: path.resolve(__dirname, 'libs'), | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['@babel/preset-env'] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
performance: { | ||
hints: 'warning' | ||
}, | ||
optimization: { | ||
minimize: false | ||
}, | ||
plugins: [ | ||
// clean out ./demo/libs/ before building | ||
new CleanWebpackPlugin(), | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.