Report touch input status in rageshakes, analytics

This reports whether the device has touch input as a primary input mechanism in
rageshakes and analytics.

For analytics, this replaces the identity server (which ends up being reported
as "<redacted>" by default anyway) because Matomo only supports a limited number
of custom variables.
This commit is contained in:
J. Ryan Stinnett 2020-02-14 17:36:14 +00:00
parent ca4f591cb6
commit ca28f83841
4 changed files with 21 additions and 7 deletions

View file

@ -73,6 +73,12 @@ export default async function sendBugReport(bugReportEndpoint, opts) {
installedPWA = window.matchMedia('(display-mode: standalone)').matches;
} catch (e) { }
let touchInput = "UNKNOWN";
try {
// MDN claims broad support across browsers
touchInput = window.matchMedia('(pointer: coarse)').matches;
} catch (e) { }
const client = MatrixClientPeg.get();
console.log("Sending bug report.");
@ -83,6 +89,7 @@ export default async function sendBugReport(bugReportEndpoint, opts) {
body.append('version', version);
body.append('user_agent', userAgent);
body.append('installed_pwa', installedPWA);
body.append('touch_input', touchInput);
if (client) {
body.append('user_id', client.credentials.userId);