 (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 & opts]
+  [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 (#{:success :failed} status)
-          (release-button! uuid status))
-        (>! channel event)
-        (recur)))))
+             (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 ---
 

                 :unfollow-project
                 api-ch
                 :params {:vcs-type (:vcs_type repo)}
                 :context {:project-id project-id})
    (analytics/track {:event-type :project-unfollowed
                      :current-state current-state
                      :properties {:org org-name
                                   :repo repo-name}})))

(defmethod post-control-event! :stopped-building-project
  [target message {:keys [vcs-url project-id]} previous-state current-state]

                 :unfollow-repo
                 api-ch
                 :params {:vcs-type (:vcs_type repo)}
                 :context repo
                 :events {:success #(analytics/track {:event-type :project-unfollowed
                                                      :current-state current-state
                                                      :properties {:org org-name
                                                                   :repo repo-name}})})))


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