Fix DNT logic

This commit is contained in:
Jeremy Dormitzer 2018-02-01 00:41:20 -07:00
parent 4c57c37c00
commit 242d991b0c
No known key found for this signature in database
GPG Key ID: 04F17C0F5A32C320

View File

@ -17,7 +17,7 @@
(defn init-amplitude (defn init-amplitude
"Injects the Amplitude bootstrapping script if DNT is disabled" "Injects the Amplitude bootstrapping script if DNT is disabled"
[] []
(when (not (do-not-track)) (when-not (do-not-track)
(dom/appendChild (.-body (dom/getDocument)) (dom/appendChild (.-body (dom/getDocument))
(dom/createDom "script" nil amplitude-init-code)) (dom/createDom "script" nil amplitude-init-code))
(go (let [user-id (-> js/browser (go (let [user-id (-> js/browser
@ -31,7 +31,7 @@
"Logs an event to Amplitude. Returns a channel that resolves with the response from Amplitude" "Logs an event to Amplitude. Returns a channel that resolves with the response from Amplitude"
([event-name properties] ([event-name properties]
(let [res-channel (chan)] (let [res-channel (chan)]
(when (not (nil? js/amplitude)) (when (and (not (do-not-track)) (exists? js/amplitude))
(.logEvent (.getInstance js/amplitude) (.logEvent (.getInstance js/amplitude)
event-name event-name
(clj->js properties) (clj->js properties)