diff --git a/src/looped_in/background.cljs b/src/looped_in/background.cljs index f5bd7ca..6817df3 100644 --- a/src/looped_in/background.cljs +++ b/src/looped_in/background.cljs @@ -3,6 +3,7 @@ [ajax.core :refer [GET]] [goog.string :as gstring] [looped-in.hackernews :as hn] + [looped-in.analytics :as analytics] [looped-in.logging :as log] [looped-in.promises :refer [channel->promise promise->channel]])) @@ -85,7 +86,8 @@ "hits" (channel->promise (go @hits)) "fetchItem" (channel->promise (go (clj->js (promise (get-user-id)))) + "getUserId" (channel->promise (get-user-id)) + "logEvent" (analytics/log-event (.-eventType msg) (.-eventProperties msg)))) (-> js/browser (.-tabs) @@ -107,3 +109,4 @@ (.-onMessage) (.addListener handle-message)) +(analytics/init-amplitude) diff --git a/src/looped_in/content.cljs b/src/looped_in/content.cljs index d5bb649..4c4079a 100644 --- a/src/looped_in/content.cljs +++ b/src/looped_in/content.cljs @@ -35,7 +35,8 @@ (defn close-sidebar [] (let [$html (.-documentElement js/document) $sidebar (dom/getElement "loopedInSidebar")] - (analytics/log-event "CLOSED_SIDEBAR") + (-> js/browser (.-runtime) (.sendMessage (clj->js {:type "logEvent" + :eventType "CLOSED_SIDEBAR"}))) (dom/removeNode $sidebar) (set! (-> $html (.-style) (.-paddingLeft)) @old-html-padding)))