diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index baacc9f3..ad376e3a 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -266,11 +266,16 @@ class SnippetNoteDetail extends React.Component { } renameSnippetByIndex (index, name) { - let snippets = this.state.note.snippets.slice() + const snippets = this.state.note.snippets.slice() snippets[index].name = name - let syntax = CodeMirror.findModeByFileName(name.trim()) - let mode = syntax != null ? syntax.name : null - if (mode != null) snippets[index].mode = mode + const syntax = CodeMirror.findModeByFileName(name.trim()) + const mode = syntax != null ? syntax.name : null + if (mode != null) { + snippets[index].mode = mode + AwsMobileAnalyticsConfig.recordDynamicCustomEvent('SNIPPET_LANG', { + name: mode + }) + } this.setState({note: Object.assign(this.state.note, {snippets: snippets})}) this.setState({ @@ -291,6 +296,10 @@ class SnippetNoteDetail extends React.Component { }, () => { this.save() }) + + AwsMobileAnalyticsConfig.recordDynamicCustomEvent('SELECT_LANG', { + name + }) } } diff --git a/browser/main/lib/AwsMobileAnalyticsConfig.js b/browser/main/lib/AwsMobileAnalyticsConfig.js index 503adae9..4c0e15b5 100644 --- a/browser/main/lib/AwsMobileAnalyticsConfig.js +++ b/browser/main/lib/AwsMobileAnalyticsConfig.js @@ -44,10 +44,10 @@ function initAwsMobileAnalytics () { }) } -function recordDynamicCustomEvent (type) { +function recordDynamicCustomEvent (type, options = {}) { if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return try { - mobileAnalyticsClient.recordEvent(type) + mobileAnalyticsClient.recordEvent(type, options) } catch (analyticsError) { if (analyticsError instanceof ReferenceError) { console.log(analyticsError.name + ': ' + analyticsError.message)