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, 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. }
return void
        public static void Main(string[] args)
        {
            Console.WriteLine("Started!");
            Debugger.Break();
            using (Client analytics = new Client("r7bxis28wy"))
            {
                analytics.Identify("user123", new Traits()
                {
                    { "hey", 123 }
                });

                analytics.Track("user123", "Ran away");

                analytics.Track("user123", "Engaged a bear", new Properties()
                {
                    { "bearWeight", 865 }
                });

                analytics.Track("user123", "Engaged a bear", new Options()
                                .SetContext(new Context()
                {
                    { "app", new Dict()
                      {
                          { "name", "test" }
                      } }
                }));

                analytics.Track("user123", "Is Not Alive", new Properties()
                {
                    { "why", "bear attack" }
                }, new Options()
                                .SetIntegration("Salesforce", true)
                                );

                analytics.Track("user123", "Is Not Alive", new Properties()
                {
                    { "why", "bear attack" }
                }, new Options()
                                .SetIntegration("Salesforce", true)
                                .SetAnonymousId("cookie-id")
                                .SetContext(new Context()
                                            .Add("ip", "192.144.23.2"))
                                );

                analytics.Flush();
            }
        }
		public static void Main (string[] args)
		{
			Console.WriteLine ("Started!");
			Debugger.Break ();
			using (Client analytics = new Client("r7bxis28wy")) 
			{
				analytics.Identify ("user123", new Traits () {
					{ "hey", 123 }
				});

				analytics.Track ("user123", "Ran away");

				analytics.Track ("user123", "Engaged a bear", new Properties () {
					{ "bearWeight", 865 }
				});

				analytics.Track ("user123", "Engaged a bear", new Options ()
					.SetContext (new Context () {
						{ "app", new Dict() {
							{ "name", "test" } 
						}}
				}));

				analytics.Track ("user123", "Is Not Alive", new Properties () {
					{ "why", "bear attack" }
				}, new Options()
					.SetIntegration("Salesforce", true)
				);

				analytics.Track ("user123", "Is Not Alive", new Properties () {
					{ "why", "bear attack" }
				}, new Options()
					.SetIntegration("Salesforce", true)
					.SetAnonymousId("cookie-id")
					.SetContext(new Context()
						.Add("ip", "192.144.23.2"))
				);

				analytics.Flush ();
			}
		}
示例#3
0
		public static void Identify(Client client)
		{
			client.Identify("user", Traits(), Options());
			Analytics.Client.Flush();
		}