@@ -14,6 +14,11 @@ extension Analytics {
14
14
// and they need to write a middleware/enrichment now.
15
15
// the objc version should accomodate them if it's really needed.
16
16
17
+ /// Tracks an event performed by a user, including some additional event properties.
18
+ /// - Parameters:
19
+ /// - name: Name of the action, e.g., 'Purchased a T-Shirt'
20
+ /// - properties: Properties specific to the named event. For example, an event with
21
+ /// the name 'Purchased a Shirt' might have properties like revenue or size.
17
22
public func track< P: Codable > ( name: String , properties: P ? ) {
18
23
do {
19
24
if let properties = properties {
@@ -29,6 +34,9 @@ extension Analytics {
29
34
}
30
35
}
31
36
37
+ /// Tracks an event performed by a user.
38
+ /// - Parameters:
39
+ /// - name: Name of the action, e.g., 'Purchased a T-Shirt'
32
40
public func track( name: String ) {
33
41
track ( name: name, properties: nil as TrackEvent ? )
34
42
}
@@ -133,15 +141,12 @@ extension Analytics {
133
141
// MARK: - Untyped Event Signatures
134
142
135
143
extension Analytics {
136
- /// Associate a user with their unique ID and record traits about them .
144
+ /// Tracks an event performed by a user, including some additional event properties .
137
145
/// - Parameters:
138
- /// - userId: A database ID for this user. If you don't have a userId
139
- /// but want to record traits, just pass traits into the event and they will be associated
140
- /// with the anonymousId of that user. In the case when user logs out, make sure to
141
- /// call ``reset()`` to clear the user's identity info. For more information on how we
142
- /// generate the UUID and Apple's policies on IDs, see
143
- /// https://segment.io/libraries/ios#ids
144
- /// - properties: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
146
+ /// - name: Name of the action, e.g., 'Purchased a T-Shirt'
147
+ /// - properties: A dictionary or properties specific to the named event.
148
+ /// For example, an event with the name 'Purchased a Shirt' might have properties
149
+ /// like revenue or size.
145
150
public func track( name: String , properties: [ String : Any ] ? = nil ) {
146
151
var props : JSON ? = nil
147
152
if let properties = properties {
0 commit comments