added 'browser' to survey url. fixes #657

This commit is contained in:
Danny Coates 2018-01-16 13:21:26 -08:00
parent f3d77fdcf2
commit 7fb11ba912
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB

View file

@ -12,6 +12,31 @@ const assets = require('../../common/assets');
*/
const version = require('../../package.json').version || 'VERSION';
function browserName() {
try {
if (/firefox/i.test(navigator.userAgent)) {
return 'firefox';
}
if (/edge/i.test(navigator.userAgent)) {
return 'edge';
}
if (/trident/i.test(navigator.userAgent)) {
return 'ie';
}
if (/chrome/i.test(navigator.userAgent)) {
return 'chrome';
}
if (/safari/i.test(navigator.userAgent)) {
return 'safari';
}
return 'other';
} catch (e) {
return 'unknown';
}
}
const browser = browserName();
module.exports = function(state) {
return html`<header class="header">
<div class="send-logo">
@ -25,7 +50,7 @@ module.exports = function(state) {
<div>${state.translate('siteSubtitle')}</div>
</div>
</div>
<a href="https://qsurvey.mozilla.com/s3/txp-firefox-send?ver=${version}"
<a href="https://qsurvey.mozilla.com/s3/txp-firefox-send?ver=${version}&browser=${browser}"
rel="noreferrer noopener"
class="feedback"
target="_blank">${state.translate('siteFeedback')}</a>