                  (gstring/format "/api/v1/project/%s/enable" project)
                  :stop-building-project
                  api-ch
-                 :context {:project-id project-id})
-    (analytics/track {:event-type :project-builds-stopped
-                      :current-state current-state
-                      :properties {:org org-name
-                                   :repo repo-name}})))
+                 :context {:project-id project-id}
+                 :events {:success #(analytics/track {:event-type :project-builds-stopped
+                                                      :current-state current-state
+                                                      :properties {:org org-name
+                                                                   :repo repo-name}})})))
 
 ;; XXX: clean this up
 (defmethod post-control-event! :container-parent-scroll

                 (gstring/format "/api/v1/project/%s/follow" project)
                 :follow-project
                 api-ch
                 :context {:project-id project-id})
    (analytics/track {:event-type :project-followed
                      :current-state current-state
                      :properties {:org org-name
                                   :repo repo-name}})))


(defmethod post-control-event! :unfollowed-repo

(defn button-ajax
  "An ajax/ajax wrapper that releases the current managed-button after the API
  request.  Exists to faciliate migration away from stateful-button."
  [method url message channel & {:keys [context params events] :as opts}]
  (let [uuid frontend.async/*uuid*
        c (chan)]
    (apply ajax/ajax method url message c opts)
    (go-loop []
             (when-let [[_ status _ :as event] (<! c)]
               (when-let [tracking-event (-> opts :events status)]
                 (tracking-event))
               (when (#{:success :failed} status)
                 (release-button! uuid status))
               (>! channel event)
               (recur)))))

;; --- Navigation Multimethod Declarations ---

