Skip to content

Commit

Permalink
Fixed umami stats in admin dashboard, added quick links
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamieljv committed May 13, 2024
1 parent a8d2d50 commit 41c00c7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
20 changes: 11 additions & 9 deletions resources/js/components/StatsDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ export default {
},
names: {
'pageviews': 'pageviews',
'uniques': 'visitors',
'visitors': 'visitors',
'bouncerate': 'bounce rate',
'avgtime': 'average visit',
}
}
},
mounted() {
this.visitStats = ["pageviews", "uniques", "bouncerate", "avgtime"]
this.visitStats = ["pageviews", "visitors", "bouncerate", "avgtime"]
.reduce((acc,curr)=> (acc[curr]={value: "N/A", change: "N/A"},acc),{})
this.platformStats = ["acties", "users", "organizers"]
.reduce((acc,curr)=> (acc[curr]="N/A",acc),{})
Expand Down Expand Up @@ -155,20 +155,22 @@ export default {
})
},
processData(data) {
const { pageviews, uniques, bounces, totaltime } = data || {};
const num = Math.min(data && uniques.value, data && bounces.value);
console.log(data);
const { bounces, pageviews, totaltime, visitors, visits } = data || {};
const num = Math.min(data && visitors.value, data && bounces.value);
const diffs = data && {
pageviews: pageviews.value - pageviews.change,
uniques: uniques.value - uniques.change,
visitors: visitors.value - visitors.change,
visits: visits.value - visits.change,
bounces: bounces.value - bounces.change,
totaltime: totaltime.value - totaltime.change,
};
var computedStats = {
bouncerate: {
value: Number(uniques.value ? (num / uniques.value) * 100 : 0).toFixed(0) + '%',
change: Number(uniques.value && uniques.change
? (num / uniques.value) * 100 -
(Math.min(diffs.uniques, diffs.bounces) / diffs.uniques) * 100 || 0
value: Number(visitors.value ? (num / visitors.value) * 100 : 0).toFixed(0) + '%',
change: Number(visitors.value && visitors.change
? (num / visitors.value) * 100 -
(Math.min(diffs.visitors, diffs.bounces) / diffs.visitors) * 100 || 0
: 0).toFixed(0) + '%',
},
avgtime: {
Expand Down
24 changes: 24 additions & 0 deletions resources/views/vendor/voyager/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@
<div class="page-content container-fluid">
@include('voyager::alerts')

<div class="col-md-12">
<div class="panel panel-bordered">
<div class="panel-body">
<div class="flex border-0">
<h2>Quick links</h2>
</div>
<div class="flex border-0">
<a href="{{ route('voyager.acties.create') }}" class="quick-link">
<button class="btn btn-primary" style="margin-right: 5px">
<span style="font-size: 21px; font-weight: bold; line-height: 9px; margin-right: 2px;">+</span><i class="voyager-exclamation"></i>
<span>Actie toevoegen</span>
</button>
</a>
<a href="{{ route('voyager.organizers.create') }}" class="quick-link">
<button class="btn btn-primary" style="margin-right: 5px">
<span style="font-size: 21px; font-weight: bold; line-height: 9px; margin-right: 2px;">+</span><i class="voyager-pirate"></i>
<span>Organizer toevoegen</span>
</button>
</a>
</div>
</div>
</div>
</div>

<div id="app" class="stats-container">
<stats-dashboard
umami-username="{{config('umami.username')}}"
Expand Down

0 comments on commit 41c00c7

Please sign in to comment.