Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Add tracking of each user's initial_utm parameters (which is captured as a set once operation). Utm parameters are now sent only once per user session.
* Add documentation for SDK functions. You can take a look [here](https://rawgit.com/amplitude/Amplitude-Javascript/defensive_cleanup/documentation/Amplitude.html). A link has also been added to the Readme.
* Fix cookie test bug. In rare cases, the cookie test failed to delete the key used in testing. Reloading the page generated new keys, filling up the cookie over time. Fixed test to re-use the same key.

### 2.10.0 (March 30, 2016)

Expand Down
13 changes: 8 additions & 5 deletions amplitude.js
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,9 @@ module.exports = {
// Used in cookie as well
DEVICE_ID: 'amplitude_deviceId',
OPT_OUT: 'amplitude_optOut',
USER_ID: 'amplitude_userId'
USER_ID: 'amplitude_userId',

COOKIE_TEST: 'amplitude_cookie_test'
};

}, {}],
Expand All @@ -1148,6 +1150,7 @@ module.exports = {
* Uses cookie if available, otherwise fallback to localstorage.
*/

var Constants = require('./constants');
var Cookie = require('./cookie');
var JSON = require('json'); // jshint ignore:line
var localStorage = require('./localstorage'); // jshint ignore:line
Expand All @@ -1161,9 +1164,9 @@ cookieStorage.prototype._cookiesEnabled = function() {
var uid = String(new Date());
var result;
try {
Cookie.set(uid, uid);
result = Cookie.get(uid) === uid;
Cookie.remove(uid);
Cookie.set(Constants.COOKIE_TEST, uid);
result = Cookie.get(Constants.COOKIE_TEST) === uid;
Cookie.remove(Constants.COOKIE_TEST);
return result;
} catch (e) {
// cookies are not enabled
Expand Down Expand Up @@ -1233,7 +1236,7 @@ cookieStorage.prototype.getStorage = function() {

module.exports = cookieStorage;

}, {"./cookie":18,"json":7,"./localstorage":8}],
}, {"./constants":3,"./cookie":18,"json":7,"./localstorage":8}],
18: [function(require, module, exports) {
/*
* Cookie data
Expand Down
4 changes: 2 additions & 2 deletions amplitude.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ module.exports = {
// Used in cookie as well
DEVICE_ID: 'amplitude_deviceId',
OPT_OUT: 'amplitude_optOut',
USER_ID: 'amplitude_userId'
USER_ID: 'amplitude_userId',

COOKIE_TEST: 'amplitude_cookie_test'
};
7 changes: 4 additions & 3 deletions src/cookiestorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Uses cookie if available, otherwise fallback to localstorage.
*/

var Constants = require('./constants');
var Cookie = require('./cookie');
var JSON = require('json'); // jshint ignore:line
var localStorage = require('./localstorage'); // jshint ignore:line
Expand All @@ -18,9 +19,9 @@ cookieStorage.prototype._cookiesEnabled = function() {
var uid = String(new Date());
var result;
try {
Cookie.set(uid, uid);
result = Cookie.get(uid) === uid;
Cookie.remove(uid);
Cookie.set(Constants.COOKIE_TEST, uid);
result = Cookie.get(Constants.COOKIE_TEST) === uid;
Cookie.remove(Constants.COOKIE_TEST);
return result;
} catch (e) {
// cookies are not enabled
Expand Down