void TrackEventHandler(IDictionary <string, string> data) { string category; if (!data.TryGetValue("category", out category) || category.Length == 0) { Log.w("Can't track event: missing 'category' parameter"); return; } string action; if (!data.TryGetValue("action", out action) || action.Length == 0) { Log.w("Can't track event: missing 'action' parameter"); return; } int value = LunarConsoleAnalytics.kUndefinedValue;; string valueStr; if (data.TryGetValue("value", out valueStr)) { if (!int.TryParse(valueStr, out value)) { Log.w("Can't track event: invalid 'value' parameter: {0}", valueStr); return; } } LunarConsoleAnalytics.TrackEvent(category, action, value); }
public static void TrackEvent(string category, string action, int value = LunarConsoleAnalytics.kUndefinedValue) { #if !LUNAR_CONSOLE_ANALYTICS_DISABLED if (LunarConsoleConfig.consoleEnabled && LunarConsoleConfig.consoleSupported) { var payloadStr = LunarConsoleAnalytics.CreatePayload(category, action, value); if (payloadStr != null) { Log.d("Event track payload: " + payloadStr); LunarConsoleHttpClient downloader = new LunarConsoleHttpClient(LunarConsoleAnalytics.TrackingURL); downloader.UploadData(payloadStr, delegate(string result, Exception error) { if (error != null) { Log.e("Event track failed: " + error); } else { Log.d("Event track result: " + result); } }); } } #endif }
void TrackEvent(string category, string action, int value = LunarConsoleAnalytics.kUndefinedValue) { StartCoroutine(LunarConsoleAnalytics.TrackEvent(category, action, value)); }