Merge pull request #7145 from Budibase/disable-posthog-pageview

Disable pageview event
This commit is contained in:
Rory Powell 2022-08-08 15:03:17 +01:00 committed by GitHub
commit 0b9af18eaa
2 changed files with 1 additions and 14 deletions

View File

@ -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" })

View File

@ -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.