summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorraylu <raylu@mixpanel.com>2011-08-10 03:02:23 -0700
committerraylu <raylu@mixpanel.com>2011-08-10 03:02:23 -0700
commitd1bfe384e796cf2db9a057271b78666b310d0184 (patch)
tree0bc69ca17fa7bf63d4b491e31aa191c2b5021537 /main.go
parent5a4a473b7a5538be87837ea760205ede90a8482e (diff)
downloadaudioaxis-d1bfe384e796cf2db9a057271b78666b310d0184.tar.xz
add mixpanel tracking
Diffstat (limited to 'main.go')
-rw-r--r--main.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/main.go b/main.go
index 099767c..7185672 100644
--- a/main.go
+++ b/main.go
@@ -62,6 +62,7 @@ func renderPage(w http.ResponseWriter, page string, data interface{}) {
func home(w http.ResponseWriter, r *http.Request) {
renderPage(w, "home", nil)
+ go track("home", r.Header.Get("X-Forwarded-For"), "", "", "")
}
func playlist(w http.ResponseWriter, r *http.Request) {
@@ -81,6 +82,7 @@ func playlist(w http.ResponseWriter, r *http.Request) {
p := Playlist{Id: id}
renderPage(w, "p", p)
+ go track("p", r.Header.Get("X-Forwarded-For"), id, "", "")
}
func add(w http.ResponseWriter, r *http.Request) {
@@ -124,6 +126,7 @@ func add(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("1"))
addUpdate(pid, addAction,
&Song{Yid: q.Get("yid"), Title: q.Get("title"), User: q.Get("user")})
+ go track("add", r.Header.Get("X-Forwarded-For"), q.Get("pid"), q.Get("title"), q.Get("user"))
}
func remove(w http.ResponseWriter, r *http.Request) {
@@ -176,6 +179,7 @@ func remove(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("1"))
addUpdate(pid, removeAction, &Song{Yid: q.Get("yid")})
+ go track("remove", r.Header.Get("X-Forwarded-For"), q.Get("pid"), "", "")
}
func move(w http.ResponseWriter, r *http.Request) {
@@ -335,4 +339,5 @@ func create(w http.ResponseWriter, r *http.Request) {
return
}
http.Redirect(w, r, "/p/" + idStr, http.StatusSeeOther)
+ go track("create",r.Header.Get("X-Forwarded-For"), idStr, "", "")
}