diff options
| author | Christine Dodrill <me@christine.website> | 2018-12-01 10:20:44 -0800 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2018-12-01 10:23:20 -0800 |
| commit | 5f61cf92eeabc6ba95072f35460e689954d8f2e3 (patch) | |
| tree | 7339b5d0f828b363bf21848c506f549e04a4d0d1 /cmd | |
| parent | 80f5b1c1d6823ec5f33e9672efa4f820a5be5de6 (diff) | |
| download | xesite-5f61cf92eeabc6ba95072f35460e689954d8f2e3.tar.xz xesite-5f61cf92eeabc6ba95072f35460e689954d8f2e3.zip | |
cmd/site: back out segment experiment, it's not worth it
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/site/html.go | 12 | ||||
| -rw-r--r-- | cmd/site/main.go | 20 |
2 files changed, 0 insertions, 32 deletions
diff --git a/cmd/site/html.go b/cmd/site/html.go index f42b947..ba304c5 100644 --- a/cmd/site/html.go +++ b/cmd/site/html.go @@ -8,7 +8,6 @@ import ( "time" "github.com/Xe/ln" - analytics "gopkg.in/segmentio/analytics-go.v3" ) func logTemplateTime(name string, from time.Time) { @@ -71,15 +70,4 @@ func (s *Site) showPost(w http.ResponseWriter, r *http.Request) { } s.renderTemplatePage("blogpost.html", p).ServeHTTP(w, r) - - if s.segment != nil { - err := s.segment.Enqueue(analytics.Track{ - UserId: Hash("h", 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 e9b4d21..fa4b9b8 100644 --- a/cmd/site/main.go +++ b/cmd/site/main.go @@ -17,7 +17,6 @@ import ( "github.com/gorilla/feeds" blackfriday "github.com/russross/blackfriday" "github.com/tj/front" - analytics "gopkg.in/segmentio/analytics-go.v3" ) var port = os.Getenv("PORT") @@ -48,27 +47,12 @@ type Site struct { templates map[string]*template.Template tlock sync.RWMutex - - segment analytics.Client } func (s *Site) ServeHTTP(w http.ResponseWriter, r *http.Request) { ln.Log(r.Context(), ln.F{"action": "Site.ServeHTTP", "user_ip_address": r.RemoteAddr, "path": r.RequestURI}) s.mux.ServeHTTP(w, r) - - if s.segment != nil { - if !strings.HasPrefix(r.RequestURI, "/blog/") { - err := s.segment.Enqueue(analytics.Track{ - UserId: Hash("h", r.Header.Get("X-Forwarded-For")), - Event: "Page Viewed", - Properties: analytics.NewProperties().SetURL(r.RequestURI), - }) - if err != nil { - ln.Error(r.Context(), err) - } - } - } } // Build creates a new Site instance or fails. @@ -105,10 +89,6 @@ func Build() (*Site, error) { templates: map[string]*template.Template{}, } - if wk := os.Getenv("SEGMENT_WRITE_KEY"); wk != "" { - s.segment = analytics.New(wk) - } - err := filepath.Walk("./blog/", func(path string, info os.FileInfo, err error) error { if err != nil { return err |
