mirror of
https://github.com/Kugelschieber/marvinblum.git
synced 2026-01-18 14:50:27 +00:00
Fixed paths overflowing table on tracking page and made links clickable.
This commit is contained in:
2
go.mod
2
go.mod
@@ -7,7 +7,7 @@ require (
|
|||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/emvi/api-go v0.2.2
|
github.com/emvi/api-go v0.2.2
|
||||||
github.com/emvi/logbuch v1.1.1
|
github.com/emvi/logbuch v1.1.1
|
||||||
github.com/emvi/pirsch v1.3.1
|
github.com/emvi/pirsch v1.3.2
|
||||||
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
||||||
github.com/gorilla/mux v1.7.4
|
github.com/gorilla/mux v1.7.4
|
||||||
github.com/gosimple/slug v1.9.0
|
github.com/gosimple/slug v1.9.0
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -13,6 +13,8 @@ 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.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 h1:K4+VonszJvZqtM7bQz8ZFZJJjQ8jlH/h6S/JiBpNQE8=
|
||||||
github.com/emvi/pirsch v1.3.1/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8=
|
github.com/emvi/pirsch v1.3.1/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8=
|
||||||
|
github.com/emvi/pirsch v1.3.2 h1:CZCLO2OaWpA/eDdlg8xFo9yZMB9S71iyox54AVVwadU=
|
||||||
|
github.com/emvi/pirsch v1.3.2/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.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 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
||||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
|
|||||||
4
main.go
4
main.go
@@ -156,7 +156,7 @@ func serveTracking() http.HandlerFunc {
|
|||||||
PageVisits []tracking.PageVisits
|
PageVisits []tracking.PageVisits
|
||||||
Pages []pirsch.VisitorPage
|
Pages []pirsch.VisitorPage
|
||||||
Languages []pirsch.VisitorLanguage
|
Languages []pirsch.VisitorLanguage
|
||||||
Referer []pirsch.VisitorReferer
|
Referrer []pirsch.VisitorReferrer
|
||||||
HourlyVisitorsLabels template.JS
|
HourlyVisitorsLabels template.JS
|
||||||
HourlyVisitorsDps template.JS
|
HourlyVisitorsDps template.JS
|
||||||
HourlyVisitorsTodayLabels template.JS
|
HourlyVisitorsTodayLabels template.JS
|
||||||
@@ -172,7 +172,7 @@ func serveTracking() http.HandlerFunc {
|
|||||||
tracking.GetPageVisits(startDate, endDate),
|
tracking.GetPageVisits(startDate, endDate),
|
||||||
tracking.GetPages(startDate, endDate),
|
tracking.GetPages(startDate, endDate),
|
||||||
tracking.GetLanguages(startDate, endDate),
|
tracking.GetLanguages(startDate, endDate),
|
||||||
tracking.GetReferer(startDate, endDate),
|
tracking.GetReferrer(startDate, endDate),
|
||||||
hourlyVisitorsLabels,
|
hourlyVisitorsLabels,
|
||||||
hourlyVisitorsDps,
|
hourlyVisitorsDps,
|
||||||
hourlyVisitorsTodayLabels,
|
hourlyVisitorsTodayLabels,
|
||||||
|
|||||||
@@ -88,6 +88,10 @@ body {
|
|||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.break-line-anywhere {
|
||||||
|
line-break: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,9 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{{range $data := .ActiveVisitorPages}}
|
{{range $data := .ActiveVisitorPages}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$data.Path}}</td>
|
<td class="break-line-anywhere">
|
||||||
|
<a href="{{$data.Path}}" target="_blank">{{$data.Path}}</a>
|
||||||
|
</td>
|
||||||
<td>{{$data.Visitors}}</td>
|
<td>{{$data.Visitors}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
@@ -74,7 +76,9 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{{range $data := .Pages}}
|
{{range $data := .Pages}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$data.Path}}</td>
|
<td class="break-line-anywhere">
|
||||||
|
<a href="{{$data.Path}}" target="_blank">{{$data.Path}}</a>
|
||||||
|
</td>
|
||||||
<td>{{$data.Visitors}}</td>
|
<td>{{$data.Visitors}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
@@ -106,21 +110,27 @@
|
|||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<h2>Referer</h2>
|
<h2>Referrer</h2>
|
||||||
<p>
|
<p>
|
||||||
Here are the top 10 referer.
|
Here are the top 10 referrer.
|
||||||
</p>
|
</p>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Referer</th>
|
<th>Referrer</th>
|
||||||
<th>Visitors</th>
|
<th>Visitors</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{range $data := .Referer}}
|
{{range $data := .Referrer}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{if $data.Referer}}{{$data.Referer}}{{else}}(unknown){{end}}</td>
|
<td class="break-line-anywhere">
|
||||||
|
{{if $data.Referrer}}
|
||||||
|
<a href="{{$data.Referrer}}" target="_blank">{{$data.Referrer}}</a>
|
||||||
|
{{else}}
|
||||||
|
(unknown)
|
||||||
|
{{end}}
|
||||||
|
</td>
|
||||||
<td>{{$data.Visitors}}</td>
|
<td>{{$data.Visitors}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
@@ -78,19 +78,19 @@ func GetLanguages(startDate, endDate time.Time) []pirsch.VisitorLanguage {
|
|||||||
return languages
|
return languages
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetReferer(startDate, endDate time.Time) []pirsch.VisitorReferer {
|
func GetReferrer(startDate, endDate time.Time) []pirsch.VisitorReferrer {
|
||||||
referer, err := analyzer.Referer(&pirsch.Filter{From: startDate, To: endDate})
|
referrer, err := analyzer.Referrer(&pirsch.Filter{From: startDate, To: endDate})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logbuch.Error("Error reading referer statistics", logbuch.Fields{"err": err})
|
logbuch.Error("Error reading referrer statistics", logbuch.Fields{"err": err})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(referer) > 10 {
|
if len(referrer) > 10 {
|
||||||
return referer[:10]
|
return referrer[:10]
|
||||||
}
|
}
|
||||||
|
|
||||||
return referer
|
return referrer
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetHourlyVisitors(startDate, endDate time.Time) (template.JS, template.JS) {
|
func GetHourlyVisitors(startDate, endDate time.Time) (template.JS, template.JS) {
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ func NewTracker() (*pirsch.Tracker, context.CancelFunc) {
|
|||||||
store = pirsch.NewPostgresStore(conn)
|
store = pirsch.NewPostgresStore(conn)
|
||||||
tracker := pirsch.NewTracker(store, os.Getenv("MB_TRACKING_SALT"), &pirsch.TrackerConfig{
|
tracker := pirsch.NewTracker(store, os.Getenv("MB_TRACKING_SALT"), &pirsch.TrackerConfig{
|
||||||
// I don't care about traffic from my own website
|
// I don't care about traffic from my own website
|
||||||
RefererDomainBlacklist: []string{domain},
|
ReferrerDomainBlacklist: []string{domain},
|
||||||
RefererDomainBlacklistIncludesSubdomains: true,
|
ReferrerDomainBlacklistIncludesSubdomains: true,
|
||||||
})
|
})
|
||||||
analyzer = pirsch.NewAnalyzer(store)
|
analyzer = pirsch.NewAnalyzer(store)
|
||||||
processor := pirsch.NewProcessor(store, nil)
|
processor := pirsch.NewProcessor(store, nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user