make the site mostly work when cookies (localStorage) are disabled
This commit is contained in:
parent
493bf8dc89
commit
09faedf059
4 changed files with 47 additions and 10 deletions
|
@ -1,6 +1,13 @@
|
|||
const testPilotGA = require('testpilot-ga/src/TestPilotGA');
|
||||
const Storage = require('./storage');
|
||||
const storage = new Storage(localStorage);
|
||||
const storage = new Storage();
|
||||
|
||||
let hasLocalStorage = false;
|
||||
try {
|
||||
hasLocalStorage = !!localStorage;
|
||||
} catch (e) {
|
||||
// don't care
|
||||
}
|
||||
|
||||
const analytics = new testPilotGA({
|
||||
an: 'Firefox Send',
|
||||
|
@ -18,7 +25,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
});
|
||||
|
||||
function sendEvent() {
|
||||
return analytics.sendEvent.apply(analytics, arguments).catch(() => 0);
|
||||
return (
|
||||
hasLocalStorage &&
|
||||
analytics.sendEvent.apply(analytics, arguments).catch(() => 0)
|
||||
);
|
||||
}
|
||||
|
||||
function urlToMetric(url) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue