static void StartRecordingEvents() { // A basic event // Every time this is called, the "hits" value will increment for this event // Event IDs are created on-the-fly in your code and DO NOT need to be setup on the Lumos website first LumosAnalytics.RecordEvent("lumos-is-ready"); // Any events recorded after this point in execution should record }
void OnGUI() { GUILayout.Label(errorMessage); GUILayout.Space(20); // Event with value GUILayout.BeginHorizontal(); GUILayout.Label("Event Value (float)", GUILayout.Width(baseWidth)); eventValue = GUILayout.TextField(eventValue, GUILayout.Width(baseWidth)); if (GUILayout.Button("Event + Value", GUILayout.Width(baseWidth))) { Debug.Log("Sending event with value..."); var eventAsFloat = float.Parse(eventValue); LumosAnalytics.RecordEvent("event-with-value", eventAsFloat); } GUILayout.EndHorizontal(); GUILayout.Space(20); // Event with custom category GUILayout.BeginHorizontal(); GUILayout.Label("Custom Category", GUILayout.Width(baseWidth)); category = GUILayout.TextField(category, GUILayout.Width(baseWidth)); if (GUILayout.Button("Event + Category", GUILayout.Width(baseWidth))) { Debug.Log("Sending event with custom category..."); LumosAnalytics.RecordEvent(category, "event-with-custom-category"); } GUILayout.EndHorizontal(); GUILayout.Space(20); // Unique event GUILayout.BeginHorizontal(); GUILayout.Label("Unique Event (per user)", GUILayout.Width(baseWidth)); eventName = GUILayout.TextField(eventName, GUILayout.Width(baseWidth)); if (GUILayout.Button("Unique Event", GUILayout.Width(baseWidth))) { Debug.Log("Sending unique event..."); LumosAnalytics.RecordEvent(eventName, false); } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); }
IEnumerator FPS() { // Infinite loop executed every "frenquency" secondes. while (true) { // Update the FPS float fps = accum / frames; sFPS = fps.ToString("f" + Mathf.Clamp(nbDecimal, 0, 10)); LumosAnalytics.RecordEvent("FPS", "LowEnd", fps); //Update the color color = (fps >= 30) ? Color.green : ((fps > 10) ? Color.red : Color.yellow); accum = 0.0F; frames = 0; yield return(new WaitForSeconds(frequency)); } }
// An example of a unique event // Unique events are not repeatable per player // This is great if you want to know information such as how many players have completed a certain level // as opposed to how many times a level has been completed public static void ExampleUniqueEvent(string eventID) { LumosAnalytics.RecordEvent(eventID, false); }
// An example of an event being recorded with a custom category // Events have a default category called 'default' that is used when you do not supply one // There is also an option in LumosAnalytics.cs to use scene names as categories public static void ExampleEventWithCategory(string category, string eventID) { LumosAnalytics.RecordEvent(category, eventID); }
// An example of an event being recorded with a value. // The value is used in a number of ways to show you interesting statistics // On the Lumos website you can see it's average, sum, and more public static void ExampleEventWithValue(string eventID, float eventValue) { LumosAnalytics.RecordEvent(eventID, eventValue); }