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); }
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); }
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}"); }
/// <summary> /// Flushes the queued data to Mixpanel /// </summary> public static void Flush() { MixpanelManager.Flush(); }
private static void Initialize() { _instance = new GameObject("Mixpanel").AddComponent <MixpanelManager>(); Mixpanel.Load(); }