2020-07-14 17:00:58 +02:00
|
|
|
import * as Sentry from "@sentry/browser"
|
|
|
|
import posthog from "posthog-js"
|
|
|
|
|
|
|
|
function activate() {
|
|
|
|
Sentry.init({ dsn: process.env.SENTRY_DSN })
|
2020-08-05 16:18:28 +02:00
|
|
|
if (!process.env.POSTHOG_TOKEN) return
|
2020-07-14 17:00:58 +02:00
|
|
|
posthog.init(process.env.POSTHOG_TOKEN, {
|
|
|
|
api_host: process.env.POSTHOG_URL,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function captureException(err) {
|
|
|
|
Sentry.captureException(err)
|
|
|
|
}
|
|
|
|
|
2020-07-15 18:25:08 +02:00
|
|
|
function captureEvent(event) {
|
2020-08-05 16:18:28 +02:00
|
|
|
if (!process.env.POSTHOG_TOKEN) return
|
2020-07-15 18:25:08 +02:00
|
|
|
posthog.capture(event)
|
|
|
|
}
|
|
|
|
|
2020-07-14 17:00:58 +02:00
|
|
|
export default {
|
|
|
|
activate,
|
|
|
|
captureException,
|
2020-07-16 16:19:46 +02:00
|
|
|
captureEvent,
|
2020-07-14 17:00:58 +02:00
|
|
|
}
|