Updated pirsch and added country statistics to tracking page.

This commit is contained in:
Marvin Blum
2020-09-20 13:38:43 +02:00
committed by Marvin Blum
parent 388997a678
commit b6e14ed1aa
9 changed files with 104 additions and 3 deletions

View File

@@ -138,6 +138,21 @@ func GetBrowser(startDate, endDate time.Time) []pirsch.BrowserStats {
return browser
}
func GetCountry(startDate, endDate time.Time) []pirsch.CountryStats {
countries, err := analyzer.Country(&pirsch.Filter{From: startDate, To: endDate})
if err != nil {
logbuch.Error("Error reading country statistics", logbuch.Fields{"err": err})
return nil
}
for i := range countries {
countries[i].CountryCode.String = strings.ToUpper(countries[i].CountryCode.String)
}
return countries
}
func GetPlatform(startDate, endDate time.Time) *pirsch.VisitorStats {
return analyzer.Platform(&pirsch.Filter{From: startDate, To: endDate})
}