Merge pull request #1868 from overleaf/bg-sanitise-error-for-google-analytics

sanitise error sent to google analytics

GitOrigin-RevId: 6307b7a54f18b9e8a1da31f45a5a148e1321db62
This commit is contained in:
Simon Detheridge 2019-06-17 15:48:49 +01:00 committed by sharelatex
parent 08861187d5
commit 3ce74a3877

View file

@ -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) {