コード例 #1
0
 protected void ensureId(String userId, RudderOptions options)
 {
     if (String.IsNullOrEmpty(userId) && String.IsNullOrEmpty(options.AnonymousId))
     {
         throw new InvalidOperationException("Please supply a valid id (either userId or anonymousId.");
     }
 }
コード例 #2
0
        /// <inheritdoc />
        public void Identify(string userId, IDictionary <string, object> traits, RudderOptions options)
        {
            if (String.IsNullOrEmpty(userId) && !HasAnonymousId(options))
            {
                throw new InvalidOperationException("Please supply a valid userId to Identify.");
            }

            Enqueue(new Identify(userId, traits, options));
        }
コード例 #3
0
        /// <inheritdoc />
        public void Alias(string previousId, string userId, RudderOptions options)
        {
            if (String.IsNullOrEmpty(previousId))
            {
                throw new InvalidOperationException("Please supply a valid 'previousId' to Alias.");
            }

            if (String.IsNullOrEmpty(userId))
            {
                throw new InvalidOperationException("Please supply a valid 'userId' to Alias.");
            }

            Enqueue(new Alias(previousId, userId, options));
        }
コード例 #4
0
ファイル: Actions.cs プロジェクト: rudderlabs/rudder-sdk-.net
 public static void Identify(RudderClient client, Traits traits, RudderOptions options)
 {
     client.Identify("user", traits, options);
     RudderAnalytics.Client.Flush();
 }
コード例 #5
0
 /// <summary>
 /// Determines whether an anonymous identifier is defined in the specified options.
 /// </summary>
 /// <returns><c>true</c> if the specified options have an anonymous identifier; otherwise, <c>false</c>.</returns>
 /// <param name="options">Options.</param>
 internal static bool HasAnonymousId(RudderOptions options)
 {
     return(options != null && !String.IsNullOrEmpty(options.AnonymousId));
 }
コード例 #6
0
        /// <inheritdoc />
        public void Screen(string userId, string name, string category, IDictionary <string, object> properties, RudderOptions options)
        {
            if (String.IsNullOrEmpty(userId) && !HasAnonymousId(options))
            {
                throw new InvalidOperationException("Please supply a valid userId or anonymousId to call #Screen.");
            }

            if (String.IsNullOrEmpty(name))
            {
                throw new InvalidOperationException("Please supply a valid name to call #Screen.");
            }

            Enqueue(new Screen(userId, name, category, properties, options));
        }
コード例 #7
0
 /// <inheritdoc />
 public void Screen(string userId, string name, IDictionary <string, object> properties, RudderOptions options)
 {
     Screen(userId, name, null, properties, options);
 }
コード例 #8
0
 /// <inheritdoc />
 public void Screen(string userId, string name, RudderOptions options)
 {
     Screen(userId, name, null, null, options);
 }
コード例 #9
0
 /// <inheritdoc />
 public void Page(string userId, string name, RudderOptions options)
 {
     Page(userId, name, null, null, options);
 }
コード例 #10
0
        /// <inheritdoc />
        public void Track(string userId, string eventName, IDictionary <string, object> properties, RudderOptions options)
        {
            if (String.IsNullOrEmpty(userId) && !HasAnonymousId(options))
            {
                throw new InvalidOperationException("Please supply a valid userId or anonymousId to call #Track.");
            }

            if (String.IsNullOrEmpty(eventName))
            {
                throw new InvalidOperationException("Please supply a valid event to call #Track.");
            }

            Enqueue(new Track(userId, eventName, properties, options));
        }
コード例 #11
0
 /// <inheritdoc />
 public void Track(string userId, string eventName, RudderOptions options)
 {
     Track(userId, eventName, null, options);
 }
コード例 #12
0
        /// <inheritdoc />
        public void Group(string userId, string groupId, IDictionary <string, object> traits, RudderOptions options)
        {
            if (String.IsNullOrEmpty(userId) && !HasAnonymousId(options))
            {
                throw new InvalidOperationException("Please supply a valid userId or anonymousId to call #Group.");
            }

            if (String.IsNullOrEmpty(groupId))
            {
                throw new InvalidOperationException("Please supply a valid groupId to call #Group.");
            }

            Enqueue(new Group(userId, groupId, traits, options));
        }
コード例 #13
0
 /// <inheritdoc />
 public void Group(string userId, string groupId, RudderOptions options)
 {
     Group(userId, groupId, null, options);
 }