From 3ce74a3877ffa489eeed28c95105ba39cda26f3e Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Mon, 17 Jun 2019 15:48:49 +0100 Subject: [PATCH] Merge pull request #1868 from overleaf/bg-sanitise-error-for-google-analytics sanitise error sent to google analytics GitOrigin-RevId: 6307b7a54f18b9e8a1da31f45a5a148e1321db62 --- services/web/public/src/ide/editor/Document.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/web/public/src/ide/editor/Document.js b/services/web/public/src/ide/editor/Document.js index 7a8ac2c2ab..671823ae4e 100644 --- a/services/web/public/src/ide/editor/Document.js +++ b/services/web/public/src/ide/editor/Document.js @@ -670,12 +670,19 @@ define([ return } if (typeof ga === 'function') { + // sanitise the error message before sending (the "delete component" + // error in public/js/libs/sharejs.js includes the some document + // content). + let message = error.message + if (/^Delete component/.test(message)) { + message = 'Delete component does not match deleted text' + } ga( 'send', 'event', 'error', 'shareJsError', - `${error.message} - ${this.ide.socket.socket.transport.name}` + `${message} - ${this.ide.socket.socket.transport.name}` ) } if (this.doc != null) {