diff --git a/packages/builder/src/analytics/constants.js b/packages/builder/src/analytics/constants.js index d800ae2c3f..424b32c8a4 100644 --- a/packages/builder/src/analytics/constants.js +++ b/packages/builder/src/analytics/constants.js @@ -1,57 +1,6 @@ export const Events = { - // TODO: Remove most UI events - BUILDER: { - STARTED: "Builder Started", - }, - COMPONENT: { - CREATED: "Added Component", - }, - DATASOURCE: { - CREATED: "Datasource Created", - UPDATED: "Datasource Updated", - }, - QUERIES: { - REST: "REST Queries Imported", - }, - TABLE: { - CREATED: "Table Created", - }, - VIEW: { - CREATED: "View Created", - ADDED_FILTER: "Added View Filter", - ADDED_CALCULATE: "Added View Calculate", - }, - SCREEN: { - CREATED: "Screen Created", - CREATE_ROLE_UPDATED: "Changed Role On Screen Creation", - }, - AUTOMATION: { - CREATED: "Automation Created", - SAVED: "Automation Saved", - BLOCK_ADDED: "Added Automation Block", - }, - NPS: { - SUBMITTED: "budibase:feedback_submitted", - }, - APP: { - CREATED: "budibase:app_created", - PUBLISHED: "budibase:app_published", - UNPUBLISHED: "budibase:app_unpublished", - VIEW_PUBLISHED: "budibase:view_published_app", - }, - ANALYTICS: { - OPT_IN: "budibase:analytics_opt_in", - OPT_OUT: "budibase:analytics_opt_out", - }, - USER: { - INVITE: "budibase:portal_user_invite", - }, - SMTP: { - SAVED: "budibase:smtp_saved", - }, - SSO: { - SAVED: "budibase:sso_saved", - }, + COMPONENT_CREATED: "component:created", + APP_VIEW_PUBLISHED: "app:view_published", } export const EventSource = { diff --git a/packages/builder/src/analytics/index.js b/packages/builder/src/analytics/index.js index 1b03b0855e..24d3da43c1 100644 --- a/packages/builder/src/analytics/index.js +++ b/packages/builder/src/analytics/index.js @@ -11,7 +11,6 @@ const posthog = new PosthogClient( const sentry = new SentryClient(process.env.SENTRY_DSN) const intercom = new IntercomClient(process.env.INTERCOM_TOKEN) -// TODO: Remove most UI events class AnalyticsHub { constructor() { this.clients = [posthog, sentry, intercom] @@ -25,11 +24,8 @@ class AnalyticsHub { } } - identify(id, metadata) { + identify(id) { posthog.identify(id) - if (metadata) { - posthog.updateUser(metadata) - } sentry.identify(id) } @@ -46,10 +42,6 @@ class AnalyticsHub { intercom.show(user) } - submitFeedback(values) { - posthog.npsFeedback(values) - } - async logout() { posthog.logout() intercom.logout() diff --git a/packages/builder/src/builderStore/datasource.js b/packages/builder/src/builderStore/datasource.js index cfdeeac23e..804d88bad6 100644 --- a/packages/builder/src/builderStore/datasource.js +++ b/packages/builder/src/builderStore/datasource.js @@ -1,6 +1,5 @@ import { datasources, tables } from "../stores/backend" import { IntegrationNames } from "../constants/backend" -import analytics, { Events } from "../analytics" import { get } from "svelte/store" import cloneDeep from "lodash/cloneDeepWith" @@ -31,10 +30,6 @@ export async function saveDatasource(config, skipFetch = false) { // update the tables incase data source plus await tables.fetch() await datasources.select(resp._id) - analytics.captureEvent(Events.DATASOURCE.CREATED, { - name: resp.name, - source: resp.source, - }) return resp } diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index 5252d4b06a..cf42492c05 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -2,7 +2,6 @@ import { writable } from "svelte/store" import { API } from "api" import Automation from "./Automation" import { cloneDeep } from "lodash/fp" -import analytics, { Events } from "analytics" const initialAutomationState = { automations: [], @@ -125,9 +124,6 @@ const automationActions = store => ({ state.selectedBlock = newBlock return state }) - analytics.captureEvent(Events.AUTOMATION.BLOCK_ADDED, { - name: block.name, - }) }, toggleFieldControl: value => { store.update(state => { diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 3ffc890c7d..bc02e04db3 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -426,7 +426,7 @@ export const getFrontendStore = () => { }) // Log event - analytics.captureEvent(Events.COMPONENT.CREATED, { + analytics.captureEvent(Events.COMPONENT_CREATED, { name: componentInstance._component, }) diff --git a/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte b/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte index 4fb912939a..9543a9c552 100644 --- a/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte @@ -11,7 +11,6 @@ Body, Icon, } from "@budibase/bbui" - import analytics, { Events } from "analytics" let name let selectedTrigger @@ -47,7 +46,6 @@ notifications.success(`Automation ${name} created`) $goto(`./${$automationStore.selectedAutomation.automation._id}`) - analytics.captureEvent(Events.AUTOMATION.CREATED, { name }) } catch (error) { notifications.error("Error creating automation") } diff --git a/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte b/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte index bceff0ef2e..9075a5433c 100644 --- a/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte @@ -2,7 +2,6 @@ import { automationStore } from "builderStore" import { notifications } from "@budibase/bbui" import { Icon, Input, ModalContent, Modal } from "@budibase/bbui" - import analytics, { Events } from "analytics" let name let error = "" @@ -27,7 +26,6 @@ } await automationStore.actions.save(updatedAutomation) notifications.success(`Automation ${name} updated successfully`) - analytics.captureEvent(Events.AUTOMATION.SAVED, { name }) hide() } catch (error) { notifications.error("Error saving automation") diff --git a/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte b/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte index 81f54032f6..5487551137 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte @@ -1,7 +1,6 @@ diff --git a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte index 7830fd0246..49138a3b0e 100644 --- a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte +++ b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte @@ -11,7 +11,6 @@ Layout, } from "@budibase/bbui" import TableDataImport from "../TableDataImport.svelte" - import analytics, { Events } from "analytics" import { buildAutoColumn, getAutoColumnInformation } from "builderStore/utils" $: tableNames = $tables.list.map(table => table.name) @@ -59,7 +58,6 @@ try { table = await tables.save(newTable) notifications.success(`Table ${name} created successfully.`) - analytics.captureEvent(Events.TABLE.CREATED, { name }) // Navigate to new table const currentUrl = $url() diff --git a/packages/builder/src/components/deploy/DeployModal.svelte b/packages/builder/src/components/deploy/DeployModal.svelte index 0d9bfb7539..5b0dea33fc 100644 --- a/packages/builder/src/components/deploy/DeployModal.svelte +++ b/packages/builder/src/components/deploy/DeployModal.svelte @@ -31,9 +31,6 @@ published = await API.deployAppChanges() - analytics.captureEvent(Events.APP.PUBLISHED, { - appId: $store.appId, - }) if (typeof onOk === "function") { await onOk() } @@ -49,7 +46,7 @@ const viewApp = () => { if (published) { - analytics.captureEvent(Events.APP.VIEW_PUBLISHED, { + analytics.captureEvent(Events.APP_VIEW_PUBLISHED, { appId: $store.appId, eventSource: EventSource.PORTAL, }) diff --git a/packages/builder/src/components/deploy/DeployNavigation.svelte b/packages/builder/src/components/deploy/DeployNavigation.svelte index ded75652cc..9cb7efd362 100644 --- a/packages/builder/src/components/deploy/DeployNavigation.svelte +++ b/packages/builder/src/components/deploy/DeployNavigation.svelte @@ -57,7 +57,7 @@ } const viewApp = () => { - analytics.captureEvent(Events.APP.VIEW_PUBLISHED, { + analytics.captureEvent(Events.APP_VIEW_PUBLISHED, { appId: selectedApp.appId, eventSource: EventSource.PORTAL, }) @@ -79,9 +79,6 @@ return } try { - analytics.captureEvent(Events.APP.UNPUBLISHED, { - appId: selectedApp.appId, - }) await API.unpublishApp(selectedApp.prodId) await apps.load() notifications.success("App unpublished successfully") diff --git a/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte b/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte index 76bb48a26c..a9cffa2253 100644 --- a/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte +++ b/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte @@ -12,7 +12,6 @@ } from "@budibase/bbui" import ScreenDetailsModal from "../ScreenDetailsModal.svelte" import sanitizeUrl from "builderStore/store/screenTemplates/utils/sanitizeUrl" - import analytics, { Events } from "analytics" import { makeComponentUnique } from "builderStore/componentUtils" export let screenId @@ -40,13 +39,6 @@ try { // Create the screen await store.actions.screens.save(duplicateScreen) - - // Analytics - if (screen.template) { - analytics.captureEvent(Events.SCREEN.CREATED, { - template: "createFromScratch", - }) - } } catch (error) { notifications.error("Error duplicating screen") console.log(error) diff --git a/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte b/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte index 1859ba93b6..0a3c9611bc 100644 --- a/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte +++ b/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte @@ -5,7 +5,6 @@ import sanitizeUrl from "builderStore/store/screenTemplates/utils/sanitizeUrl" import { Modal, ModalContent, Select, notifications } from "@budibase/bbui" import { store, selectedAccessRole } from "builderStore" - import analytics, { Events } from "analytics" import { get } from "svelte/store" import getTemplates from "builderStore/store/screenTemplates" import { tables, roles } from "stores/backend" @@ -65,15 +64,6 @@ // Create the screen await store.actions.screens.save(screen) - // Analytics - if (screen.template) { - analytics.captureEvent(Events.SCREEN.CREATED, { - template: screen.template, - datasource: screen.datasource, - screenAccessRole, - }) - } - // Add link in layout for list screens if (screen.props._instanceName.endsWith("List")) { await store.actions.components.links.save( @@ -208,11 +198,6 @@ Select which level of access you want your screens to have