示例#1
0
        /// <summary>
        /// Creates an alias (newId) on an original id.
        /// More info: https://mixpanel.com/help/reference/http#distinct-id-alias
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="originalId">The original identifier.</param>
        /// <param name="newId">The new identifier.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">token</exception>
        public async Task CreateAlias(string token, string originalId, string newId)
        {
            if (string.IsNullOrEmpty(token))
            {
                throw new ArgumentNullException("token");
            }

            if (string.IsNullOrEmpty(originalId))
            {
                throw new ArgumentNullException("originalId");
            }

            if (string.IsNullOrEmpty(newId))
            {
                throw new ArgumentNullException("newId");
            }

            TrackingEventProperties properties = new TrackingEventProperties(token);

            properties.All["distinct_id"] = originalId;
            properties.All["alias"]       = newId;
            TrackingEvent evt = new TrackingEvent("$create_alias", properties);

            await Track <TrackingEvent>(evt);
        }
示例#2
0
 private TrackingEvent GetEvent1()
 {
     // Sample event tracking
     TrackingEvent evt = new TrackingEvent("Signed Up");
     evt.Properties = new TrackingEventProperties(Token);
     evt.Properties.DistinctId = "13793";
     evt.Properties.All["Referred by"] = "Friend";
     return evt;
 }
示例#3
0
            /// <summary>
            /// Contains the specified tracking event to the local store.
            /// </summary>
            /// <param name="trackingEvent">The tracking event.</param>
            /// <exception cref="System.ArgumentNullException">trackingEvent</exception>
            public bool Contains(TrackingEvent trackingEvent)
            {
                if (trackingEvent == null)
                {
                    throw new ArgumentNullException("trackingEvent");
                }

                return(Events.Contains(trackingEvent));
            }
示例#4
0
            /// <summary>
            /// Adds the specified tracking event to the local store.
            /// </summary>
            /// <param name="trackingEvent">The tracking event.</param>
            /// <exception cref="System.ArgumentNullException">trackingEvent</exception>
            public void Add(TrackingEvent trackingEvent)
            {
                if (trackingEvent == null)
                {
                    throw new ArgumentNullException("trackingEvent");
                }

                Events.Add(trackingEvent);
            }
示例#5
0
        private TrackingEvent GetEvent2()
        {
            // other sample using special & custom properties

            TrackingEvent evt = new TrackingEvent("Level Complete");
            evt.Properties = new TrackingEventProperties(Token);
            evt.Properties.DistinctId = "13793";
            evt.Properties.Time = MixpanelClient.ToEpochTime(DateTime.Now);
            evt.Properties.IP = "203.0.113.9";
            evt.Properties.Tag = "Tim Trefren";
            evt.Properties.All["Level Number"] = 9;
            return evt;
        }
示例#6
0
            /// <summary>
            /// Determines whether the store contains the specified entity.
            /// </summary>
            /// <param name="entity">The entity.</param>
            /// <returns></returns>
            /// <exception cref="System.ArgumentNullException">entity</exception>
            public bool Contains(MixpanelEntity entity)
            {
                if (entity == null)
                {
                    throw new ArgumentNullException("entity");
                }

                ProfileUpdate profileUpdate = entity as ProfileUpdate;

                if (profileUpdate != null)
                {
                    return(Contains(profileUpdate));
                }

                TrackingEvent trackingEvent = entity as TrackingEvent;

                if (trackingEvent != null)
                {
                    return(Contains(trackingEvent));
                }

                return(false);
            }
示例#7
0
            /// <summary>
            /// Adds the specified entity to the local store.
            /// </summary>
            /// <param name="entity">The entity.</param>
            /// <exception cref="System.ArgumentNullException">entity</exception>
            public void Add(MixpanelEntity entity)
            {
                if (entity == null)
                {
                    throw new ArgumentNullException("entity");
                }

                ProfileUpdate profileUpdate = entity as ProfileUpdate;

                if (profileUpdate != null)
                {
                    Add(profileUpdate);
                    return;
                }

                TrackingEvent trackingEvent = entity as TrackingEvent;

                if (trackingEvent != null)
                {
                    Add(trackingEvent);
                    return;
                }
            }
示例#8
0
        /// <summary>
        /// Creates an alias (newId) on an original id.
        /// More info: https://mixpanel.com/help/reference/http#distinct-id-alias
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="originalId">The original identifier.</param>
        /// <param name="newId">The new identifier.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">token</exception>
        public void CreateAlias(string token, string originalId, string newId)
        {
            if (string.IsNullOrEmpty(token))
                throw new ArgumentNullException("token");

            if (string.IsNullOrEmpty(originalId))
                throw new ArgumentNullException("originalId");

            if (string.IsNullOrEmpty(newId))
                throw new ArgumentNullException("newId");

            TrackingEventProperties properties = new TrackingEventProperties(token);
            properties.All["distinct_id"] = originalId;
            properties.All["alias"] = newId;
            TrackingEvent evt = new TrackingEvent("$create_alias", properties);
            Track(evt);
        }