C# Class Segmentio.Client

A Segment.io REST client
Inheritance: IDisposable
Show file Open project: Monkimun/segmentio-unity Class Usage Examples

Public Methods

Method Description
Alias ( string from, string to ) : void

Aliases an anonymous user into an identified user.

Alias ( string from, string to, ContextSegmentIO context ) : void

Aliases an anonymous user into an identified user.

Alias ( string from, string to, System.DateTime timestamp ) : void

Aliases an anonymous user into an identified user.

Alias ( string from, string to, System.DateTime timestamp, ContextSegmentIO context ) : void

Aliases an anonymous user into an identified user.

Client ( string secret ) : System

Creates a new REST client with a specified API secret and default options

Client ( string secret, Options options ) : System

Creates a new REST client with a specified API secret and default options

Dispose ( ) : void

Disposes of the flushing thread and the message queue. Note, this does not call Flush() first.

Call Dispose when you are finished using the Segmentio.Client. The Dispose method leaves the Segmentio.Client in an unusable state. After calling Dispose, you must release all references to the Segmentio.Client so the garbage collector can reclaim the memory that the Segmentio.Client was occupying.

Flush ( ) : void

Blocks until all messages are flushed

Identify ( string userId, Traits traits ) : void

Identifying a visitor ties all of their actions to an ID you recognize and records visitor traits you can segment by.

Identify ( string userId, Traits traits, ContextSegmentIO context ) : void

Identifying a visitor ties all of their actions to an ID you recognize and records visitor traits you can segment by.

Identify ( string userId, Traits traits, System.DateTime timestamp ) : void

Identifying a visitor ties all of their actions to an ID you recognize and records visitor traits you can segment by.

Identify ( string userId, Traits traits, System.DateTime timestamp, ContextSegmentIO context ) : void

Identifying a visitor ties all of their actions to an ID you recognize and records visitor traits you can segment by.

Track ( string id, bool anonymous, string eventName ) : void

Whenever a user triggers an event on your site, you’ll want to track it.

Track ( string id, bool anonymous, string eventName, Properties properties ) : void

Whenever a user triggers an event on your site, you’ll want to track it.

Track ( string id, bool anonymous, string eventName, Properties properties, System.DateTime timestamp ) : void

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.

Track ( string id, bool anonymous, string eventName, Properties properties, System.DateTime timestamp, ContextSegmentIO context ) : void

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.

Private Methods

Method Description
Enqueue ( Segmentio.Model.BaseAction action ) : void
RaiseFailure ( Segmentio.Model.BaseAction action, System e ) : void
RaiseSuccess ( Segmentio.Model.BaseAction action ) : void

Method Details

Alias() public method

Aliases an anonymous user into an identified user.
public Alias ( string from, string to ) : void
from string The anonymous user's id before they are logged in.
to string the identified user's id after they're logged in.
return void

Alias() public method

Aliases an anonymous user into an identified user.
public Alias ( string from, string to, ContextSegmentIO context ) : void
from string The anonymous user's id before they are logged in.
to string the identified user's id after they're logged in.
context Segmentio.Model.ContextSegmentIO 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.
return void

Alias() public method

Aliases an anonymous user into an identified user.
public Alias ( string from, string to, System.DateTime timestamp ) : void
from string The anonymous user's id before they are logged in.
to string the identified user's id after they're logged in.
timestamp System.DateTime 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.
return void

Alias() public method

Aliases an anonymous user into an identified user.
public Alias ( string from, string to, System.DateTime timestamp, ContextSegmentIO context ) : void
from string The anonymous user's id before they are logged in.
to string the identified user's id after they're logged in.
timestamp System.DateTime 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.
context Segmentio.Model.ContextSegmentIO 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.
return void

Client() public method

Creates a new REST client with a specified API secret and default options
public Client ( string secret ) : System
secret string
return System

Client() public method

Creates a new REST client with a specified API secret and default options
public Client ( string secret, Options options ) : System
secret string
options Options
return System

Dispose() public method

Disposes of the flushing thread and the message queue. Note, this does not call Flush() first.
Call Dispose when you are finished using the Segmentio.Client. The Dispose method leaves the Segmentio.Client in an unusable state. After calling Dispose, you must release all references to the Segmentio.Client so the garbage collector can reclaim the memory that the Segmentio.Client was occupying.
public Dispose ( ) : void
return void

Flush() public method

Blocks until all messages are flushed
public Flush ( ) : void
return void

Identify() public method

Identifying a visitor ties all of their actions to an ID you recognize and records visitor traits you can segment by.
public Identify ( string userId, Traits traits ) : void
userId string 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.
traits Segmentio.Model.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. }
return void

Identify() public method

Identifying a visitor ties all of their actions to an ID you recognize and records visitor traits you can segment by.
public Identify ( string userId, Traits traits, ContextSegmentIO context ) : void
userId string 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.
traits Segmentio.Model.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. }
context Segmentio.Model.ContextSegmentIO 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.
return void

Identify() public method

Identifying a visitor ties all of their actions to an ID you recognize and records visitor traits you can segment by.
public Identify ( string userId, Traits traits, System.DateTime timestamp ) : void
userId string 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.
traits Segmentio.Model.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. }
timestamp System.DateTime 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.
return void

Identify() public method

Identifying a visitor ties all of their actions to an ID you recognize and records visitor traits you can segment by.
public Identify ( string userId, Traits traits, System.DateTime timestamp, ContextSegmentIO context ) : void
userId string 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.
traits Segmentio.Model.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. }
timestamp System.DateTime 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.
context Segmentio.Model.ContextSegmentIO 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.
return void

Track() public method

Whenever a user triggers an event on your site, you’ll want to track it.
public Track ( string id, bool anonymous, string eventName ) : void
id string
anonymous bool
eventName string 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"
return void

Track() public method

Whenever a user triggers an event on your site, you’ll want to track it.
public Track ( string id, bool anonymous, string eventName, Properties properties ) : void
id string
anonymous bool
eventName string 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"
properties Segmentio.Model.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.
return void

Track() public method

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.
public Track ( string id, bool anonymous, string eventName, Properties properties, System.DateTime timestamp ) : void
id string
anonymous bool
eventName string 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"
properties Segmentio.Model.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.
timestamp System.DateTime 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.
return void

Track() public method

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.
public Track ( string id, bool anonymous, string eventName, Properties properties, System.DateTime timestamp, ContextSegmentIO context ) : void
id string
anonymous bool
eventName string 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"
properties Segmentio.Model.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.
timestamp System.DateTime 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.
context Segmentio.Model.ContextSegmentIO 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.
return void