mirror of
https://github.com/Kugelschieber/marvinblum.git
synced 2026-01-18 06:40:27 +00:00
Fixed bounce/session statistics and updated pirsch to dev version.
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.5.2
|
github.com/emvi/pirsch v1.5.3-0.20200914194223-a990d20e91a2
|
||||||
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
||||||
github.com/golang-migrate/migrate v3.5.4+incompatible
|
github.com/golang-migrate/migrate v3.5.4+incompatible
|
||||||
github.com/golang-migrate/migrate/v4 v4.12.2
|
github.com/golang-migrate/migrate/v4 v4.12.2
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -102,6 +102,8 @@ github.com/emvi/pirsch v1.5.1 h1:HFlR5Ps2mPFqHGkFvEfHLme6beCn5aIpu/fCNz/B43Y=
|
|||||||
github.com/emvi/pirsch v1.5.1/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8=
|
github.com/emvi/pirsch v1.5.1/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8=
|
||||||
github.com/emvi/pirsch v1.5.2 h1:fKGTOngDbVFhbzhbXy2NbaeZrVYSiIoDVy+dce0agFs=
|
github.com/emvi/pirsch v1.5.2 h1:fKGTOngDbVFhbzhbXy2NbaeZrVYSiIoDVy+dce0agFs=
|
||||||
github.com/emvi/pirsch v1.5.2/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8=
|
github.com/emvi/pirsch v1.5.2/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8=
|
||||||
|
github.com/emvi/pirsch v1.5.3-0.20200914194223-a990d20e91a2 h1:HoKxeUtA0E4QVuw2kaR4TioT2OZPIzXQ2rA6EJ3GRTM=
|
||||||
|
github.com/emvi/pirsch v1.5.3-0.20200914194223-a990d20e91a2/go.mod h1:GDijqLHM331iWtmDmc7th19RxDrZadRkKoNvd9/kDX8=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||||
|
|||||||
23
schema/0002_pirsch_update.up.sql
Normal file
23
schema/0002_pirsch_update.up.sql
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
ALTER TABLE "hit" ADD COLUMN "screen_width" integer DEFAULT 0;
|
||||||
|
ALTER TABLE "hit" ADD COLUMN "screen_height" integer DEFAULT 0;
|
||||||
|
|
||||||
|
CREATE TABLE "screen_stats" (
|
||||||
|
id bigint NOT NULL UNIQUE,
|
||||||
|
tenant_id bigint,
|
||||||
|
day date NOT NULL,
|
||||||
|
visitors integer NOT NULL,
|
||||||
|
width integer NOT NULL,
|
||||||
|
height integer NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE SEQUENCE screen_stats_id_seq
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
ALTER SEQUENCE screen_stats_id_seq OWNED BY "screen_stats".id;
|
||||||
|
ALTER TABLE ONLY "screen_stats" ALTER COLUMN id SET DEFAULT nextval('screen_stats_id_seq'::regclass);
|
||||||
|
ALTER TABLE ONLY "screen_stats" ADD CONSTRAINT screen_stats_pkey PRIMARY KEY (id);
|
||||||
|
CREATE INDEX screen_stats_day_index ON screen_stats(day);
|
||||||
@@ -237,19 +237,19 @@
|
|||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
backgroundColor: "rgb(43, 180, 0, 0.02)",
|
backgroundColor: "rgb(43, 180, 0, 0.02)",
|
||||||
borderColor: "#289800",
|
borderColor: "rgb(40, 152, 0, 0.5)",
|
||||||
label: "Total Visitors",
|
label: "Total Visitors",
|
||||||
data: [{{.TotalVisitorsDps}}]
|
data: [{{.TotalVisitorsDps}}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
backgroundColor: "rgb(0, 63, 197, 0.02)",
|
backgroundColor: "rgb(0, 63, 197, 0.02)",
|
||||||
borderColor: "#00359f",
|
borderColor: "rgb(0, 53, 159, 0.5)",
|
||||||
label: "Sessions",
|
label: "Sessions",
|
||||||
data: [{{.SessionsDps}}]
|
data: [{{.SessionsDps}}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
backgroundColor: "rgba(194, 0, 0, 0.02)",
|
backgroundColor: "rgba(194, 0, 0, 0.02)",
|
||||||
borderColor: "#980000",
|
borderColor: "rgb(152, 0, 0, 0.5)",
|
||||||
label: "Bounces",
|
label: "Bounces",
|
||||||
data: [{{.BouncesDps}}]
|
data: [{{.BouncesDps}}]
|
||||||
}
|
}
|
||||||
@@ -280,19 +280,19 @@
|
|||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
backgroundColor: "rgb(43, 180, 0, 0.02)",
|
backgroundColor: "rgb(43, 180, 0, 0.02)",
|
||||||
borderColor: "#289800",
|
borderColor: "rgb(40, 152, 0, 0.5)",
|
||||||
label: "Page Visits",
|
label: "Page Visits",
|
||||||
data: [{{$data.Data}}]
|
data: [{{$data.Data}}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
backgroundColor: "rgb(0, 63, 197, 0.02)",
|
backgroundColor: "rgb(0, 63, 197, 0.02)",
|
||||||
borderColor: "#00359f",
|
borderColor: "rgb(0, 53, 159, 0.5)",
|
||||||
label: "Sessions",
|
label: "Sessions",
|
||||||
data: [{{$data.Sessions}}]
|
data: [{{$data.Sessions}}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
backgroundColor: "rgba(194, 0, 0, 0.02)",
|
backgroundColor: "rgba(194, 0, 0, 0.02)",
|
||||||
borderColor: "#980000",
|
borderColor: "rgb(152, 0, 0, 0.5)",
|
||||||
label: "Bounces",
|
label: "Bounces",
|
||||||
data: [{{$data.Bounces}}]
|
data: [{{$data.Bounces}}]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,11 +168,11 @@ func getLabelsAndData(visitors []pirsch.Stats) (template.JS, template.JS, templa
|
|||||||
labelsStr := labels.String()
|
labelsStr := labels.String()
|
||||||
dataStr := dp.String()
|
dataStr := dp.String()
|
||||||
sessionsStr := sessions.String()
|
sessionsStr := sessions.String()
|
||||||
bouncesStr := sessions.String()
|
bouncesStr := bounces.String()
|
||||||
return template.JS(labelsStr[:len(labelsStr)-1]),
|
return template.JS(labelsStr[:len(labelsStr)-1]),
|
||||||
template.JS(dataStr[:len(dataStr)-1]),
|
template.JS(dataStr[:len(dataStr)-1]),
|
||||||
template.JS(sessionsStr[:len(sessionsStr)-1]),
|
template.JS(sessionsStr[:len(sessionsStr)-1]),
|
||||||
template.JS(bouncesStr[:len(sessionsStr)-1])
|
template.JS(bouncesStr[:len(bouncesStr)-1])
|
||||||
}
|
}
|
||||||
|
|
||||||
func getLabelsAndDataHourly(visitors []pirsch.VisitorTimeStats) (template.JS, template.JS) {
|
func getLabelsAndDataHourly(visitors []pirsch.VisitorTimeStats) (template.JS, template.JS) {
|
||||||
|
|||||||
Reference in New Issue
Block a user