Remove ui events except for component created and view published app
This commit is contained in:
parent
23b1aea277
commit
14e9fb4505
|
@ -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 = {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -426,7 +426,7 @@ export const getFrontendStore = () => {
|
|||
})
|
||||
|
||||
// Log event
|
||||
analytics.captureEvent(Events.COMPONENT.CREATED, {
|
||||
analytics.captureEvent(Events.COMPONENT_CREATED, {
|
||||
name: componentInstance._component,
|
||||
})
|
||||
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<script>
|
||||
import { Select, Label, notifications, ModalContent } from "@budibase/bbui"
|
||||
import { tables, views } from "stores/backend"
|
||||
import analytics, { Events } from "analytics"
|
||||
import { FIELDS } from "constants/backend"
|
||||
|
||||
const CALCULATIONS = [
|
||||
|
@ -41,7 +40,6 @@
|
|||
try {
|
||||
views.save(view)
|
||||
notifications.success(`View ${view.name} saved`)
|
||||
analytics.captureEvent(Events.VIEW.ADDED_CALCULATE, { field: view.field })
|
||||
} catch (error) {
|
||||
notifications.error("Error saving view")
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import { goto } from "@roxi/routify"
|
||||
import { views as viewsStore } from "stores/backend"
|
||||
import { tables } from "stores/backend"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
let name
|
||||
let field
|
||||
|
@ -22,7 +21,6 @@
|
|||
field,
|
||||
})
|
||||
notifications.success(`View ${name} created`)
|
||||
analytics.captureEvent(Events.VIEW.CREATED, { name })
|
||||
$goto(`../../view/${name}`)
|
||||
} catch (error) {
|
||||
notifications.error("Error creating view")
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
Icon,
|
||||
} from "@budibase/bbui"
|
||||
import { tables, views } from "stores/backend"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
const CONDITIONS = [
|
||||
{
|
||||
|
@ -75,9 +74,6 @@
|
|||
try {
|
||||
views.save(view)
|
||||
notifications.success(`View ${view.name} saved`)
|
||||
analytics.captureEvent(Events.VIEW.ADDED_FILTER, {
|
||||
filters: JSON.stringify(view.filters),
|
||||
})
|
||||
} catch (error) {
|
||||
notifications.error("Error saving view")
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
TextArea,
|
||||
Dropzone,
|
||||
} from "@budibase/bbui"
|
||||
import analytics, { Events } from "analytics"
|
||||
import { datasources, queries } from "stores/backend"
|
||||
import { writable } from "svelte/store"
|
||||
|
||||
|
@ -72,11 +71,6 @@
|
|||
}
|
||||
|
||||
notifications.success(`Imported successfully.`)
|
||||
analytics.captureEvent(Events.QUERIES.REST.IMPORTED, {
|
||||
importType: lastTouched,
|
||||
newDatasource: createDatasource,
|
||||
})
|
||||
|
||||
return true
|
||||
} catch (error) {
|
||||
notifications.error("Error importing queries")
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import { datasources } from "stores/backend"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import { Input, ModalContent, Modal } from "@budibase/bbui"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
let error = ""
|
||||
let modal
|
||||
|
@ -35,7 +34,6 @@
|
|||
}
|
||||
await datasources.save(updatedDatasource)
|
||||
notifications.success(`Datasource ${name} updated successfully.`)
|
||||
analytics.captureEvent(Events.DATASOURCE.UPDATED, updatedDatasource)
|
||||
hide()
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
<Select
|
||||
bind:value={screenAccessRole}
|
||||
on:change={() => {
|
||||
analytics.captureEvent(Events.SCREEN.CREATE_ROLE_UPDATED, {
|
||||
screenAccessRole,
|
||||
})
|
||||
}}
|
||||
label="Access"
|
||||
getOptionLabel={role => role.name}
|
||||
getOptionValue={role => role._id}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
import { store, automationStore } from "builderStore"
|
||||
import { API } from "api"
|
||||
import { apps, admin, auth } from "stores/portal"
|
||||
import analytics, { Events } from "analytics"
|
||||
import { onMount } from "svelte"
|
||||
import { goto } from "@roxi/routify"
|
||||
import { createValidationStore } from "helpers/validation/yup"
|
||||
|
@ -103,11 +102,6 @@
|
|||
|
||||
// Create App
|
||||
const createdApp = await API.createApp(data)
|
||||
analytics.captureEvent(Events.APP.CREATED, {
|
||||
name: $values.name,
|
||||
appId: createdApp.instance._id,
|
||||
templateToUse: template,
|
||||
})
|
||||
|
||||
// Select Correct Application/DB in prep for creating user
|
||||
const pkg = await API.fetchAppPackage(createdApp.instance._id)
|
||||
|
|
|
@ -138,12 +138,6 @@
|
|||
|
||||
// Create App
|
||||
const createdApp = await API.createApp(data)
|
||||
analytics.captureEvent(Events.APP.CREATED, {
|
||||
name: appName,
|
||||
appId: createdApp.instance._id,
|
||||
template,
|
||||
fromTemplateMarketplace: true,
|
||||
})
|
||||
|
||||
// Select Correct Application/DB in prep for creating user
|
||||
const pkg = await API.fetchAppPackage(createdApp.instance._id)
|
||||
|
@ -169,7 +163,7 @@
|
|||
}
|
||||
|
||||
const viewApp = app => {
|
||||
analytics.captureEvent(Events.APP.VIEW_PUBLISHED, {
|
||||
analytics.captureEvent(Events.APP_VIEW_PUBLISHED, {
|
||||
appId: app.appId,
|
||||
eventSource: EventSource.PORTAL,
|
||||
})
|
||||
|
@ -215,9 +209,6 @@
|
|||
return
|
||||
}
|
||||
try {
|
||||
analytics.captureEvent(Events.APP.UNPUBLISHED, {
|
||||
appId: selectedApp.appId,
|
||||
})
|
||||
await API.unpublishApp(selectedApp.prodId)
|
||||
await apps.load()
|
||||
notifications.success("App unpublished successfully")
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
import { API } from "api"
|
||||
import { organisation, admin } from "stores/portal"
|
||||
import { Helpers } from "@budibase/bbui"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
const ConfigTypes = {
|
||||
Google: "google",
|
||||
|
@ -209,8 +208,6 @@
|
|||
providers[res.type]._id = res._id
|
||||
})
|
||||
notifications.success(`Settings saved`)
|
||||
// todo: move to api
|
||||
analytics.captureEvent(Events.SSO.SAVED)
|
||||
})
|
||||
.catch(() => {
|
||||
notifications.error("Failed to update auth settings")
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
import { email, admin } from "stores/portal"
|
||||
import { API } from "api"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
const ConfigTypes = {
|
||||
SMTP: "smtp",
|
||||
|
@ -60,7 +59,6 @@
|
|||
smtpConfig._id = savedConfig._id
|
||||
await admin.getChecklist()
|
||||
notifications.success(`Settings saved`)
|
||||
analytics.captureEvent(Events.SMTP.SAVED)
|
||||
} catch (error) {
|
||||
notifications.error(
|
||||
`Failed to save email settings, reason: ${error?.message || "Unknown"}`
|
||||
|
@ -80,7 +78,6 @@
|
|||
}
|
||||
await admin.getChecklist()
|
||||
notifications.success(`Settings cleared`)
|
||||
analytics.captureEvent(Events.SMTP.SAVED)
|
||||
} catch (error) {
|
||||
notifications.error(
|
||||
`Failed to clear email settings, reason: ${error?.message || "Unknown"}`
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
} from "@budibase/bbui"
|
||||
import { createValidationStore, emailValidator } from "helpers/validation"
|
||||
import { users } from "stores/portal"
|
||||
import analytics, { Events } from "analytics"
|
||||
|
||||
export let disabled
|
||||
|
||||
|
@ -24,7 +23,6 @@
|
|||
try {
|
||||
const res = await users.invite({ email: $email, builder, admin })
|
||||
notifications.success(res.message)
|
||||
analytics.captureEvent(Events.USER.INVITE, { type: selected })
|
||||
} catch (error) {
|
||||
notifications.error("Error inviting user")
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
|
||||
const viewApp = () => {
|
||||
if (isPublished) {
|
||||
analytics.captureEvent(Events.APP.VIEW_PUBLISHED, {
|
||||
analytics.captureEvent(Events.APP_VIEW_PUBLISHED, {
|
||||
appId: $store.appId,
|
||||
eventSource: EventSource.PORTAL,
|
||||
})
|
||||
|
@ -154,9 +154,6 @@
|
|||
return
|
||||
}
|
||||
try {
|
||||
analytics.captureEvent(Events.APP.UNPUBLISHED, {
|
||||
appId: selectedApp.appId,
|
||||
})
|
||||
await API.unpublishApp(selectedApp.prodId)
|
||||
await apps.load()
|
||||
notifications.success("App unpublished successfully")
|
||||
|
|
|
@ -57,7 +57,7 @@ export function createAuthStore() {
|
|||
analytics
|
||||
.activate()
|
||||
.then(() => {
|
||||
analytics.identify(user._id, user)
|
||||
analytics.identify(user._id)
|
||||
analytics.showChat({
|
||||
email: user.email,
|
||||
created_at: (user.createdAt || Date.now()) / 1000,
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
const PostHog = require("posthog-node")
|
||||
const {
|
||||
BUDIBASE_POSTHOG_URL,
|
||||
BUDIBASE_POSTHOG_TOKEN,
|
||||
AnalyticsEvents,
|
||||
} = require("../constants")
|
||||
const { POSTHOG_TOKEN, AnalyticsEvents } = require("../constants")
|
||||
const ConfigManager = require("../structures/ConfigManager")
|
||||
|
||||
class AnalyticsClient {
|
||||
constructor() {
|
||||
this.client = new PostHog(BUDIBASE_POSTHOG_TOKEN, {
|
||||
host: BUDIBASE_POSTHOG_URL,
|
||||
})
|
||||
this.client = new PostHog(POSTHOG_TOKEN)
|
||||
this.configManager = new ConfigManager()
|
||||
}
|
||||
|
||||
|
|
|
@ -10,11 +10,9 @@ exports.InitTypes = {
|
|||
}
|
||||
|
||||
exports.AnalyticsEvents = {
|
||||
OptOut: "analytics_opt_out",
|
||||
OptIn: "analytics_opt_in",
|
||||
SelfHostInit: "hosting_init",
|
||||
OptOut: "analytics:opt:out",
|
||||
OptIn: "analytics:opt:in",
|
||||
SelfHostInit: "hosting:init",
|
||||
}
|
||||
|
||||
exports.BUDIBASE_POSTHOG_URL = "https://app.posthog.com"
|
||||
exports.BUDIBASE_POSTHOG_TOKEN =
|
||||
"phc_yGOn4i7jWKaCTapdGR6lfA4AvmuEQ2ijn5zAVSFYPlS"
|
||||
exports.POSTHOG_TOKEN = "phc_yGOn4i7jWKaCTapdGR6lfA4AvmuEQ2ijn5zAVSFYPlS"
|
||||
|
|
|
@ -70,7 +70,6 @@ module.exports = {
|
|||
AUTOMATION_MAX_ITERATIONS: process.env.AUTOMATION_MAX_ITERATIONS,
|
||||
SENDGRID_API_KEY: process.env.SENDGRID_API_KEY,
|
||||
DYNAMO_ENDPOINT: process.env.DYNAMO_ENDPOINT,
|
||||
POSTHOG_TOKEN: process.env.POSTHOG_TOKEN,
|
||||
QUERY_THREAD_TIMEOUT: parseIntSafe(process.env.QUERY_THREAD_TIMEOUT),
|
||||
SQL_MAX_ROWS: process.env.SQL_MAX_ROWS,
|
||||
// flags
|
||||
|
|
Loading…
Reference in New Issue