                  :unfollow-repo
                  api-ch
                  :params {:vcs-type (:vcs_type repo)}
-                 :context repo)
-    (analytics/track {:event-type :project-unfollowed
-                      :current-state current-state
-                      :properties {:org org-name
-                                   :repo repo-name}})))
+                 :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

  [_ _ {:keys [login scope]} _ {{api-ch :api} :comms}]
  (api/set-user-admin-scope login scope api-ch))

(defmethod control-event :system-setting-changed
  [_ _ {:keys [name]} state]
  (update-in state state/system-settings-path
             (fn [settings]
               (mapv #(if (= name (:name %))
                        (assoc % :updating true)
                        %)
                     settings))))

(defmethod post-control-event! :system-setting-changed
  [_ _ {:keys [name value]} _ {{api-ch :api} :comms}]
  (api/set-system-setting name value api-ch))

(defmethod control-event :insights-sorting-changed
  [_ _ {:keys [new-sorting]} state]
  (assoc-in state state/insights-sorting-path new-sorting))

(defmethod post-control-event! :removed-heroku-deploy-user
  [target message {:keys [project-id]} previous-state current-state]
  (let [project-name (vcs-url/project-name project-id)
        api-ch (get-in current-state [:comms :api])]
    (button-ajax :delete
                 (gstring/format "/api/v1/project/%s/heroku-deploy-user" project-name)
                 :remove-heroku-deploy-user
                 api-ch
                 :context {:project-id project-id})))
