1
0
Fork 0
mirror of synced 2024-09-28 15:21:28 +12:00

Merge pull request #654 from mjashanks/bugfix

Bugfixes
This commit is contained in:
Michael Shanks 2020-10-01 10:12:25 +01:00 committed by GitHub
commit d36fa0ed39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 13 deletions

View file

@ -3,6 +3,8 @@ import posthog from "posthog-js"
import api from "builderStore/api"
let analyticsEnabled
const posthogConfigured = process.env.POSTHOG_TOKEN && process.env.POSTHOG_URL
const sentryConfigured = process.env.SENTRY_DSN
async function activate() {
if (analyticsEnabled === undefined) {
@ -13,21 +15,22 @@ async function activate() {
analyticsEnabled = (await response.json()) === true
}
if (!analyticsEnabled) return
Sentry.init({ dsn: process.env.SENTRY_DSN })
if (!process.env.POSTHOG_TOKEN) return
posthog.init(process.env.POSTHOG_TOKEN, {
api_host: process.env.POSTHOG_URL,
})
posthog.set_config({ persistence: "cookie" })
if (sentryConfigured) Sentry.init({ dsn: process.env.SENTRY_DSN })
if (posthogConfigured) {
posthog.init(process.env.POSTHOG_TOKEN, {
api_host: process.env.POSTHOG_URL,
})
posthog.set_config({ persistence: "cookie" })
}
}
function identify(id) {
if (!analyticsEnabled) return
if (!id) return
posthog.identify(id)
Sentry.configureScope(scope => {
scope.setUser({ id: id })
})
if (!analyticsEnabled || !id) return
if (posthogConfigured) posthog.identify(id)
if (sentryConfigured)
Sentry.configureScope(scope => {
scope.setUser({ id: id })
})
}
async function identifyByApiKey(apiKey) {

View file

@ -37,7 +37,9 @@
if (keys.userId) {
hasKey = true
analytics.identify(keys.userId)
} else {
}
if (!keys.budibase) {
showCreateAppModal()
}
}