コード例 #1
0
ファイル: Mixpanel.cs プロジェクト: ellion/mixpanel-unity
        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);
        }
コード例 #2
0
ファイル: Mixpanel.cs プロジェクト: ellion/mixpanel-unity
 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);
 }
コード例 #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}");
 }
コード例 #4
0
 /// <summary>
 /// Flushes the queued data to Mixpanel
 /// </summary>
 public static void Flush()
 {
     MixpanelManager.Flush();
 }
コード例 #5
0
 private static void Initialize()
 {
     _instance = new GameObject("Mixpanel").AddComponent <MixpanelManager>();
     Mixpanel.Load();
 }