feat: anonymous analytics with PostHog (#3)
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
import SwiftUI
|
||||
import Sparkle
|
||||
import PostHog
|
||||
|
||||
@main
|
||||
struct MeetingnotesApp: App {
|
||||
@@ -14,6 +15,22 @@ struct MeetingnotesApp: App {
|
||||
|
||||
init() {
|
||||
updaterController = SPUStandardUpdaterController(updaterDelegate: nil, userDriverDelegate: nil)
|
||||
// Setup PostHog analytics for anonymous tracking
|
||||
let posthogAPIKey = "phc_Wt8sWUzUF7YPF50aQ0B1qbfA5SJWWR341zmXCaIaIRJ"
|
||||
let posthogHost = "https://us.i.posthog.com"
|
||||
let config = PostHogConfig(apiKey: posthogAPIKey, host: posthogHost)
|
||||
// Only capture anonymous events
|
||||
config.personProfiles = .never
|
||||
// Enable lifecycle and screen view autocapture
|
||||
config.captureApplicationLifecycleEvents = true
|
||||
config.captureScreenViews = true
|
||||
PostHogSDK.shared.setup(config)
|
||||
// Register environment as a super property
|
||||
#if DEBUG
|
||||
PostHogSDK.shared.register(["environment": "dev"] )
|
||||
#else
|
||||
PostHogSDK.shared.register(["environment": "prod"] )
|
||||
#endif
|
||||
}
|
||||
|
||||
var body: some Scene {
|
||||
|
||||
Reference in New Issue
Block a user