From 4003d4f1aa9a8ffd19ccdd0fb937eaa0238a81f3 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Mon, 26 Nov 2018 09:58:39 +0200 Subject: [PATCH] Add event tracking to autocomplete toggle & trackEvent helper function (#3114) * Add non Angular version of Events. * Add event tracking for autocomplete toggle * Fix lint error in QueryEditor --- client/app/components/AutocompleteToggle.jsx | 8 +++++- client/app/components/QueryEditor.jsx | 10 +++---- client/app/lib/recordEvent.js | 25 +++++++++++++++++ client/app/services/events.js | 28 +++----------------- 4 files changed, 41 insertions(+), 30 deletions(-) create mode 100644 client/app/lib/recordEvent.js diff --git a/client/app/components/AutocompleteToggle.jsx b/client/app/components/AutocompleteToggle.jsx index dd7612e7..e74e0a90 100644 --- a/client/app/components/AutocompleteToggle.jsx +++ b/client/app/components/AutocompleteToggle.jsx @@ -2,6 +2,7 @@ import React from 'react'; import Tooltip from 'antd/lib/tooltip'; import PropTypes from 'prop-types'; import '@/redash-font/style.less'; +import recordEvent from '@/lib/recordEvent'; export default function AutocompleteToggle({ state, disabled, onToggle }) { let tooltipMessage = 'Live Autocomplete Enabled'; @@ -16,12 +17,17 @@ export default function AutocompleteToggle({ state, disabled, onToggle }) { icon = 'icon-flash-off'; } + const toggle = (newState) => { + recordEvent('toggle_autocomplete', 'screen', 'query_editor', { state: newState }); + onToggle(newState); + }; + return (