diff --git a/cmd/site/html.go b/cmd/site/html.go index 20be7de..036c854 100644 --- a/cmd/site/html.go +++ b/cmd/site/html.go @@ -73,10 +73,13 @@ func (s *Site) showPost(w http.ResponseWriter, r *http.Request) { s.renderTemplatePage("blogpost.html", p).ServeHTTP(w, r) 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")), Event: "Post Viewed", Properties: analytics.NewProperties().SetURL(r.RequestURI).SetTitle(p.Title), }) + if err != nil { + ln.Error(r.Context(), err) + } } } diff --git a/cmd/site/main.go b/cmd/site/main.go index 7dbe9bc..4da5aa0 100644 --- a/cmd/site/main.go +++ b/cmd/site/main.go @@ -59,11 +59,14 @@ func (s *Site) ServeHTTP(w http.ResponseWriter, r *http.Request) { if s.segment != nil { 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")), Event: "Page Viewed", Properties: analytics.NewProperties().SetURL(r.RequestURI), }) + if err != nil { + ln.Error(r.Context(), err) + } } } }