only _blank links while downloading. fixed safari link after download
This commit is contained in:
parent
432a39d313
commit
859554ce21
8 changed files with 74 additions and 60 deletions
|
@ -1,5 +1,4 @@
|
|||
const testPilotGA = require('testpilot-ga');
|
||||
const { sendEvent } = require('./utils');
|
||||
const Raven = require('raven-js');
|
||||
|
||||
if (navigator.doNotTrack !== '1' && window.RAVEN_CONFIG) {
|
||||
|
@ -12,6 +11,37 @@ const analytics = new testPilotGA({
|
|||
tid: window.GOOGLE_ANALYTICS_ID
|
||||
});
|
||||
|
||||
function sendEvent() {
|
||||
return analytics.sendEvent
|
||||
.apply(analytics, arguments)
|
||||
.catch(() => 0);
|
||||
}
|
||||
|
||||
function findMetric(href) {
|
||||
switch (href) {
|
||||
case 'https://www.mozilla.org/':
|
||||
return 'mozilla';
|
||||
case 'https://www.mozilla.org/about/legal':
|
||||
return 'legal';
|
||||
case 'https://testpilot.firefox.com/about':
|
||||
return 'about';
|
||||
case 'https://testpilot.firefox.com/privacy':
|
||||
return 'privacy';
|
||||
case 'https://testpilot.firefox.com/terms':
|
||||
return 'terms';
|
||||
case 'https://www.mozilla.org/privacy/websites/#cookies':
|
||||
return 'cookies';
|
||||
case 'https://github.com/mozilla/send':
|
||||
return 'github';
|
||||
case 'https://twitter.com/FxTestPilot':
|
||||
return 'twitter';
|
||||
case 'https://www.mozilla.org/firefox/new/?scene=2':
|
||||
return 'download-firefox';
|
||||
default:
|
||||
return 'other';
|
||||
}
|
||||
}
|
||||
|
||||
const ua = navigator.userAgent.toLowerCase();
|
||||
if (
|
||||
ua.indexOf('firefox') > -1 &&
|
||||
|
@ -26,5 +56,8 @@ if (
|
|||
});
|
||||
}
|
||||
|
||||
window.analytics = analytics;
|
||||
window.Raven = Raven;
|
||||
module.exports = {
|
||||
Raven,
|
||||
sendEvent,
|
||||
findMetric
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue