private void _track(string eventName, Dictionary <string, object> dic = null) { AndroidJavaObject jsonObject = null; if (dic != null) { string jsonStr = SAUtils.Parse2JsonStr(dic); jsonObject = SAUtils.Parse2JavaJSONObject(jsonStr); } apiInstance.Call("track", eventName, jsonObject); }
private void _profileSetOnce(Dictionary <string, object> dic) { if (dic == null) { return; } string jsonStr = SAUtils.Parse2JsonStr(dic); AndroidJavaObject jsonObject = SAUtils.Parse2JavaJSONObject(jsonStr); apiInstance.Call("profileSetOnce", jsonObject); }
private void _registerSuperProperties(Dictionary <string, object> properties) { AndroidJavaObject jsonObject = null; if (properties != null) { string jsonStr = SAUtils.Parse2JsonStr(properties); jsonObject = SAUtils.Parse2JavaJSONObject(jsonStr); } apiInstance.Call("registerSuperProperties", jsonObject); }
//二期内容 private void _trackInstallation(Dictionary <string, object> properties = null, bool disableCallback = false) { AndroidJavaObject jsonObject = null; if (properties != null) { string jsonStr = SAUtils.Parse2JsonStr(properties); jsonObject = SAUtils.Parse2JavaJSONObject(jsonStr); } apiInstance.Call("trackAppInstall", jsonObject, disableCallback); }
private void _trackTimerEnd(string eventName, Dictionary <string, object> properties) { AndroidJavaObject jsonObject = null; if (properties != null) { string jsonStr = SAUtils.Parse2JsonStr(properties); jsonObject = SAUtils.Parse2JavaJSONObject(jsonStr); } apiInstance.Call("trackTimerEnd", eventName, jsonObject); }
private void _registerSuperProperties(Dictionary <string, object> properties) { register_super_properties(SAUtils.Parse2JsonStr(properties)); }
private void _trackTimerEnd(string eventName, Dictionary <string, object> properties) { track_timer_end(eventName, SAUtils.Parse2JsonStr(properties)); }
private void _profileSetOnce(Dictionary <string, object> dic) { profile_set_once(SAUtils.Parse2JsonStr(dic)); }
private void _track(string eventName, Dictionary <string, object> dic = null) { track(eventName, SAUtils.Parse2JsonStr(dic)); }
private void _trackInstallation(Dictionary <string, object> properties, bool disableCallback) { track_app_install(SAUtils.Parse2JsonStr(properties), disableCallback); }
private void OnGUI() { //print("ongui===="); int screenWidth = Screen.width; int screenHeight = Screen.height; GUI.skin = guiSkin; guiStyle.fontSize = 30; GUILayout.BeginArea(new Rect(screenWidth * 0.1f, screenHeight * 0.15f, screenWidth * 0.8f, screenHeight * 0.7f)); scrollVector2 = GUILayout.BeginScrollView(scrollVector2); GUILayout.Label("SensorsData Unity SDK"); if (GUILayout.Button("Track 事件")) { DateTime dateTime = DateTime.Now; Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("country", "中国"); dictionary.Add("address", dateTime); //dictionary.Add("test_array", new int[] { 1, 2, 3, 4, 5 }); print("Track an Event."); SensorsDataAPI.Track("Jjcheng112", dictionary); } GUILayout.Space(20); Scene scene = SceneManager.GetActiveScene(); if (scene.name == "Second") { if (GUILayout.Button("Load Sample Scence")) { SceneManager.LoadScene("Sample"); } GUILayout.Space(20); if (GUILayout.Button("set android max cache size")) { print("set android max cache size."); SensorsDataAPI.SetAndroidMaxCacheSize(20 * 1024 * 1024); } GUILayout.Space(20); if (GUILayout.Button("set ios max cache size")) { print("set ios max cache size."); SensorsDataAPI.SetiOSMaxCacheSize(20); } GUILayout.Space(20); if (GUILayout.Button("delete all")) { print("delete all."); SensorsDataAPI.DeleteAll(); } GUILayout.Space(20); if (GUILayout.Button("set flush bulk size")) { print("set flush bulk size."); SensorsDataAPI.SetFlushBulkSize(90); } GUILayout.Space(20); if (GUILayout.Button("set flush interval")) { print("set flush inteval."); SensorsDataAPI.SetFlushInterval(10 * 1000); } GUILayout.Space(20); if (GUILayout.Button("set flush network type")) { print("set flush network type."); SensorsDataAPI.SetFlushNetworkPolicy((int)NetworkType.TYPE_ALL); } GUILayout.Space(20); if (GUILayout.Button("profile set once")) { print("profile set once."); Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("age", "9999"); SensorsDataAPI.ProfileSetOnce(dictionary); } GUILayout.Space(20); if (GUILayout.Button("track installation")) { print("track installation."); Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("testinstall", "9999"); SensorsDataAPI.TrackAppInstall(dictionary, true); } } else { if (GUILayout.Button("Load Second Scence")) { SceneManager.LoadScene("Second"); } //场景一中定义的测试按钮 GUILayout.Space(20); if (GUILayout.Button("Identiy")) { print("identity test."); SensorsDataAPI.Identify("identify_custom_123"); } GUILayout.Space(20); if (GUILayout.Button("Login")) { print("Login test."); SensorsDataAPI.Login("zhangwei_login"); } GUILayout.Space(20); if (GUILayout.Button("Logout")) { print("logout test."); SensorsDataAPI.Logout(); } GUILayout.Space(20); if (GUILayout.Button("Profile Set")) { print("profile set test."); Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("age", "18888888888888"); SensorsDataAPI.ProfileSet(dictionary); } GUILayout.Space(20); if (GUILayout.Button("register super properties")) { print("register super properties test."); Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("super_test1", "tttt"); dictionary.Add("super_test2", "ssss"); SensorsDataAPI.RegisterSuperProperties(dictionary); } GUILayout.Space(20); if (GUILayout.Button("get supper properties")) { print("get super properties test."); Dictionary <string, object> superProperties = SensorsDataAPI.GetSuperProperties(); print("result is: " + SAUtils.Parse2JsonStr(superProperties)); } GUILayout.Space(20); if (GUILayout.Button("unregister super properties")) { print("unregister super properties."); SensorsDataAPI.UnregisterSuperProperty("super_test1"); } GUILayout.Space(20); if (GUILayout.Button("clear super properties")) { print("clear super properties."); SensorsDataAPI.ClearSuperProperties(); } GUILayout.Space(20); if (GUILayout.Button("start timer")) { print("start timer."); SensorsDataAPI.TrackTimerStart("BuyGoods"); } GUILayout.Space(20); if (GUILayout.Button("pause timer")) { print("pause timer."); SensorsDataAPI.TrackTimerPause("BuyGoods"); } GUILayout.Space(20); if (GUILayout.Button("resume timer")) { print("resume timer."); SensorsDataAPI.TrackTimerResume("BuyGoods"); } GUILayout.Space(20); if (GUILayout.Button("end timer")) { print("end timer."); SensorsDataAPI.TrackTimerEnd("BuyGoods"); } GUILayout.Space(20); if (GUILayout.Button("clear timer")) { print("clear timer."); SensorsDataAPI.ClearTrackTimer(); } GUILayout.Space(20); if (GUILayout.Button("remove timer")) { print("remove timer."); SensorsDataAPI.RemoveTimer("BuyGoods"); } GUILayout.Space(20); if (GUILayout.Button("flush")) { print("flush test."); SensorsDataAPI.Flush(); } } GUILayout.EndScrollView(); GUILayout.EndArea(); //GUI.Label(new Rect(padding, height, maxWidth, 80), "Sensors Data", guiStyle); //height += 80 + padding; //if (GUI.Button(new Rect(padding, height, maxWidth, 100), "Track 一条事件")) //{ // print("Track an Event."); // Dictionary<string, object> dictionary = new Dictionary<string, object>(); // dictionary.Add("country", "中国"); // dictionary.Add("address", "中国2222"); // SensorsDataAPI.Track("ViewProduct", dictionary); //} }