mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 12:25:17 +00:00
Attempt to fix false user multiplication in analytics (#6980)
This commit is contained in:
parent
c0021bbe7c
commit
1192e23d18
@ -2,7 +2,7 @@ import { AnalyticProvider } from "@hcengineering/analytics"
|
||||
import posthog from 'posthog-js'
|
||||
|
||||
export class PosthogAnalyticProvider implements AnalyticProvider {
|
||||
init (config: Record<string, any>): boolean {
|
||||
init(config: Record<string, any>): boolean {
|
||||
if (config.POSTHOG_API_KEY !== undefined && config.POSTHOG_API_KEY !== '' && config.POSTHOG_HOST !== null) {
|
||||
posthog.init(config.POSTHOG_API_KEY, { api_host: config.POSTHOG_HOST })
|
||||
return true
|
||||
@ -11,7 +11,9 @@ export class PosthogAnalyticProvider implements AnalyticProvider {
|
||||
}
|
||||
|
||||
setUser(email: string): void {
|
||||
posthog.identify(email, { email: email })
|
||||
if (!posthog._isIdentified()) {
|
||||
posthog.identify(email, { email: email })
|
||||
}
|
||||
}
|
||||
setTag(key: string, value: string): void {
|
||||
posthog.setPersonProperties({ [key]: value })
|
||||
|
Loading…
Reference in New Issue
Block a user