Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions Sources/Segment/Events.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ extension Analytics {

/// Associate a user with their unique ID and record traits about them.
/// - Parameters:
/// - userId: A database ID (or email address) for this user. If you don't have a userId
/// but want to record traits, you should pass nil. For more information on how we
/// generate the UUID and Apple's policies on IDs, see https://segment.io/libraries/ios#ids
/// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
/// - userId: A database ID for this user. If you don't have a userId
/// but want to record traits, just pass traits into the event and they will be associated
/// with the anonymousId of that user. For more information on how we
/// generate the UUID and Apple's policies on IDs, see
/// https://segment.io/libraries/ios#ids
/// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
public func identify<T: Codable>(userId: String, traits: T?) {
do {
if let traits = traits {
Expand Down Expand Up @@ -72,7 +74,7 @@ extension Analytics {

/// Associate a user with their unique ID and record traits about them.
/// - Parameters:
/// - userId: A database ID (or email address) for this user.
/// - userId: A database ID for this user.
/// For more information on how we generate the UUID and Apple's policies on IDs, see
/// https://segment.io/libraries/ios#ids
/// In the case when user logs out, make sure to call ``reset()`` to clear user's identity info.
Expand Down Expand Up @@ -132,9 +134,11 @@ extension Analytics {
extension Analytics {
/// Associate a user with their unique ID and record traits about them.
/// - Parameters:
/// - userId: A database ID (or email address) for this user. If you don't have a userId
/// but want to record traits, you should pass nil. For more information on how we
/// generate the UUID and Apple's policies on IDs, see https://segment.io/libraries/ios#ids
/// - userId: A database ID for this user. If you don't have a userId
/// but want to record traits, just pass traits into the event and they will be associated
/// with the anonymousId of that user. For more information on how we
/// generate the UUID and Apple's policies on IDs, see
/// https://segment.io/libraries/ios#ids
/// - properties: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
public func track(name: String, properties: [String: Any]? = nil) {
var props: JSON? = nil
Expand All @@ -151,9 +155,11 @@ extension Analytics {

/// Associate a user with their unique ID and record traits about them.
/// - Parameters:
/// - userId: A database ID (or email address) for this user.
/// For more information on how we generate the UUID and Apple's policies on IDs, see
/// https://segment.io/libraries/ios#ids
/// - userId: A database ID for this user. If you don't have a userId
/// but want to record traits, just pass traits into the event and they will be associated
/// with the anonymousId of that user. For more information on how we
/// generate the UUID and Apple's policies on IDs, see
/// https://segment.io/libraries/ios#ids
/// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
/// In the case when user logs out, make sure to call ``reset()`` to clear user's identity info.
public func identify(userId: String, traits: [String: Any]? = nil) {
Expand Down