feat: update posthog configuration
This commit is contained in:
parent
19f583c079
commit
234aa68cb9
@ -1,15 +1,37 @@
|
||||
import posthog, { Properties } from 'posthog-js'
|
||||
|
||||
// Initialize PostHog
|
||||
posthog.init(ANALYTICS_ID, {
|
||||
api_host: ANALYTICS_HOST,
|
||||
autocapture: false,
|
||||
capture_pageview: false,
|
||||
capture_pageleave: false,
|
||||
rageclick: false,
|
||||
})
|
||||
|
||||
// Export the PostHog instance
|
||||
export const instance = posthog
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const trackEvent = (name: string, properties?: Properties) => {
|
||||
posthog.capture(name, properties)
|
||||
// Enum for Analytics Events
|
||||
export enum AnalyticsEvent {
|
||||
Ping = 'Ping',
|
||||
}
|
||||
|
||||
export enum AnalyticsEvent {}
|
||||
// Function to determine the operating system
|
||||
function getOperatingSystem(): string {
|
||||
if (isMac) return 'MacOS'
|
||||
if (isWindows) return 'Windows'
|
||||
if (isLinux) return 'Linux'
|
||||
return 'Unknown'
|
||||
}
|
||||
|
||||
// Function to capture app version and operating system
|
||||
function captureAppVersionAndOS() {
|
||||
const properties: Properties = {
|
||||
JanVersion: VERSION,
|
||||
userOperatingSystem: getOperatingSystem(),
|
||||
}
|
||||
posthog.capture(AnalyticsEvent.Ping, properties)
|
||||
}
|
||||
|
||||
// Example usage
|
||||
captureAppVersionAndOS()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user