Example #1
0
        internal static void DoTrack(string eventName, Value properties)
        {
            if (!MixpanelStorage.IsTracking)
            {
                return;
            }
            if (properties == null)
            {
                properties = SeembaMixpanel.ObjectPool.Get();
            }
            properties.Merge(GetEventsDefaultProperties());
            // These auto properties can change in runtime so we don't bake them into AutoProperties
            properties["$screen_width"]  = Screen.width;
            properties["$screen_height"] = Screen.height;
            properties.Merge(MixpanelStorage.OnceProperties);
            MixpanelStorage.ResetOnceProperties();
            properties.Merge(MixpanelStorage.SuperProperties);
            Value startTime;

            if (MixpanelStorage.TimedEvents.TryGetValue(eventName, out startTime))
            {
                properties["$duration"] = Util.CurrentTime() - (double)startTime;
                MixpanelStorage.TimedEvents.Remove(eventName);
            }
            properties["token"]       = SeembaSDKMixpanelSettings.Instance.Token;
            properties["distinct_id"] = MixpanelStorage.DistinctId;
            properties["time"]        = Util.CurrentTime();
            Value data = SeembaMixpanel.ObjectPool.Get();

            data["event"]        = eventName;
            data["properties"]   = properties;
            data["$mp_metadata"] = Metadata.GetEventMetadata();

            Worker.EnqueueEventOp(data);
        }
 /// <summary>
 /// Clears all current event timers.
 /// </summary>
 public static void ClearTimedEvents()
 {
     if (!IsInitialized())
     {
         return;
     }
     MixpanelStorage.ResetTimedEvents();
 }