public static void TrackEvent(string name, IDictionary<string, object> dimensions) { if (name == null || name.Trim().Length == 0) { throw new ArgumentException("A name for the custom event must be provided."); } AVAnalyticEvent aVAnalyticEvent = new AVAnalyticEvent { du = 0L, name = name, sessionId = AVAnalytics.sessionId, tag = name, ts = AVAnalytics.UnixTimestampFromDateTime(DateTime.Now), attributes = dimensions }; AVAnalytics.eventTics.Add(aVAnalyticEvent); }
public static void StartEvent(string name, IDictionary<string, object> dimensions) { if (Enumerable.Any<AVAnalyticEvent>(AVAnalytics.eventTics, (AVAnalyticEvent item) => item.name.Equals(name))) { AVAnalyticEvent aVAnalyticEvent = Enumerable.First<AVAnalyticEvent>(AVAnalytics.eventTics, (AVAnalyticEvent item) => item.name.Equals(name)); if (!aVAnalyticEvent.stop) { aVAnalyticEvent.ts = AVAnalytics.UnixTimestampFromDateTime(DateTime.Now); return; } } AVAnalyticEvent aVAnalyticEvent2 = new AVAnalyticEvent { du = 0L, name = name, sessionId = AVAnalytics.sessionId, tag = name, ts = AVAnalytics.UnixTimestampFromDateTime(DateTime.Now), attributes = dimensions }; AVAnalytics.eventTics.Add(aVAnalyticEvent2); }