Merge pull request #7145 from Budibase/disable-posthog-pageview
Disable pageview event
This commit is contained in:
commit
0b9af18eaa
|
@ -1,7 +1,5 @@
|
||||||
import posthog from "posthog-js"
|
import posthog from "posthog-js"
|
||||||
import { Events } from "./constants"
|
import { Events } from "./constants"
|
||||||
import { get } from "svelte/store"
|
|
||||||
import { admin } from "../stores/portal"
|
|
||||||
|
|
||||||
export default class PosthogClient {
|
export default class PosthogClient {
|
||||||
constructor(token) {
|
constructor(token) {
|
||||||
|
@ -11,15 +9,9 @@ export default class PosthogClient {
|
||||||
init() {
|
init() {
|
||||||
if (!this.token) return
|
if (!this.token) return
|
||||||
|
|
||||||
// enable page views in cloud only
|
|
||||||
let capturePageViews = false
|
|
||||||
if (get(admin).cloud) {
|
|
||||||
capturePageViews = true
|
|
||||||
}
|
|
||||||
|
|
||||||
posthog.init(this.token, {
|
posthog.init(this.token, {
|
||||||
autocapture: false,
|
autocapture: false,
|
||||||
capture_pageview: capturePageViews,
|
capture_pageview: false,
|
||||||
})
|
})
|
||||||
posthog.set_config({ persistence: "cookie" })
|
posthog.set_config({ persistence: "cookie" })
|
||||||
|
|
||||||
|
|
|
@ -139,11 +139,6 @@ export function createAuthStore() {
|
||||||
await setOrganisation(tenantId)
|
await setOrganisation(tenantId)
|
||||||
},
|
},
|
||||||
getSelf: async () => {
|
getSelf: async () => {
|
||||||
// for analytics, we need to make sure the environment has been loaded
|
|
||||||
// before setting the user
|
|
||||||
if (!get(admin).loaded) {
|
|
||||||
await admin.init()
|
|
||||||
}
|
|
||||||
// We need to catch this locally as we never want this to fail, even
|
// We need to catch this locally as we never want this to fail, even
|
||||||
// though normally we never want to swallow API errors at the store level.
|
// though normally we never want to swallow API errors at the store level.
|
||||||
// We're either logged in or we aren't.
|
// We're either logged in or we aren't.
|
||||||
|
|
Loading…
Reference in New Issue