Skip to content

Commit

Permalink
add OS version to analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed Apr 12, 2024
1 parent 80b1fbd commit 4ce020b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Backend/plausible_dio.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:convert';

Check warning on line 1 in lib/Backend/plausible_dio.dart

View workflow job for this annotation

GitHub Actions / Linter

Invalid format. For more details, see https://dart.dev/guides/language/effective-dart/style#formatting

import 'package:cross_platform/cross_platform.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:install_referrer/install_referrer.dart';
Expand Down Expand Up @@ -41,6 +43,13 @@ class PlausibleDio extends Plausible {
props['App Version'] = (await PackageInfo.fromPlatform()).version;
props['App Build'] = (await PackageInfo.fromPlatform()).buildNumber;

if (Platform.isAndroid) {
AndroidDeviceInfo androidDeviceInfo = await DeviceInfoPlugin().androidInfo;
props['OS Version'] = 'Android ${androidDeviceInfo.version.release}';
} else {
IosDeviceInfo iosDeviceInfo = await DeviceInfoPlugin().iosInfo;
props['OS Version'] = 'iOS ${iosDeviceInfo.systemVersion}';
}
// Http Post request see https://plausible.io/docs/events-api
try {
Object body = {
Expand Down

0 comments on commit 4ce020b

Please sign in to comment.