internal Identify(string userId, Traits traits, DateTime? timestamp, ContextSegmentIO context ) : base("identify", timestamp, context) { this.UserId = userId; this.Traits = traits ?? new Traits(); }
internal Track(string id, bool anonymous, string eventName, Properties properties, DateTime? timestamp, ContextSegmentIO context) : base("track", timestamp, context) { if (anonymous) { this.AnonymousId = id; } else { this.UserId = id; } this.EventName = eventName; this.Properties = properties ?? new Properties(); }
internal Alias(string from, string to, DateTime? timestamp, ContextSegmentIO context) : base("alias", timestamp, context) { this.From = from; this.To = to; }
/// <summary> /// Whenever a user triggers an event on your site, you’ll want to track it /// so that you can analyze and segment by those events later. /// </summary> /// /// <param name="userId">The visitor's identifier after they log in, or you know /// who they are. By /// explicitly identifying a user, you tie all of their actions to their identity. /// This makes it possible for you to run things like segment-based email campaigns.</param> /// /// <param name="eventName">The event name you are tracking. It is recommended /// that it is in human readable form. For example, "Bought T-Shirt" /// or "Started an exercise"</param> /// /// <param name="properties"> A dictionary with items that describe the event /// in more detail. This argument is optional, but highly recommended — /// you’ll find these properties extremely useful later.</param> /// /// <param name="timestamp"> If this event happened in the past, the timestamp /// can be used to designate when the identification happened. Careful with this one, /// if it just happened, leave it null.</param> /// /// <param name="context"> A dictionary with additional information thats related to the visit. /// Examples are userAgent, and IP address of the visitor. /// Feel free to pass in null if you don't have this information.</param> /// /// public void Track(string id, bool anonymous, string eventName, Properties properties, DateTime? timestamp, ContextSegmentIO context ) { if (String.IsNullOrEmpty(id)) throw new InvalidOperationException("Please supply a valid userId to Track."); if (String.IsNullOrEmpty(eventName)) throw new InvalidOperationException("Please supply a valid eventName to Track."); Track track = new Track(id, anonymous, eventName, properties, timestamp, context); Enqueue(track); }
/// <summary> /// Identifying a visitor ties all of their actions to an ID you /// recognize and records visitor traits you can segment by. /// </summary> /// /// <param name="userId">The visitor's identifier after they log in, or you know /// who they are. By /// explicitly identifying a user, you tie all of their actions to their identity.</param> /// /// <param name="traits">A dictionary with keys like "email", "name", “subscriptionPlan” or /// "friendCount”. You can segment your users by any trait you record. /// Pass in values in key-value format. String key, then its value /// { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param> /// /// <param name="timestamp"> If this event happened in the past, the timestamp /// can be used to designate when the identification happened. Careful with this one, /// if it just happened, leave it null.</param> /// <param name="context"> A dictionary with additional information thats related to the visit. /// Examples are userAgent, and IP address of the visitor. /// Feel free to pass in null if you don't have this information.</param> /// /// public void Identify(string userId, Traits traits, DateTime? timestamp, ContextSegmentIO context) { if (String.IsNullOrEmpty(userId)) throw new InvalidOperationException("Please supply a valid userId to Identify."); Identify identify = new Identify(userId, traits, timestamp, context); Enqueue(identify); }
/// <summary> /// Identifying a visitor ties all of their actions to an ID you /// recognize and records visitor traits you can segment by. /// </summary> /// /// <param name="userId">The visitor's identifier after they log in, or you know /// who they are. By /// explicitly identifying a user, you tie all of their actions to their identity.</param> /// /// <param name="traits">A dictionary with keys like "email", "name", “subscriptionPlan” or /// "friendCount”. You can segment your users by any trait you record. /// Pass in values in key-value format. String key, then its value /// { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param> /// /// <param name="context"> A dictionary with additional information thats related to the visit. /// Examples are userAgent, and IP address of the visitor. /// Feel free to pass in null if you don't have this information.</param> /// public void Identify(string userId, Traits traits, ContextSegmentIO context) { Identify(userId, traits, null, context); }
/// <summary> /// Aliases an anonymous user into an identified user. /// </summary> /// /// <param name="from">The anonymous user's id before they are logged in.</param> /// /// <param name="to">the identified user's id after they're logged in.</param> /// <param name="timestamp"> If this event happened in the past, the timestamp /// can be used to designate when the identification happened. Careful with this one, /// if it just happened, leave it null.</param> /// /// <param name="context"> A dictionary with additional information thats related to the visit. /// Examples are userAgent, and IP address of the visitor. /// Feel free to pass in null if you don't have this information.</param> /// public void Alias(string from, string to, DateTime? timestamp, ContextSegmentIO context) { if (String.IsNullOrEmpty(from)) throw new InvalidOperationException("Please supply a valid 'from' to Alias."); if (String.IsNullOrEmpty(to)) throw new InvalidOperationException("Please supply a valid 'to' to Alias."); Alias alias = new Alias(from, to, timestamp, context); Enqueue(alias); }
/// <summary> /// Aliases an anonymous user into an identified user. /// </summary> /// /// <param name="from">The anonymous user's id before they are logged in.</param> /// /// <param name="to">the identified user's id after they're logged in.</param> /// <param name="context"> A dictionary with additional information thats related to the visit. /// Examples are userAgent, and IP address of the visitor. /// Feel free to pass in null if you don't have this information.</param> /// public void Alias(string from, string to, ContextSegmentIO context) { Alias(from, to, null, context); }