C# Class Segment.Client

A Segment.io .NET client
Inheritance: IDisposable
Afficher le fichier Open project: segmentio/Analytics.NET Class Usage Examples

Méthodes publiques

Méthode Description
Alias ( string previousId, string userId ) : void

Aliases an anonymous user into an identified user.

Alias ( string previousId, string userId, Options options ) : void

Aliases an anonymous user into an identified user.

Client ( string writeKey ) : System

Creates a new REST client with a specified API writeKey and default config

Client ( string writeKey, Config config ) : System

Creates a new REST client with a specified API writeKey and default config

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 Segment.Client. The Dispose method leaves the Segment.Client in an unusable state. After calling Dispose, you must release all references to the Segment.Client so the garbage collector can reclaim the memory that the Segment.Client was occupying.

Flush ( ) : void

Blocks until all messages are flushed

Group ( string userId, string groupId, object>.IDictionary traits ) : void

The `group` method lets you associate a user with a group. Be it a company, organization, account, project, team or whatever other crazy name you came up with for the same concept! It also lets you record custom traits about the group, like industry or number of employees.

Group ( string userId, string groupId, object>.IDictionary traits, Options options ) : void

The `group` method lets you associate a user with a group. Be it a company, organization, account, project, team or whatever other crazy name you came up with for the same concept! It also lets you record custom traits about the group, like industry or number of employees.

Group ( string userId, string groupId, Options options ) : void

The `group` method lets you associate a user with a group. Be it a company, organization, account, project, team or whatever other crazy name you came up with for the same concept! It also lets you record custom traits about the group, like industry or number of employees.

Identify ( string userId, object>.IDictionary 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, object>.IDictionary traits, Options options ) : void

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

Page ( string userId, string name ) : void

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.

Page ( string userId, string name, object>.IDictionary properties ) : void

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.

Page ( string userId, string name, object>.IDictionary properties, Options options ) : void

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.

Page ( string userId, string name, Options options ) : void

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.

Page ( string userId, string name, string category ) : void

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.

Page ( string userId, string name, string category, object>.IDictionary properties, Options options ) : void

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.

Screen ( string userId, string name ) : void

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.

Screen ( string userId, string name, object>.IDictionary properties ) : void

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.

Screen ( string userId, string name, object>.IDictionary properties, Options options ) : void

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.

Screen ( string userId, string name, Options options ) : void

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.

Screen ( string userId, string name, string category ) : void

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.

Screen ( string userId, string name, string category, object>.IDictionary properties, Options options ) : void

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.

Track ( string userId, string eventName ) : void

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

Track ( string userId, string eventName, object>.IDictionary properties ) : void

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

Track ( string userId, string eventName, object>.IDictionary properties, Options options ) : 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 userId, string eventName, Options options ) : 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

Méthode Description
Enqueue ( BaseAction action ) : void
HasAnonymousId ( Options options ) : bool

Determines whether an anonymous identifier is defined in the specified options.

RaiseFailure ( BaseAction action, System e ) : void
RaiseSuccess ( BaseAction action ) : void

Method Details

Alias() public méthode

Aliases an anonymous user into an identified user.
public Alias ( string previousId, string userId ) : void
previousId string The anonymous user's id before they are logged in.
userId string the identified user's id after they're logged in.
Résultat void

Alias() public méthode

Aliases an anonymous user into an identified user.
public Alias ( string previousId, string userId, Options options ) : void
previousId string The anonymous user's id before they are logged in.
userId string the identified user's id after they're logged in.
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void

Client() public méthode

Creates a new REST client with a specified API writeKey and default config
public Client ( string writeKey ) : System
writeKey string
Résultat System

Client() public méthode

Creates a new REST client with a specified API writeKey and default config
public Client ( string writeKey, Config config ) : System
writeKey string
config Config
Résultat System

Dispose() public méthode

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

Flush() public méthode

Blocks until all messages are flushed
public Flush ( ) : void
Résultat void

Group() public méthode

The `group` method lets you associate a user with a group. Be it a company, organization, account, project, team or whatever other crazy name you came up with for the same concept! It also lets you record custom traits about the group, like industry or number of employees.
public Group ( string userId, string groupId, object>.IDictionary traits ) : void
userId string The visitor's database identifier after they log in, or you know /// who they are. By explicitly grouping a user, you tie all of their actions to their group.
groupId string The group's database identifier after they log in, or you know /// who they are.
traits object>.IDictionary A dictionary with group keys like "name", “subscriptionPlan”. /// 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. }
Résultat void

Group() public méthode

The `group` method lets you associate a user with a group. Be it a company, organization, account, project, team or whatever other crazy name you came up with for the same concept! It also lets you record custom traits about the group, like industry or number of employees.
public Group ( string userId, string groupId, object>.IDictionary traits, Options options ) : void
userId string The visitor's database identifier after they log in, or you know /// who they are. By explicitly grouping a user, you tie all of their actions to their group.
groupId string The group's database identifier after they log in, or you know /// who they are.
traits object>.IDictionary A dictionary with group keys like "name", “subscriptionPlan”. /// 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. }
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of the message.
Résultat void

