// Use this for initialization void Start() { lock (_lock) { if (td == null) { /* Just for testing. Please ignore these API calls: start */ TreasureData.InitializeApiEndpoint("https://in.treasuredata.com"); TreasureData.DisableLogging(); /* Just for testing. Please ignore these API calls: end */ TreasureData.EnableLogging(); // TreasureData.InitializeApiEndpoint("https://anotherapiendpoint.treasuredata.com"); TreasureData.InitializeEncryptionKey("hello world"); TreasureData.InitializeDefaultDatabase("testdb"); td = new TreasureData("YOUR_WRITE_APIKEY"); /* For development mode to run application without real devices * See https://github.com/treasure-data/td-unity-sdk-package#development-mode-to-run-application-without-real-devices */ SimpleTDClient.SetDummyAppVersionNumber("77"); SimpleTDClient.SetDummyBoard("bravo"); SimpleTDClient.SetDummyBrand("htc_asia_wwe"); SimpleTDClient.SetDummyDevice("bravo"); SimpleTDClient.SetDummyDisplay("ERE27"); SimpleTDClient.SetDummyModel("HTC Desire"); SimpleTDClient.SetDummyOsVer("2.1"); SimpleTDClient.SetDummyOsType("android"); SimpleTDClient.SetDummyLocaleCountry("JP"); SimpleTDClient.SetDummyLocaleLang("ja"); td.SetSimpleTDClient(SimpleTDClient.Create()); /* Just for testing. Please ignore these API calls: start */ td.DisableAutoAppendUniqId(); td.DisableAutoAppendModelInformation(); td.DisableAutoAppendAppInformation(); td.DisableAutoAppendLocaleInformation(); td.DisableServerSideUploadTimestamp(); td.DisableAutoAppendRecordUUID(); td.DisableRetryUploading(); td.EnableRetryUploading(); td.EnableAutoAppendRecordUUID("test_random_uuid"); td.EnableServerSideUploadTimestamp(); td.StartSession("dummy_tbl"); td.EndSession("dummy_tbl"); /* Just for testing. Please ignore these API calls: end */ td.EnableAutoAppendUniqId(); td.EnableAutoAppendModelInformation(); td.EnableAutoAppendAppInformation(); td.EnableAutoAppendLocaleInformation(); td.EnableAutoAppendRecordUUID(); td.EnableServerSideUploadTimestamp("server_time"); print("GetGlobalSessionId() before StartGlobalSession(): " + TreasureData.GetGlobalSessionId()); TreasureData.StartGlobalSession(); print("GetGlobalSessionId() after StartGlobalSession(): " + TreasureData.GetGlobalSessionId()); if (td.IsFirstRun()) { td.AddEvent("unitytbl", "installed", true, delegate() { td.ClearFirstRun(); }, delegate(string errorCode, string errorMsg) { print("AddEvent Error!!! : errorCode=" + errorCode + ", errorMsg=" + errorMsg); } ); td.UploadEvents(); } } } }