Skip to content

Commit

Permalink
Added user agent and screen width size to plausible
Browse files Browse the repository at this point in the history
  • Loading branch information
thePeras committed Jun 1, 2024
1 parent 02cd6d2 commit cc99880
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 83 deletions.
5 changes: 4 additions & 1 deletion uni/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:plausible_analytics/plausible_analytics.dart';
import 'package:provider/provider.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:ua_client_hints/ua_client_hints.dart';
import 'package:uni/controller/background_workers/background_callback.dart';
import 'package:uni/controller/cleanup.dart';
import 'package:uni/controller/fetchers/terms_and_conditions_fetcher.dart';
Expand Down Expand Up @@ -109,8 +110,10 @@ Future<void> main() async {
final plausibleUrl = dotenv.env['PLAUSIBLE_URL'];
final plausibleDomain = dotenv.env['PLAUSIBLE_DOMAIN'];

final String ua = await userAgent();

final plausible = plausibleUrl != null && plausibleDomain != null
? Plausible(plausibleUrl, plausibleDomain)
? Plausible(plausibleUrl, plausibleDomain, userAgent: userAgent)
: null;

if (plausible == null) {
Expand Down
3 changes: 3 additions & 0 deletions uni/lib/model/providers/plausible/plausible_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ class _PlausibleProviderState extends State<PlausibleProvider> {

@override
Widget build(BuildContext context) {
widget.plausible?.screenWidth =
MediaQuery.of(context).size.width.toString();

return Listener(
behavior: HitTestBehavior.translucent,
onPointerDown: (event) {
Expand Down
Loading

0 comments on commit cc99880

Please sign in to comment.