From a6653997855d722f5fb7f105f2b5f0d2e27f51ae Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Tue, 29 Sep 2020 16:35:47 +0100 Subject: [PATCH] Extra analytics logging from code review --- packages/builder/src/analytics.js | 1 + .../components/database/DataTable/popovers/Calculate.svelte | 2 +- .../src/components/database/DataTable/popovers/Filter.svelte | 4 +++- packages/builder/src/components/start/CreateAppModal.svelte | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/analytics.js b/packages/builder/src/analytics.js index 64998efd61..8761d463c6 100644 --- a/packages/builder/src/analytics.js +++ b/packages/builder/src/analytics.js @@ -50,6 +50,7 @@ async function identifyByApiKey(apiKey) { function captureException(err) { if (!analyticsEnabled) return Sentry.captureException(err) + captureEvent("Error", { error: err.message ? err.message : err }) } function captureEvent(eventName, props = {}) { diff --git a/packages/builder/src/components/database/DataTable/popovers/Calculate.svelte b/packages/builder/src/components/database/DataTable/popovers/Calculate.svelte index 6cba46ed11..e86e7fc922 100644 --- a/packages/builder/src/components/database/DataTable/popovers/Calculate.svelte +++ b/packages/builder/src/components/database/DataTable/popovers/Calculate.svelte @@ -36,7 +36,7 @@ function saveView() { backendUiStore.actions.views.save(view) notifier.success(`View ${view.name} saved.`) - analytics.captureEvent("Added View Calculate") + analytics.captureEvent("Added View Calculate", { field: view.field }) dropdown.hide() } diff --git a/packages/builder/src/components/database/DataTable/popovers/Filter.svelte b/packages/builder/src/components/database/DataTable/popovers/Filter.svelte index f11bef7dcb..8f1b972538 100644 --- a/packages/builder/src/components/database/DataTable/popovers/Filter.svelte +++ b/packages/builder/src/components/database/DataTable/popovers/Filter.svelte @@ -64,7 +64,9 @@ backendUiStore.actions.views.save(view) notifier.success(`View ${view.name} saved.`) dropdown.hide() - analytics.captureEvent("Added View Filter") + analytics.captureEvent("Added View Filter", { + filters: JSON.stringify(view.filters), + }) } function removeFilter(idx) { diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index 7f23e73230..84ddd9f8ec 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -30,6 +30,7 @@ // make sure we only fetch once, unless API Key is changed if (isApiKeyValid === undefined || apiKey !== lastApiKey) { + lastApiKey = apiKey // svelte reactivity was causing a requst to get fired mutiple times // so, we make everything await the same promise, if one exists if (!fetchApiKeyPromise) {