Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Track actual window location origin and hash #1853

Merged
merged 9 commits into from
Apr 26, 2018
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 4 additions & 0 deletions res/css/structures/_UserSettings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,7 @@ input.mx_UserSettings_phoneNumberField {
color: $accent-color;
word-break: break-all;
}

.mx_UserSettings_analyticsModal table {
margin: 10px 0px;
}
52 changes: 36 additions & 16 deletions src/Analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,24 @@ import SdkConfig, { DEFAULTS } from './SdkConfig';
import Modal from './Modal';
import sdk from './index';

function getRedactedHash() {
return window.location.hash.replace(/#\/(group|room|user)\/(.+)/, "#/$1/<redacted>");
const hashRegex = /#\/(groups?|room|user|settings|register|login|forgot_password|home|directory)/;

// Remove all but the first item in the hash path. Redact unexpected hashes.
function getRedactedHash(hash) {
// Don't leak URLs we aren't expecting - they could contain tokens/PPI
const match = hashRegex.exec(hash);
if (!match) {
console.warn(`Unexpected hash location "${hash}"`);
return '#/<unexpected hash location>';
}

return hash.replace(hashRegex, "#/$1");
}

// Return the current origin and hash separated with a `/`. This does not include query parameters.
function getRedactedUrl() {
// hardcoded url to make piwik happy
return 'https://riot.im/app/' + getRedactedHash();
const { origin, pathname, hash } = window.location;
return origin + pathname + getRedactedHash(hash);
}

const customVariables = {
Expand Down Expand Up @@ -199,11 +210,25 @@ class Analytics {
const rows = Object.values(customVariables).map((v) => Tracker.getCustomVariable(v.id)).filter(Boolean);

const resolution = `${window.screen.width}x${window.screen.height}`;
const otherVariables = [
{
expl: _td('Every page you use in the app'),
value: _t(
'e.g. <CurrentPageURL>',
{},
{
CurrentPageURL: getRedactedUrl(),
},
),
},
{ expl: _td('Your User Agent'), value: navigator.userAgent },
{ expl: _td('Your device resolution'), value: resolution },
];

const ErrorDialog = sdk.getComponent('dialogs.ErrorDialog');
Modal.createTrackedDialog('Analytics Details', '', ErrorDialog, {
title: _t('Analytics'),
description: <div>
description: <div className="mx_UserSettings_analyticsModal">
<div>
{ _t('The information being sent to us to help make Riot.im better includes:') }
</div>
Expand All @@ -212,19 +237,14 @@ class Analytics {
<td>{ _t(customVariables[row[0]].expl) }</td>
<td><code>{ row[1] }</code></td>
</tr>) }
{ otherVariables.map((item, index) =>
<tr key={index}>
<td>{ _t(item.expl) }</td>
<td><code>{ item.value }</code></td>
</tr>,
) }
</table>
<br />
<div>
{ _t('We also record each page you use in the app (currently <CurrentPageHash>), your User Agent'
+ ' (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).',
{},
{
CurrentPageHash: <code>{ getRedactedHash() }</code>,
CurrentUserAgent: <code>{ navigator.userAgent }</code>,
CurrentDeviceResolution: <code>{ resolution }</code>,
},
) }

{ _t('Where this page includes identifiable information, such as a room, '
+ 'user or group ID, that data is removed before being sent to the server.') }
</div>
Expand Down
7 changes: 0 additions & 7 deletions src/SdkConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ const DEFAULTS = {
integrations_rest_url: "https://scalar.vector.im/api",
// Where to send bug reports. If not specified, bugs cannot be sent.
bug_report_endpoint_url: null,

piwik: {
url: "https://piwik.riot.im/",
whitelistedHSUrls: ["https://matrix.org"],
whitelistedISUrls: ["https://vector.im", "https://matrix.org"],
siteId: 1,
},
};

class SdkConfig {
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,6 @@
"Import room keys": "Импортиране на ключове за стая",
"File to import": "Файл за импортиране",
"Import": "Импортирай",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "Също така записваме всяка страница, която използвате в приложението (в момента <CurrentPageHash>), браузъра, който използвате (<CurrentUserAgent>) и резолюцията на устройството (<CurrentDeviceResolution>).",
"Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Когато тази страница съдържа информация идентифицираща Вас (като например стая, потребител или идентификатор на група), тези данни биват премахнати преди да бъдат изпратени до сървъра.",
"There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call.": "Има непознати устройства в тази стая. Ако продължите без да ги потвърдите, ще бъде възможно за някого да подслушва Вашия разговор.",
"WARNING: KEY VERIFICATION FAILED! The signing key for %(userId)s and device %(deviceId)s is \"%(fprint)s\" which does not match the provided key \"%(fingerprint)s\". This could mean your communications are being intercepted!": "ВНИМАНИЕ: НЕУСПЕШНО ПОТВЪРЖДАВАНЕ НА КЛЮЧА! Ключът за подписване за %(userId)s и устройството %(deviceId)s е \"%(fprint)s\", което не съвпада с предоставения ключ \"%(fingerprint)s\". Това може да означава, че Вашата комуникация е прихваната!",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,6 @@
"%(count)s <resendText>Resend all</resendText> or <cancelText>cancel all</cancelText> now. You can also select individual messages to resend or cancel.|one": "<resendText>Nachricht jetzt erneut senden</resendText> oder <cancelText>senden abbrechen</cancelText> now.",
"Privacy is important to us, so we don't collect any personal or identifiable data for our analytics.": "Privatsphäre ist uns wichtig, deshalb sammeln wir keine persönlichen oder identifizierbaren Daten für unsere Analysen.",
"The information being sent to us to help make Riot.im better includes:": "Die Informationen, die an uns gesendet werden um Riot.im zu verbessern enthalten:",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "Wir speichern auch jede Seite, die du in der App benutzt (currently <CurrentPageHash>), deinen User Agent (<CurrentUserAgent>) und die Bildschirmauflösung deines Gerätes (<CurrentDeviceResolution>).",
"The platform you're on": "Benutzte Plattform",
"The version of Riot.im": "Riot.im Version",
"Your language of choice": "Deine ausgewählte Sprache",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
"Whether or not you're using the Richtext mode of the Rich Text Editor": "Whether or not you're using the Richtext mode of the Rich Text Editor",
"Your homeserver's URL": "Your homeserver's URL",
"Your identity server's URL": "Your identity server's URL",
"Every page you use in the app": "Every page you use in the app",
"e.g. <CurrentPageURL>": "e.g. <CurrentPageURL>",
"Your User Agent": "Your User Agent",
"Your device resolution": "Your device resolution",
"Analytics": "Analytics",
"The information being sent to us to help make Riot.im better includes:": "The information being sent to us to help make Riot.im better includes:",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).",
"Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.",
"Call Failed": "Call Failed",
"There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call.": "There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call.",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/eo.json
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,6 @@
"The platform you're on": "Via sistemtipo",
"Which officially provided instance you are using, if any": "Kiun oficiale disponeblan aperon vi uzas, se iun ajn",
"Whether or not you're using the Richtext mode of the Rich Text Editor": "Ĉu vi uzas la riĉtekstan reĝimon de la riĉteksta redaktilo aŭ ne",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "Ni ankaŭ registras ĉiun paĝon, kiun vi uzas en la programo (nun <CurrentPageHash>), vian klientan aplikaĵon (<CurrentUserAgent>) kaj vian aparatan distingon (<CurrentDeviceResolution>).",
"Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Kiam ĉi tiu paĝo enhavas identigeblajn informojn, ekzemple ĉambron, uzantan aŭ grupan identigilon, ĝi sendiĝas al la servilo sen tiuj.",
"%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s": "%(weekDayName)s, %(day)s %(monthName)s %(fullYear)s",
"Disable Community Filter Panel": "Malŝalti komunuman filtran breton",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,6 @@
"Privacy is important to us, so we don't collect any personal or identifiable data for our analytics.": "Pribatutasuna garrantzitsua da guretzat, beraz ez dugu datu pertsonalik edo identifikagarririk jasotzen gure estatistiketan.",
"Learn more about how we use analytics.": "Ikasi gehiago estatistikei ematen diegun erabileraz.",
"The information being sent to us to help make Riot.im better includes:": "Riot.im hobetzeko bidaltzen zaigun informazioan hau dago:",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "Aplikazioan erabiltzen duzun orri bakoitza jasotzen dugu (orain <CurrentPageHash>), erabiltzaile-agentea (<CurrentUserAgent>) eta gailuaren bereizmena (<CurrentDeviceResolution>).",
"Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Orri honek informazio identifikagarria badu ere, esaterako gela, erabiltzailea edo talde ID-a, datu hauek ezabatu egiten dira zerbitzarira bidali aurretik.",
"Whether or not you're logged in (we don't record your user name)": "Saioa hasita dagoen ala ez (ez dugu erabiltzaile-izena gordetzen)",
"Which officially provided instance you are using, if any": "Erabiltzen ari zaren instantzia ofiziala, balego",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,6 @@
"Privacy is important to us, so we don't collect any personal or identifiable data for our analytics.": "Le respect de votre vie privée est important pour nous, donc nous ne collectons aucune donnée personnelle ou permettant de vous identifier pour nos statistiques.",
"Learn more about how we use analytics.": "En savoir plus sur notre utilisation des statistiques.",
"The information being sent to us to help make Riot.im better includes:": "Les informations qui nous sont envoyées pour nous aider à améliorer Riot.im comprennent :",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "Nous enregistrons aussi chaque page que vous utilisez dans l'application (en ce moment <CurrentPageHash>), votre User Agent (<CurrentUserAgent>) et la résolution de votre appareil (<CurrentDeviceResolution>).",
"Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Si la page contient des informations permettant de vous identifier, comme un salon, un identifiant d'utilisateur ou de groupe, ces données sont enlevées avant qu'elle ne soit envoyée au serveur.",
"The platform you're on": "La plateforme que vous utilisez",
"The version of Riot.im": "La version de Riot.im",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/gl.json
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,6 @@
"File to import": "Ficheiro a importar",
"Import": "Importar",
"The information being sent to us to help make Riot.im better includes:": "A información enviada a Riot.im para axudarnos a mellorar inclúe:",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "Tamén rexistramos cada páxina que vostede utiliza no aplicativo (actualmente <CurrentPageHash>), o User Agent (<CurrentUserAgent>) e a resolución do dispositivo (<CurrentDeviceResolution>).",
"Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Si esta páxina inclúe información identificable como ID de grupo, usuario ou sala, estes datos son eliminados antes de ser enviados ao servidor.",
"The platform you're on": "A plataforma na que está",
"The version of Riot.im": "A versión de Riot.im",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,6 @@
"Privacy is important to us, so we don't collect any personal or identifiable data for our analytics.": "A személyes adatok védelme fontos számunkra, így mi nem gyűjtünk személyes és személyhez köthető adatokat az analitikánkhoz.",
"Learn more about how we use analytics.": "Tudj meg többet arról hogyan használjuk az analitikai adatokat.",
"The information being sent to us to help make Riot.im better includes:": "Az adatok amiket a Riot.im javításához felhasználunk az alábbiak:",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "Felvesszük az összes oldalt amit az alkalmazásban használsz (jelenleg <CurrentPageHash>), a \"User Agent\"-et (<CurrentUserAgent>) és az eszköz felbontását (<CurrentDeviceResolution>).",
"Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Minden azonosításra alkalmas adatot mint a szoba, felhasználó vagy csoport azonosítót mielőtt az adatokat elküldenénk eltávolításra kerülnek.",
"The platform you're on": "A platform amit használsz",
"The version of Riot.im": "Riot.im verziója",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"Your identity server's URL": "L'URL del tuo server di identità",
"Analytics": "Statistiche",
"The information being sent to us to help make Riot.im better includes:": "Le informazioni inviate per aiutarci a migliorare Riot.im includono:",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "Registriamo anche ogni pagina che usi nell'app (attualmente <CurrentPageHash>), il tuo User Agent (<CurrentUserAgent>) e la risoluzione del dispositivo (<CurrentDeviceResolution>).",
"Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Se questa pagina include informazioni identificabili, come una stanza, utente o ID di gruppo, questi dati sono rimossi prima che vengano inviati al server.",
"Call Failed": "Chiamata fallita",
"There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call.": "Ci sono dispositivi sconosciuti in questa stanza: se procedi senza verificarli, qualcuno avrà la possibilità di intercettare la tua chiamata.",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
"Your identity server's URL": "あなたのアイデンティティサーバのURL",
"Analytics": "分析",
"The information being sent to us to help make Riot.im better includes:": "Riot.imをよりよくするために私達に送信される情報は以下を含みます:",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "私達はこのアプリであなたが利用したページ(現在は<CurrentPageHash>)、あなたのユーザエージェント(現在は<CurrentUserAgent>)、並びにあなたの端末の解像度(現在の端末では<CurrentDeviceResolution>)も記録します。",
"Thursday": "木曜日",
"Messages in one-to-one chats": "一対一のチャットでのメッセージ",
"A new version of Riot is available.": "新しいバージョンのRiotが利用可能です。",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"Your identity server's URL": "Jūsų identifikavimo serverio URL adresas",
"Analytics": "Statistika",
"The information being sent to us to help make Riot.im better includes:": "Informacijoje, kuri yra siunčiama Riot.im tobulinimui yra:",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "Mes taip pat saugome kiekvieną puslapį, kurį jūs naudojate programėlėje (dabartinis <CurrentPageHash>), jūsų paskyros agentas (<CurrentUserAgent>) ir jūsų įrenginio rezoliucija (<CurrentDeviceResolution>).",
"Fetching third party location failed": "Nepavyko gauti trečios šalies vietos",
"A new version of Riot is available.": "Yra nauja Riot versija.",
"I understand the risks and wish to continue": "Aš suprantu riziką ir noriu tęsti",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/lv.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,6 @@
"Your homeserver's URL": "Bāzes servera URL adrese",
"Your identity server's URL": "Tava Identitātes servera URL adrese",
"The information being sent to us to help make Riot.im better includes:": "Informācija, kura mums tiek nosūtīta, lai ļautu padarīt Riot.im labāku, ietver:",
"We also record each page you use in the app (currently <CurrentPageHash>), your User Agent (<CurrentUserAgent>) and your device resolution (<CurrentDeviceResolution>).": "Mēs arī fiksējam katru lapu, kuru tu izmanto programmā (currently <CurrentPageHash>), Tavu lietotāja aģentu (<CurrentUserAgent>) un Tavas ierīces ekrāna izšķirtspēju (<CurrentDeviceResolution>).",
"Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Ja šī lapa ietver identificējamu informāciju, tādu kā istaba, lietotājs, grupas Id, šie dati tiek noņemti pirms nosūtīšanas uz serveri.",
"Call Failed": "Zvans neizdevās",
"There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call.": "Šajā istabā ir nepazīstamas ierīces: ja Tu turpināsi bez to pārbaudes, ir iespējams, ka kāda nepiederoša persona var noklausīties Tavas sarunas.",
Expand Down
Loading