From 093400681700c7c441cde55f3a22900a5ebb5635 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 12 Jun 2018 14:13:09 +0100 Subject: [PATCH] Track decryption success/failure rate with piwik Emit a piwik event when a decryption occurs in the category "E2E" with the action "Decryption result" and the name either "failure" or "success". NB: This will cause Riot to a lot of networking when decrypting many events. One HTTP request per decrypted event should be expected. --- src/components/structures/MatrixChat.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index bd8f66163f..d4969a8bf9 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -1308,6 +1308,15 @@ export default React.createClass({ } }); + // XXX: This will do a HTTP request for each Event.decrypted event + cli.on("Event.decrypted", (e) => { + if (e.isDecryptionFailure()) { + Analytics.trackEvent('E2E', 'Decryption result', 'failure'); + } else { + Analytics.trackEvent('E2E', 'Decryption result', 'success'); + } + }); + const krh = new KeyRequestHandler(cli); cli.on("crypto.roomKeyRequest", (req) => { krh.handleKeyRequest(req);