       type: "POST"
       event: event
       success: (data) =>
-        (new CI.inner.Build(data)).visit()
+        build = new CI.inner.Build(data)
+        build.visit()
+        @trackRetryBuild build, false, true
     false
 
   cancel_build: (data, event) =>

      type: "DELETE"
      event: event
      success: (data) =>
        @retry_build data, event
    false

  ssh_build: (data, event) =>

    existing = (message.message for message in @messages())
    (@messages.push(msg) if msg.message not in existing) for msg in json

  trackRetryBuild: (build, clearCache, SSH) =>
    mixpanel.track("Trigger Build",
      "vcs-url": build.project_name()
      "build-num": build.build_num
      "retry?": true
      "clear-cache?": clearCache
      "ssh?": SSH)

  # TODO: CSRF protection
  retry_build: (data, event, clearCache) =>
    $.ajax
      url: "/api/v1/project/#{@project_name()}/#{@build_num}/retry"
      type: "POST"
      event: event
      success: (data) =>
        console.log("retry build data", data)
        console.log("retry event", event)
        build = new CI.inner.Build(data)
        build.visit()
        @trackRetryBuild build, clearCache, false
    false

  clear_cache_and_retry_build: (data, event) =>
