Example #1
0
 public void AddToTrackedEvents(TrackedEvent trackedEvent)
 {
     base.AddObject("TrackedEvents", trackedEvent);
 }
Example #2
0
 public static TrackedEvent CreateTrackedEvent(int trackedEventID, int eventID, int userID, global::System.DateTime createdDate, global::System.DateTime lastUpdatedDate, bool showOnTimeline, bool joinPending, global::System.Guid trackedEventGUID)
 {
     TrackedEvent trackedEvent = new TrackedEvent();
     trackedEvent.TrackedEventID = trackedEventID;
     trackedEvent.EventID = eventID;
     trackedEvent.UserID = userID;
     trackedEvent.CreatedDate = createdDate;
     trackedEvent.LastUpdatedDate = lastUpdatedDate;
     trackedEvent.ShowOnTimeline = showOnTimeline;
     trackedEvent.JoinPending = joinPending;
     trackedEvent.TrackedEventGUID = trackedEventGUID;
     return trackedEvent;
 }
Example #3
0
        /// <summary>
        /// Track a custom event.
        /// </summary>
        /// <param name="eventName">The name of the event you want to track</param>
        /// <param name="data">Any related information you’d like to attach to this event. These attributes can be used in your triggers to control who should receive the triggered email. You can set any number of data key and values.</param>
        /// <param name="timestamp">Allows you to back-date the event, pass null to use current time</param>
        /// <param name="customerId"></param>
        /// <returns>Nothing if successful, throws if failed</returns>
        /// <exception cref="CustomerIoApiException">If any code besides 200 OK is returned from the server.</exception>
        public async Task TrackEventAsync(string eventName, object data = null, DateTime? timestamp = null, string customerId = null)
        {
            if (String.IsNullOrEmpty(customerId) && this._customerFactory != null)
            {
                customerId = customerId ?? this._customerFactory.GetCustomerId();
            }

            var wrappedData = new TrackedEvent
                {
                    Name = eventName,
                    Data = data,
                    Timestamp = timestamp
                };

            if (customerId != null)
            {
                await this.CallMethodAsync(MethodCustomerEvent, customerId, HttpMethod.Post, wrappedData);
            }
            else
            {
                await this.CallMethodAsync(MethodEvent, customerId, HttpMethod.Post, wrappedData);
            }
        }