diff --git a/go.mod b/go.mod index bc978a0..7ef5766 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/emvi/api-go v0.2.2 github.com/emvi/logbuch v1.1.1 - github.com/emvi/pirsch v1.3.0 + github.com/emvi/pirsch v1.3.1 github.com/go-sql-driver/mysql v1.5.0 // indirect github.com/gorilla/mux v1.7.4 github.com/gosimple/slug v1.9.0 diff --git a/go.sum b/go.sum index 7f4b392..c191aeb 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,8 @@ github.com/emvi/pirsch v1.2.0 h1:k5OJwgE8/Zdq7raQNRF4aNHxWxPq7En51gWMMEFzinA= github.com/emvi/pirsch v1.2.0/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8= github.com/emvi/pirsch v1.3.0 h1:csgIvQKMMWF9EG4Dkfd4dFux6kfzOFC8PuNPWvsj7zM= github.com/emvi/pirsch v1.3.0/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8= +github.com/emvi/pirsch v1.3.1 h1:K4+VonszJvZqtM7bQz8ZFZJJjQ8jlH/h6S/JiBpNQE8= +github.com/emvi/pirsch v1.3.1/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= diff --git a/main.go b/main.go index e299457..f6790f7 100644 --- a/main.go +++ b/main.go @@ -154,12 +154,15 @@ func serveTracking() http.HandlerFunc { TotalVisitorsLabels template.JS TotalVisitorsDps template.JS PageVisits []tracking.PageVisits + Pages []pirsch.VisitorPage Languages []pirsch.VisitorLanguage + Referer []pirsch.VisitorReferer HourlyVisitorsLabels template.JS HourlyVisitorsDps template.JS HourlyVisitorsTodayLabels template.JS HourlyVisitorsTodayDps template.JS ActiveVisitors int + ActiveVisitorPages []pirsch.PageVisitors }{ start, startDate, @@ -167,12 +170,15 @@ func serveTracking() http.HandlerFunc { totalVisitorsLabels, totalVisitorsDps, tracking.GetPageVisits(startDate, endDate), + tracking.GetPages(startDate, endDate), tracking.GetLanguages(startDate, endDate), + tracking.GetReferer(startDate, endDate), hourlyVisitorsLabels, hourlyVisitorsDps, hourlyVisitorsTodayLabels, hourlyVisitorsTodayDps, tracking.GetActiveVisitors(), + tracking.GetActiveVisitorPages(), }) } } diff --git a/template/tracking.html b/template/tracking.html index 7a2756e..c9a7d0f 100644 --- a/template/tracking.html +++ b/template/tracking.html @@ -28,6 +28,25 @@ The next diagram shows active visitors for each hour of today.
++ The next table shows where the active visitors are for the past 30 seconds. Visitors switching between pages fast do create duplicate entries in the table. +
+| Path | +Visitors | +
|---|---|
| {{$data.Path}} | +{{$data.Visitors}} | +
+ Here are the top 10 visited pages. +
+| Path | +Visitors | +
|---|---|
| {{$data.Path}} | +{{$data.Visitors}} | +
@@ -47,20 +88,42 @@
| Language | -Absolute | -Relative | -
|---|---|---|
| Language | +Absolute | +Relative | +
| {{if $data.Language}}{{$data.Language}}{{else}}(not set){{end}} | +{{$data.Visitors}} | +{{round (multiply $data.RelativeVisitors 100)}} % | +
+ Here are the top 10 referer. +
+| {{if $data.Language}}{{$data.Language}}{{else}}(not set){{end}} | -{{$data.Visitors}} | -{{round (multiply $data.RelativeVisitors 100)}} % | +Referer | +Visitors |
|---|---|---|---|---|
| {{if $data.Referer}}{{$data.Referer}}{{else}}(unknown){{end}} | +{{$data.Visitors}} | +