Identify tracks the user with the provided properties
(ctx context.Context)
| 217 | |
| 218 | // Identify tracks the user with the provided properties |
| 219 | func (a *AnalyticsTelemetryClient) Identify(ctx context.Context) error { |
| 220 | metadata := GetEventMetadata(ctx) |
| 221 | |
| 222 | var isCI int8 |
| 223 | if utils.IsCI() { |
| 224 | isCI = 1 |
| 225 | } |
| 226 | |
| 227 | traits := analytics.Traits{ |
| 228 | "configured_applications": metadata.ConfiguredApplicationsNb, |
| 229 | "version": metadata.CLIVersion, |
| 230 | "operating_system": metadata.OS, |
| 231 | "is_ci": isCI, |
| 232 | } |
| 233 | |
| 234 | identify := analytics.Identify{ |
| 235 | AnonymousId: metadata.AnonymousID, |
| 236 | Traits: traits, |
| 237 | Context: &analytics.Context{ |
| 238 | Device: analytics.DeviceInfo{ |
| 239 | Id: metadata.AnonymousID, |
| 240 | }, |
| 241 | }, |
| 242 | } |
| 243 | |
| 244 | if metadata.UserID != "" { |
| 245 | identify.UserId = metadata.UserID |
| 246 | if metadata.Email != "" { |
| 247 | traits["email"] = metadata.Email |
| 248 | } |
| 249 | if metadata.Name != "" { |
| 250 | traits["name"] = metadata.Name |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | return a.client.Enqueue(identify) |
| 255 | } |
| 256 | |
| 257 | // Track tracks the event with the provided custom properties, merged with the |
| 258 | // base properties of the invocation |