|
1 | 1 | (ns circleci.analytics-clj.core
|
2 | 2 | (:refer-clojure :exclude [alias flush])
|
3 | 3 | (:require [circleci.analytics-clj.common :as common]
|
4 |
| - [circleci.analytics-clj.external :refer :all] |
| 4 | + [circleci.analytics-clj.external :as external] |
5 | 5 | [circleci.analytics-clj.utils :refer [string-keys]])
|
6 | 6 | (:import (com.segment.analytics Analytics)
|
7 | 7 | (com.segment.analytics.messages AliasMessage
|
|
22 | 22 | ([write-key {:keys [client log endpoint user-agent network-executor callback]}]
|
23 | 23 | (.build (doto (Analytics/builder write-key)
|
24 | 24 | (cond-> (not (nil? client))
|
25 |
| - (client* client)) |
| 25 | + (external/client* client)) |
26 | 26 |
|
27 | 27 | (cond-> (not (nil? log))
|
28 |
| - (log* log)) |
| 28 | + (external/log* log)) |
29 | 29 |
|
30 | 30 | (cond-> (not (nil? endpoint))
|
31 |
| - (endpoint* endpoint)) |
| 31 | + (external/endpoint* endpoint)) |
32 | 32 |
|
33 | 33 | (cond-> (not (nil? user-agent))
|
34 |
| - (user-agent* user-agent)) |
| 34 | + (external/user-agent* user-agent)) |
35 | 35 |
|
36 | 36 | (cond-> (not (nil? network-executor))
|
37 |
| - (network-executor* network-executor)) |
| 37 | + (external/network-executor* network-executor)) |
38 | 38 |
|
39 | 39 | (cond-> (not (nil? callback))
|
40 |
| - (callback* callback)))))) |
| 40 | + (external/callback* callback)))))) |
41 | 41 |
|
42 | 42 | (defn enqueue
|
43 | 43 | "Top-level `enqueue` function to allow for extensibility in the future."
|
|
73 | 73 | ([^Analytics analytics user-id traits options]
|
74 | 74 | (enqueue analytics (doto (IdentifyMessage/builder)
|
75 | 75 | (common/common-fields (merge {:user-id user-id} options))
|
76 |
| - (cond-> (not (nil? traits)) (traits* (string-keys traits))))))) |
| 76 | + (cond-> (not (nil? traits)) (external/traits* (string-keys traits))))))) |
77 | 77 |
|
78 | 78 | (defn track
|
79 | 79 | "`track` lets you record the actions your users perform.
|
|
91 | 91 | ([^Analytics analytics user-id event properties options]
|
92 | 92 | (enqueue analytics (doto (TrackMessage/builder event)
|
93 | 93 | (common/common-fields (merge {:user-id user-id} options))
|
94 |
| - (cond-> (not (nil? properties)) (properties* (string-keys properties))))))) |
| 94 | + (cond-> (not (nil? properties)) (external/properties* (string-keys properties))))))) |
95 | 95 |
|
96 | 96 | (defn screen
|
97 | 97 | "The `screen` method lets you you record whenever a user
|
|
109 | 109 | ([^Analytics analytics user-id name properties options]
|
110 | 110 | (enqueue analytics (doto (ScreenMessage/builder name)
|
111 | 111 | (common/common-fields (merge {:user-id user-id} options))
|
112 |
| - (cond-> (not (nil? properties)) (properties* (string-keys properties))))))) |
| 112 | + (cond-> (not (nil? properties)) (external/properties* (string-keys properties))))))) |
113 | 113 |
|
114 | 114 | (defn page
|
115 | 115 | "The `page` method lets you record whenever a user
|
|
127 | 127 | ([^Analytics analytics user-id name properties options]
|
128 | 128 | (enqueue analytics (doto (PageMessage/builder name)
|
129 | 129 | (common/common-fields (merge {:user-id user-id} options))
|
130 |
| - (cond-> (not (nil? properties)) (properties* (string-keys properties))))))) |
| 130 | + (cond-> (not (nil? properties)) (external/properties* (string-keys properties))))))) |
131 | 131 |
|
132 | 132 | (defn group
|
133 | 133 | "`group` lets you associate an identified user with
|
|
146 | 146 | ([^Analytics analytics user-id group-id traits options]
|
147 | 147 | (enqueue analytics (doto (GroupMessage/builder group-id)
|
148 | 148 | (common/common-fields (merge {:user-id user-id} options))
|
149 |
| - (cond-> (not (nil? traits)) (traits* (string-keys traits))))))) |
| 149 | + (cond-> (not (nil? traits)) (external/traits* (string-keys traits))))))) |
150 | 150 |
|
151 | 151 | (defn alias
|
152 | 152 | "`alias` is how you associate one identity with another.
|
|
0 commit comments