logging i guess
This commit is contained in:
parent
6b7d6dcc49
commit
66902783a1
|
@ -73,10 +73,13 @@ func (s *Site) showPost(w http.ResponseWriter, r *http.Request) {
|
||||||
s.renderTemplatePage("blogpost.html", p).ServeHTTP(w, r)
|
s.renderTemplatePage("blogpost.html", p).ServeHTTP(w, r)
|
||||||
|
|
||||||
if s.segment != nil {
|
if s.segment != nil {
|
||||||
s.segment.Enqueue(&analytics.Track{
|
err := s.segment.Enqueue(&analytics.Track{
|
||||||
UserId: Hash(r.RemoteAddr, r.Header.Get("X-Forwarded-For")),
|
UserId: Hash(r.RemoteAddr, r.Header.Get("X-Forwarded-For")),
|
||||||
Event: "Post Viewed",
|
Event: "Post Viewed",
|
||||||
Properties: analytics.NewProperties().SetURL(r.RequestURI).SetTitle(p.Title),
|
Properties: analytics.NewProperties().SetURL(r.RequestURI).SetTitle(p.Title),
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
ln.Error(r.Context(), err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,11 +59,14 @@ func (s *Site) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
if s.segment != nil {
|
if s.segment != nil {
|
||||||
if !strings.HasPrefix(r.RequestURI, "/blog/") {
|
if !strings.HasPrefix(r.RequestURI, "/blog/") {
|
||||||
s.segment.Enqueue(&analytics.Track{
|
err := s.segment.Enqueue(&analytics.Track{
|
||||||
UserId: Hash(r.RemoteAddr, r.Header.Get("X-Forwarded-For")),
|
UserId: Hash(r.RemoteAddr, r.Header.Get("X-Forwarded-For")),
|
||||||
Event: "Page Viewed",
|
Event: "Page Viewed",
|
||||||
Properties: analytics.NewProperties().SetURL(r.RequestURI),
|
Properties: analytics.NewProperties().SetURL(r.RequestURI),
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
ln.Error(r.Context(), err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue