Exemplo n.º 1
0
        private static void DoTrack(string eventName, Value properties)
        {
            if (!IsTracking)
            {
                return;
            }
            if (properties == null)
            {
                properties = ObjectPool.Get();
            }
            if (_autoTrackProperties == null)
            {
                _autoTrackProperties = CollectAutoTrackProperties();
            }
            properties.Merge(_autoTrackProperties);
            // 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(OnceProperties);
            ResetOnceProperties();
            properties.Merge(SuperProperties);
            if (TimedEvents.TryGetValue(eventName, out Value startTime))
            {
                properties["$duration"] = CurrentTime() - (double)startTime;
                TimedEvents.Remove(eventName);
            }
            properties["token"]       = MixpanelSettings.Instance.Token;
            properties["distinct_id"] = DistinctId;
            properties["time"]        = CurrentTime();
            Value data = ObjectPool.Get();

            data["event"]      = eventName;
            data["properties"] = properties;
            MixpanelManager.EnqueueTrack(data);
        }
Exemplo n.º 2
0
 private static void DoEngage(Value properties)
 {
     if (!IsTracking)
     {
         return;
     }
     if (_autoEngageProperties == null)
     {
         _autoEngageProperties = CollectAutoEngageProperties();
     }
     properties.Merge(_autoEngageProperties);
     properties["$token"]       = MixpanelSettings.Instance.Token;
     properties["$distinct_id"] = DistinctId;
     MixpanelManager.EnqueueEngage(properties);
 }
Exemplo n.º 3
0
 private static void InitializeBeforeSceneLoad()
 {
     _instance = new GameObject("Mixpanel").AddComponent <MixpanelManager>();
     Debug.Log($"[Mixpanel] Track Queue Depth: {Mixpanel.TrackQueue.CurrentCountOfItemsInQueue}");
     Debug.Log($"[Mixpanel] Engage Queue Depth: {Mixpanel.EngageQueue.CurrentCountOfItemsInQueue}");
 }
Exemplo n.º 4
0
 /// <summary>
 /// Flushes the queued data to Mixpanel
 /// </summary>
 public static void Flush()
 {
     MixpanelManager.Flush();
 }
Exemplo n.º 5
0
 private static void Initialize()
 {
     _instance = new GameObject("Mixpanel").AddComponent <MixpanelManager>();
     Mixpanel.Load();
 }