Group() public méthode

The `group` method lets you associate a user with a group. Be it a company, organization, account, project, team or whatever other crazy name you came up with for the same concept! It also lets you record custom traits about the group, like industry or number of employees.
public Group ( string userId, string groupId, Options options ) : void
userId string The visitor's database identifier after they log in, or you know /// who they are. By explicitly grouping a user, you tie all of their actions to their group.
groupId string The group's database identifier after they log in, or you know /// who they are.
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void

Identify() public méthode

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, object>.IDictionary 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 object>.IDictionary 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. }
Résultat void

Identify() public méthode

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, object>.IDictionary traits, Options options ) : 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 object>.IDictionary 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. }
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void

Page() public méthode

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.
public Page ( string userId, string name ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the webpage, like "Signup", "Login"
Résultat void

Page() public méthode

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.
public Page ( string userId, string name, object>.IDictionary properties ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the webpage, like "Signup", "Login"
properties object>.IDictionary A dictionary with items that describe the page /// in more detail. This argument is optional, but highly recommended — /// you’ll find these properties extremely useful later.
Résultat void

Page() public méthode

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.
public Page ( string userId, string name, object>.IDictionary properties, Options options ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the webpage, like "Signup", "Login"
properties object>.IDictionary A dictionary with items that describe the page /// in more detail. This argument is optional, but highly recommended — /// you’ll find these properties extremely useful later.
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void

Page() public méthode

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.
public Page ( string userId, string name, Options options ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the webpage, like "Signup", "Login"
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void

Page() public méthode

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.
public Page ( string userId, string name, string category ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the webpage, like "Signup", "Login"
category string The (optional) category of the webpage, like "Authentication", "Sports"
Résultat void

Page() public méthode

The `page` method let your record whenever a user sees a webpage on your website, and attach a `name`, `category` or `properties` to the webpage load.
public Page ( string userId, string name, string category, object>.IDictionary properties, Options options ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the webpage, like "Signup", "Login"
category string The (optional) category of the mobile screen, like "Authentication", "Sports"
properties object>.IDictionary A dictionary with items that describe the page /// in more detail. This argument is optional, but highly recommended — /// you’ll find these properties extremely useful later.
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void

Screen() public méthode

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.
public Screen ( string userId, string name ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the mobile screen, like "Signup", "Login"
Résultat void

Screen() public méthode

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.
public Screen ( string userId, string name, object>.IDictionary properties ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the mobile screen, like "Signup", "Login"
properties object>.IDictionary A dictionary with items that describe the screen /// in more detail. This argument is optional, but highly recommended — /// you’ll find these properties extremely useful later.
Résultat void

Screen() public méthode

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.
public Screen ( string userId, string name, object>.IDictionary properties, Options options ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the mobile screen, like "Signup", "Login"
properties object>.IDictionary A dictionary with items that describe the screen /// in more detail. This argument is optional, but highly recommended — /// you’ll find these properties extremely useful later.
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void

Screen() public méthode

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.
public Screen ( string userId, string name, Options options ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the mobile screen, like "Signup", "Login"
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void

Screen() public méthode

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.
public Screen ( string userId, string name, string category ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the mobile screen, like "Signup", "Login"
category string The (optional) category of the mobile screen, like "Authentication", "Sports"
Résultat void

Screen() public méthode

The `screen` method let your record whenever a user sees a mobile screen on your mobile app, and attach a `name`, `category` or `properties` to the screen.
public Screen ( string userId, string name, string category, object>.IDictionary properties, Options options ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
name string The name of the mobile screen, like "Signup", "Login"
category string The (optional) category of the mobile screen, like "Authentication", "Sports"
properties object>.IDictionary A dictionary with items that describe the screen /// in more detail. This argument is optional, but highly recommended — /// you’ll find these properties extremely useful later.
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void

Track() public méthode

Whenever a user triggers an event on your site, you’ll want to track it.
public Track ( string userId, string eventName ) : void
userId string The visitor's identifier after they log in, or you know /// who they are.
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"
Résultat void

Track() public méthode

Whenever a user triggers an event on your site, you’ll want to track it.
public Track ( string userId, string eventName, object>.IDictionary properties ) : void
userId string The visitor's identifier after they log in, or you know /// who they are.
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 object>.IDictionary 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.
Résultat void

Track() public méthode

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 userId, string eventName, object>.IDictionary properties, Options options ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
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 object>.IDictionary 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.
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void

Track() public méthode

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 userId, string eventName, Options options ) : 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. /// This makes it possible for you to run things like segment-based email campaigns.
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"
options Segment.Model.Options Options allowing you to set timestamp, anonymousId, target integrations, /// and the context of th emessage.
Résultat void