diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 78111576..d365e371 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -65,5 +65,8 @@
+
+
+
diff --git a/ios/Podfile b/ios/Podfile
index 164df534..3e44f9c6 100644
--- a/ios/Podfile
+++ b/ios/Podfile
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
-platform :ios, '12.0'
+platform :ios, '13.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 918ea494..d84376ed 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -70,5 +70,7 @@
UIStatusBarHidden
+ com.posthog.posthog.AUTO_INIT
+
diff --git a/lib/main.dart b/lib/main.dart
index 09fc9395..9dab51ff 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -36,6 +36,9 @@ Future main() async {
yield LicenseEntryWithLineBreaks(['google_fonts'], license);
});
+ // Initialize analytics
+ await initAnalytics();
+
final configService = ConfigService();
await configService.initialize();
diff --git a/lib/util/analytics.dart b/lib/util/analytics.dart
new file mode 100644
index 00000000..a611aefc
--- /dev/null
+++ b/lib/util/analytics.dart
@@ -0,0 +1,12 @@
+import 'package:posthog_flutter/posthog_flutter.dart';
+
+/// Initialize PostHog
+Future initAnalytics() async {
+ final config =
+ PostHogConfig('phc_maDGNEUn4Xpo0Nys1jNI2GnZjEQTVD2IIymbcRxBPta');
+ config.host = 'https://eu.i.posthog.com';
+ config.sendFeatureFlagEvents = false;
+ config.preloadFeatureFlags = false;
+ final posthog = Posthog();
+ await posthog.setup(config);
+}
diff --git a/lib/util/util.dart b/lib/util/util.dart
index 89170d0f..d4485dd6 100644
--- a/lib/util/util.dart
+++ b/lib/util/util.dart
@@ -1,3 +1,4 @@
+export 'analytics.dart';
export 'base32.dart';
export 'colors.dart';
export 'datetime.dart';
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index c2769b26..8b55c823 100644
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -9,6 +9,7 @@ import app_links
import file_selector_macos
import google_sign_in_ios
import path_provider_foundation
+import posthog_flutter
import share_plus
import shared_preferences_foundation
import sign_in_with_apple
@@ -19,6 +20,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
+ PosthogFlutterPlugin.register(with: registry.registrar(forPlugin: "PosthogFlutterPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
diff --git a/macos/Runner/Info.plist b/macos/Runner/Info.plist
index 4789daa6..f0a25263 100644
--- a/macos/Runner/Info.plist
+++ b/macos/Runner/Info.plist
@@ -28,5 +28,7 @@
MainMenu
NSPrincipalClass
NSApplication
+ com.posthog.posthog.AUTO_INIT
+
diff --git a/pubspec.lock b/pubspec.lock
index 1f7fe8da..6c312d46 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1081,6 +1081,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.4.0"
+ posthog_flutter:
+ dependency: "direct main"
+ description:
+ name: posthog_flutter
+ sha256: c2d45937331785d49f5be6583a73e7c011b8480e3949744edb9107ae7d41c2c1
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.9.0"
process:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index e07b1574..8276503f 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -90,6 +90,7 @@ dependencies:
google_fonts: ^6.2.1
mime: ^1.0.4
memoized: ^2.2.6
+ posthog_flutter: ^4.9.0
universal_html: ^2.2.4
uuid: ^4.1.0
share_plus: ^10.1.2
diff --git a/web/index.html b/web/index.html
index 18adb787..6666201c 100644
--- a/web/index.html
+++ b/web/index.html
@@ -110,6 +110,13 @@
document.body.style.background = "transparent";
}
+