Skip to content

Commit

Permalink
Add visits metric in summary
Browse files Browse the repository at this point in the history
  • Loading branch information
davquar committed May 11, 2024
1 parent 9241cba commit c65370d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"@visitors": {
"description": "Unique visitors"
},
"visits": "Visits",
"@visitors": {
"description": "Unique sessions"
},
"bounces": "Bounces",
"@bounces": {
"description": "Bounces"
Expand Down
5 changes: 4 additions & 1 deletion lib/models/api/stats.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import 'package:halfdot/models/api/common.dart';

class StatsResponse implements ApiModel {
StatsResponse(this.pageViews, this.visitors, this.bounces, this.totalTime);
StatsResponse(
this.pageViews, this.visits, this.visitors, this.bounces, this.totalTime);

StatsResponse.fromJson(Map<String, dynamic> json)
: pageViews = json['pageviews']['value'],
visits = json['visits']['value'],
visitors = json['visitors']['value'],
bounces = json['bounces']['value'],
totalTime = json['totaltime']['value'];

final int pageViews;
final int visits;
final int visitors;
final int bounces;
final int totalTime;
Expand Down
9 changes: 9 additions & 0 deletions lib/screens/website_statistics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ class _WebsiteStatisticsPageState extends State<WebsiteStatisticsPage> {
.pageViews),
],
),
Column(children: <Widget>[
Text(
snapshot.data!.visits.toString(),
style: Theme.of(context)
.textTheme
.titleLarge,
),
Text(AppLocalizations.of(context)!.visits),
]),
Column(children: <Widget>[
Text(
snapshot.data!.visitors.toString(),
Expand Down

0 comments on commit c65370d

Please sign in to comment.