ball 项目提交
This commit is contained in:
@@ -0,0 +1,376 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DataEyeAnalytics.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DataEyeAnalytics.Wrapper
|
||||
{
|
||||
public partial class DataEyeAnalyticsWrapper
|
||||
{
|
||||
#if UNITY_ANDROID && !(UNITY_EDITOR)
|
||||
private static readonly string JSON_CLASS = "org.json.JSONObject";
|
||||
private static readonly AndroidJavaClass sdkClass = new AndroidJavaClass("cn.dataeye.android.DataEyeAnalyticsSDK");
|
||||
|
||||
private AndroidJavaObject instance;
|
||||
/// <summary>
|
||||
/// Convert Dictionary object to JSONObject in Java.
|
||||
/// </summary>
|
||||
/// <returns>The JSONObject instance.</returns>
|
||||
/// <param name="data">The Dictionary containing some data </param>
|
||||
private static AndroidJavaObject getJSONObject(string dataString)
|
||||
{
|
||||
if (dataString.Equals("null"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return new AndroidJavaObject(JSON_CLASS, dataString);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DE_Log.w("DataEyeAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private string getTimeString(DateTime dateTime) {
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
|
||||
AndroidJavaObject date = new AndroidJavaObject("java.util.Date", currentMillis);
|
||||
return instance.Call<string>("getTimeString", date);
|
||||
}
|
||||
|
||||
private static void enable_log(bool enableLog) {
|
||||
sdkClass.CallStatic("enableTrackLog", enableLog);
|
||||
}
|
||||
private static void setVersionInfo(string libName, string version) {
|
||||
sdkClass.CallStatic("setCustomerLibInfo", libName, version);
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity"); //获得Context
|
||||
// AndroidJavaObject config = configClass.CallStatic<AndroidJavaObject>("getInstance", context, token.appid, token.serverUrl);
|
||||
// config.Call("setModeInt", (int) token.mode);
|
||||
|
||||
// string timeZoneId = token.getTimeZoneId();
|
||||
// if (null != timeZoneId && timeZoneId.Length > 0)
|
||||
// {
|
||||
// AndroidJavaObject timeZone = new AndroidJavaClass("java.util.TimeZone").CallStatic<AndroidJavaObject>("getTimeZone", timeZoneId);
|
||||
// if (null != timeZone)
|
||||
// {
|
||||
// config.Call("setDefaultTimeZone", timeZone);
|
||||
// }
|
||||
// }
|
||||
|
||||
instance = sdkClass.CallStatic<AndroidJavaObject>("sharedInstance", context, token.appid, token.serverUrl);
|
||||
|
||||
|
||||
Debug.Log(" " + token.reyunAppID);
|
||||
if(token.reyunAppID != null && token.reyunAppID != "")
|
||||
instance.Call("reyunAppID", token.reyunAppID);
|
||||
}
|
||||
|
||||
private void flush()
|
||||
{
|
||||
instance.Call("flush");
|
||||
}
|
||||
|
||||
private AndroidJavaObject getDate(DateTime dateTime)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
return new AndroidJavaObject("java.util.Date", currentMillis);
|
||||
}
|
||||
|
||||
private void track(string eventName, string properties, DateTime dateTime)
|
||||
{
|
||||
AndroidJavaObject date = getDate(dateTime);
|
||||
AndroidJavaClass tzClass = new AndroidJavaClass("java.util.TimeZone");
|
||||
AndroidJavaObject tz = null;
|
||||
|
||||
if (token.timeZone == DataEyeAnalyticsAPI.TATimeZone.Local)
|
||||
{
|
||||
switch (dateTime.Kind)
|
||||
{
|
||||
case DateTimeKind.Local:
|
||||
tz = tzClass.CallStatic<AndroidJavaObject>("getDefault");
|
||||
break;
|
||||
case DateTimeKind.Utc:
|
||||
tz = tzClass.CallStatic<AndroidJavaObject>("getTimeZone", "UTC");
|
||||
break;
|
||||
case DateTimeKind.Unspecified:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tz = tzClass.CallStatic<AndroidJavaObject>("getTimeZone", token.getTimeZoneId());
|
||||
}
|
||||
|
||||
instance.Call("track", eventName, getJSONObject(properties), date, tz);
|
||||
}
|
||||
|
||||
private void track(DataEyeAnalyticsEvent taEvent)
|
||||
{
|
||||
AndroidJavaObject javaEvent = null;
|
||||
switch(taEvent.EventType)
|
||||
{
|
||||
case DataEyeAnalyticsEvent.Type.FIRST:
|
||||
javaEvent = new AndroidJavaObject("cn.dataeye.android.DataEyeFirstEvent",
|
||||
taEvent.EventName, getJSONObject(getFinalEventProperties(taEvent.Properties)));
|
||||
|
||||
string extraId = taEvent.ExtraId;
|
||||
if (!string.IsNullOrEmpty(extraId))
|
||||
{
|
||||
javaEvent.Call("setFirstCheckId", extraId);
|
||||
}
|
||||
|
||||
break;
|
||||
case DataEyeAnalyticsEvent.Type.UPDATABLE:
|
||||
javaEvent = new AndroidJavaObject("cn.dataeye.android.TDUpdatableEvent",
|
||||
taEvent.EventName, getJSONObject(getFinalEventProperties(taEvent.Properties)), taEvent.ExtraId);
|
||||
break;
|
||||
case DataEyeAnalyticsEvent.Type.OVERWRITABLE:
|
||||
javaEvent = new AndroidJavaObject("cn.dataeye.android.TDOverWritableEvent",
|
||||
taEvent.EventName, getJSONObject(getFinalEventProperties(taEvent.Properties)), taEvent.ExtraId);
|
||||
break;
|
||||
}
|
||||
if (null == javaEvent) {
|
||||
DE_Log.w("Unexpected java event object. Returning...");
|
||||
return;
|
||||
}
|
||||
|
||||
if (taEvent.EventTime != DateTime.MinValue) {
|
||||
AndroidJavaObject date = getDate(taEvent.EventTime);
|
||||
AndroidJavaClass tzClass = new AndroidJavaClass("java.util.TimeZone");
|
||||
AndroidJavaObject tz = null;
|
||||
|
||||
if (token.timeZone == DataEyeAnalyticsAPI.TATimeZone.Local)
|
||||
{
|
||||
switch (taEvent.EventTime.Kind)
|
||||
{
|
||||
case DateTimeKind.Local:
|
||||
tz = tzClass.CallStatic<AndroidJavaObject>("getDefault");
|
||||
break;
|
||||
case DateTimeKind.Utc:
|
||||
tz = tzClass.CallStatic<AndroidJavaObject>("getTimeZone", "UTC");
|
||||
break;
|
||||
case DateTimeKind.Unspecified:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tz = tzClass.CallStatic<AndroidJavaObject>("getTimeZone", token.getTimeZoneId());
|
||||
}
|
||||
javaEvent.Call("setEventTime", date, tz);
|
||||
}
|
||||
instance.Call("track", javaEvent);
|
||||
}
|
||||
|
||||
private void track(string eventName, string properties)
|
||||
{
|
||||
instance.Call("track", eventName, getJSONObject(properties));
|
||||
}
|
||||
|
||||
private void setSuperProperties(string superProperties)
|
||||
{
|
||||
instance.Call("setSuperProperties", getJSONObject(superProperties));
|
||||
}
|
||||
|
||||
private void unsetSuperProperty(string superPropertyName)
|
||||
{
|
||||
instance.Call("unsetSuperProperty", superPropertyName);
|
||||
}
|
||||
|
||||
private void clearSuperProperty()
|
||||
{
|
||||
instance.Call("clearSuperProperties");
|
||||
}
|
||||
|
||||
private Dictionary<string, object> getSuperProperties()
|
||||
{
|
||||
Dictionary<string, object> result = null;
|
||||
AndroidJavaObject superPropertyObject = instance.Call<AndroidJavaObject>("getSuperProperties");
|
||||
if (null != superPropertyObject)
|
||||
{
|
||||
string superPropertiesString = superPropertyObject.Call<string>("toString");
|
||||
result = DE_MiniJSON.Deserialize(superPropertiesString);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void timeEvent(string eventName)
|
||||
{
|
||||
instance.Call("timeEvent", eventName);
|
||||
}
|
||||
|
||||
private void identify(string uniqueId)
|
||||
{
|
||||
instance.Call("identify", uniqueId);
|
||||
}
|
||||
|
||||
private string getDistinctId()
|
||||
{
|
||||
return instance.Call<string>("getDistinctId");
|
||||
}
|
||||
|
||||
private void login(string uniqueId)
|
||||
{
|
||||
instance.Call("login", uniqueId);
|
||||
}
|
||||
|
||||
private void userSetOnce(string properties)
|
||||
{
|
||||
instance.Call("user_setOnce", getJSONObject(properties));
|
||||
}
|
||||
|
||||
private void userSetOnce(string properties, DateTime dateTime)
|
||||
{
|
||||
instance.Call("user_setOnce", getJSONObject(properties), getDate(dateTime));
|
||||
}
|
||||
|
||||
private void userSet(string properties)
|
||||
{
|
||||
instance.Call("user_set", getJSONObject(properties));
|
||||
}
|
||||
|
||||
private void userSet(string properties, DateTime dateTime)
|
||||
{
|
||||
instance.Call("user_set", getJSONObject(properties), getDate(dateTime));
|
||||
}
|
||||
|
||||
private void userUnset(List<string> properties)
|
||||
{
|
||||
instance.Call("user_unset", properties.ToArray());
|
||||
}
|
||||
|
||||
private void userUnset(List<string> properties, DateTime dateTime)
|
||||
{
|
||||
Dictionary<string, object> finalProperties = new Dictionary<string, object>();
|
||||
foreach(string s in properties)
|
||||
{
|
||||
finalProperties.Add(s, 0);
|
||||
}
|
||||
|
||||
instance.Call("user_unset", getJSONObject(DE_MiniJSON.Serialize(finalProperties)), getDate(dateTime));
|
||||
}
|
||||
|
||||
private void userAdd(string properties)
|
||||
{
|
||||
instance.Call("user_add", getJSONObject(properties));
|
||||
}
|
||||
|
||||
private void userAdd(string properties, DateTime dateTime)
|
||||
{
|
||||
instance.Call("user_add", getJSONObject(properties), getDate(dateTime));
|
||||
}
|
||||
|
||||
private void userAppend(string properties)
|
||||
{
|
||||
instance.Call("user_append", getJSONObject(properties));
|
||||
}
|
||||
|
||||
private void userAppend(string properties, DateTime dateTime)
|
||||
{
|
||||
instance.Call("user_append", getJSONObject(properties), getDate(dateTime));
|
||||
}
|
||||
|
||||
private void userDelete()
|
||||
{
|
||||
instance.Call("user_delete");
|
||||
}
|
||||
|
||||
private void userDelete(DateTime dateTime)
|
||||
{
|
||||
instance.Call("user_delete", getDate(dateTime));
|
||||
}
|
||||
|
||||
private void logout() {
|
||||
instance.Call("logout");
|
||||
}
|
||||
|
||||
private string getDeviceId()
|
||||
{
|
||||
return instance.Call<string>("getDeviceId");
|
||||
}
|
||||
|
||||
private void setNetworkType(DataEyeAnalyticsAPI.NetworkType networkType) {
|
||||
switch (networkType)
|
||||
{
|
||||
case DataEyeAnalyticsAPI.NetworkType.DEFAULT:
|
||||
instance.Call("setNetworkType", 0);
|
||||
break;
|
||||
case DataEyeAnalyticsAPI.NetworkType.WIFI:
|
||||
instance.Call("setNetworkType", 1);
|
||||
break;
|
||||
case DataEyeAnalyticsAPI.NetworkType.ALL:
|
||||
instance.Call("setNetworkType", 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void enableAutoTrack(AUTO_TRACK_EVENTS events)
|
||||
{
|
||||
instance.Call("enableAutoTrack", (int) events);
|
||||
}
|
||||
|
||||
private void optOutTracking()
|
||||
{
|
||||
instance.Call("optOutTracking");
|
||||
}
|
||||
|
||||
private void optOutTrackingAndDeleteUser()
|
||||
{
|
||||
instance.Call("optOutTrackingAndDeleteUser");
|
||||
}
|
||||
|
||||
private void optInTracking()
|
||||
{
|
||||
instance.Call("optInTracking");
|
||||
}
|
||||
|
||||
private void enableTracking(bool enabled)
|
||||
{
|
||||
instance.Call("enableTracking", enabled);
|
||||
}
|
||||
|
||||
private void setInstance(AndroidJavaObject anotherInstance)
|
||||
{
|
||||
this.instance = anotherInstance;
|
||||
}
|
||||
|
||||
private void enableEncrypt(bool enabled)
|
||||
{
|
||||
this.instance.Call("setEnableEncrypt", enabled);
|
||||
}
|
||||
|
||||
private DataEyeAnalyticsWrapper createLightInstance(DataEyeAnalyticsAPI.Token delegateToken)
|
||||
{
|
||||
DataEyeAnalyticsWrapper result = new DataEyeAnalyticsWrapper(delegateToken, false);
|
||||
AndroidJavaObject lightInstance = instance.Call<AndroidJavaObject>("createLightInstance");
|
||||
result.setInstance(lightInstance);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void calibrateTime(long timestamp)
|
||||
{
|
||||
sdkClass.CallStatic("calibrateTime", timestamp);
|
||||
}
|
||||
|
||||
private static void calibrateTimeWithNtp(string ntpServer)
|
||||
{
|
||||
sdkClass.CallStatic("calibrateTimeWithNtpForUnity", ntpServer);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7df398244984648ef9b2d6bd8d4c72ab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,213 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using DataEyeAnalytics.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace DataEyeAnalytics.Wrapper
|
||||
{
|
||||
public partial class DataEyeAnalyticsWrapper
|
||||
{
|
||||
#if (UNITY_STANDALONE || UNITY_EDITOR)
|
||||
private void init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void identify(string uniqueId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private string getDistinctId()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private void login(string accountId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void logout()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void flush()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private static void setVersionInfo(string lib_name, string lib_version) {
|
||||
|
||||
}
|
||||
|
||||
private void track(DataEyeAnalyticsEvent taEvent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void track(string eventName, string properties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void track(string eventName, string properties, DateTime dateTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void setSuperProperties(string superProperties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void unsetSuperProperty(string superPropertyName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void clearSuperProperty()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private Dictionary<string, object> getSuperProperties()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private void timeEvent(string eventName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userSet(string properties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userSet(string properties, DateTime dateTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userUnset(List<string> properties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userUnset(List<string> properties, DateTime dateTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userSetOnce(string properties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userSetOnce(string properties, DateTime dateTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userAdd(string properties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userAdd(string properties, DateTime dateTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userDelete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userDelete(DateTime dateTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userAppend(string properties)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void userAppend(string properties, DateTime dateTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void setNetworkType(DataEyeAnalyticsAPI.NetworkType networkType)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private string getDeviceId()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private void optOutTracking()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void optOutTrackingAndDeleteUser()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void optInTracking()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void enableTracking(bool enabled)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void enableEncrypt(bool enabled)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private DataEyeAnalyticsWrapper createLightInstance(DataEyeAnalyticsAPI.Token delegateToken)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private string getTimeString(DateTime dateTime)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private void enableAutoTrack(AUTO_TRACK_EVENTS autoTrackEvents)
|
||||
{
|
||||
|
||||
}
|
||||
private static void enable_log(bool enableLog)
|
||||
{
|
||||
|
||||
}
|
||||
private static void calibrateTime(long timestamp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private static void calibrateTimeWithNtp(string ntpServer)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e59d0a3c993b4cc3aca983df234b3aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,485 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DataEyeAnalytics.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DataEyeAnalytics.Wrapper
|
||||
{
|
||||
public partial class DataEyeAnalyticsWrapper
|
||||
{
|
||||
#if (!(UNITY_EDITOR || UNITY_IOS || UNITY_ANDROID|| UNITY_STANDALONE))
|
||||
private string uniqueId;
|
||||
private void init()
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - Thanks for using DataEyeAnalytics SDK for tracking data.");
|
||||
}
|
||||
private static void enable_log(bool enableLog)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper - calling enable_log with enableLog: " + enableLog);
|
||||
}
|
||||
|
||||
public static void setVersionInfo(string libName, string version) {
|
||||
|
||||
}
|
||||
|
||||
private void identify(string uniqueId)
|
||||
{
|
||||
this.uniqueId = uniqueId;
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling Identify with uniqueId: " + uniqueId);
|
||||
}
|
||||
private string getDistinctId()
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling GetDistinctId with return value: " + this.uniqueId);
|
||||
return this.uniqueId;
|
||||
}
|
||||
|
||||
private void login(string accountId)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling Login with accountId: " + accountId);
|
||||
}
|
||||
|
||||
private void logout()
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling Logout");
|
||||
}
|
||||
|
||||
private void track(string eventName, string properties)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling track with eventName: " + eventName + ", " +
|
||||
"properties: " + properties);
|
||||
}
|
||||
|
||||
private void track(string eventName, string properties, DateTime datetime)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling track with eventName: " + eventName + ", " +
|
||||
"properties: " + properties + ", " +
|
||||
"dateTime: " + datetime.ToString());
|
||||
}
|
||||
|
||||
private void track(DataEyeAnalyticsEvent analyticsEvent)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling track with eventName: " + analyticsEvent.EventName + ", " +
|
||||
"properties: " + getFinalEventProperties(analyticsEvent.Properties));
|
||||
|
||||
}
|
||||
|
||||
private void setSuperProperties(string superProperties)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling setSuperProperties with superProperties: " + DE_MiniJSON.Serialize(superProperties));
|
||||
}
|
||||
|
||||
private void unsetSuperProperty(string superPropertyName)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling unsetSuperProperties with superPropertyName: " + superPropertyName);
|
||||
|
||||
}
|
||||
private void clearSuperProperty()
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling clearSuperProperties");
|
||||
}
|
||||
|
||||
private Dictionary<string, object> getSuperProperties()
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling getSuperProperties");
|
||||
return null;
|
||||
}
|
||||
private void timeEvent(string eventName)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling timeEvent with eventName: " + eventName);
|
||||
}
|
||||
|
||||
private void userSet(string properties)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userSet with properties: " + DE_MiniJSON.Serialize(properties));
|
||||
}
|
||||
|
||||
private void userSet(string properties, DateTime dateTime)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userSet with properties: " + DE_MiniJSON.Serialize(properties)
|
||||
+ ", dateTime: " + dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
}
|
||||
private void userSetOnce(string properties)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userSetOnce with properties: " + DE_MiniJSON.Serialize(properties));
|
||||
}
|
||||
|
||||
private void userSetOnce(string properties, DateTime dateTime)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userSetOnce with properties: " + DE_MiniJSON.Serialize(properties)
|
||||
+ ", dateTime: " + dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
}
|
||||
|
||||
private void userUnset(List<string> properties)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userUnset with properties: " + string.Join(", ", properties.ToArray()));
|
||||
}
|
||||
|
||||
private void userUnset(List<string> properties, DateTime dateTime)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userUnset with properties: " + string.Join(", ", properties.ToArray())
|
||||
+ ", dateTime: " + dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
}
|
||||
|
||||
private void userAdd(string properties)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userAdd with properties: " + DE_MiniJSON.Serialize(properties));
|
||||
}
|
||||
|
||||
private void userAdd(string properties, DateTime dateTime)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userAdd with properties: " + DE_MiniJSON.Serialize(properties)
|
||||
+ ", dateTime: " + dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
}
|
||||
|
||||
private void userAppend(string properties)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userAppend with properties: " + DE_MiniJSON.Serialize(properties));
|
||||
}
|
||||
|
||||
private void userAppend(string properties, DateTime dateTime)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userAppend with properties: " + DE_MiniJSON.Serialize(properties)
|
||||
+ ", dateTime: " + dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
}
|
||||
|
||||
private void userDelete()
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userDelete");
|
||||
}
|
||||
|
||||
private void userDelete(DateTime dateTime)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling userDelete" + ", dateTime: " + dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
}
|
||||
|
||||
private void flush()
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling flush.");
|
||||
}
|
||||
|
||||
private void enableAutoTrack(AUTO_TRACK_EVENTS events)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling enableAutoTrack: " + events.ToString());
|
||||
}
|
||||
private void setNetworkType(DataEyeAnalyticsAPI.NetworkType networkType)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling setNetworkType with networkType: " + (int)networkType);
|
||||
}
|
||||
|
||||
private string getDeviceId() {
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling getDeviceId()");
|
||||
return "editor device id";
|
||||
}
|
||||
|
||||
private void optOutTracking()
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling optOutTracking()");
|
||||
}
|
||||
|
||||
private void optOutTrackingAndDeleteUser()
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling optOutTrackingAndDeleteUser()");
|
||||
}
|
||||
|
||||
private void optInTracking()
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling optInTracking()");
|
||||
}
|
||||
|
||||
private void enableTracking(bool enabled)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling enableTracking() with enabled: " + enabled);
|
||||
}
|
||||
|
||||
private DataEyeAnalyticsWrapper createLightInstance(DataEyeAnalyticsAPI.Token delegateToken)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - calling createLightInstance()");
|
||||
return new DataEyeAnalyticsWrapper(delegateToken, false);
|
||||
}
|
||||
|
||||
private string getTimeString(DateTime dateTime) {
|
||||
return dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
}
|
||||
|
||||
private static void calibrateTime(long timestamp)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper: - calling calibrateTime() with: " + timestamp);
|
||||
}
|
||||
|
||||
private static void calibrateTimeWithNtp(string ntpServer)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper: - calling calibrateTimeWithNtp() with: " + ntpServer);
|
||||
}
|
||||
|
||||
private void EnableEncrypt(bool enabled)
|
||||
{
|
||||
DE_Log.d("TA.Wrapper: - calling setEnableEncrypt() with: " + enabled);
|
||||
}
|
||||
|
||||
#endif
|
||||
public readonly DataEyeAnalyticsAPI.Token token;
|
||||
private IDynamicSuperProperties dynamicSuperProperties;
|
||||
|
||||
private static System.Random rnd = new System.Random();
|
||||
|
||||
private string serilize<T>(Dictionary<string, T> data) {
|
||||
return DE_MiniJSON.Serialize(data, getTimeString);
|
||||
}
|
||||
|
||||
public DataEyeAnalyticsWrapper(DataEyeAnalyticsAPI.Token token, bool initRequired = true)
|
||||
{
|
||||
this.token = token;
|
||||
if (initRequired) init();
|
||||
}
|
||||
|
||||
public static void EnableLog(bool enableLog)
|
||||
{
|
||||
enable_log(enableLog);
|
||||
}
|
||||
|
||||
public static void SetVersionInfo(string version)
|
||||
{
|
||||
setVersionInfo("Unity", version);
|
||||
}
|
||||
|
||||
public void Identify(string uniqueId)
|
||||
{
|
||||
identify(uniqueId);
|
||||
}
|
||||
|
||||
public string GetDistinctId()
|
||||
{
|
||||
return getDistinctId();
|
||||
}
|
||||
|
||||
public void Login(string accountId)
|
||||
{
|
||||
login(accountId);
|
||||
}
|
||||
|
||||
public void Logout()
|
||||
{
|
||||
logout();
|
||||
}
|
||||
|
||||
public void EnableAutoTrack(AUTO_TRACK_EVENTS events)
|
||||
{
|
||||
enableAutoTrack(events);
|
||||
}
|
||||
|
||||
private string getFinalEventProperties(Dictionary<string, object> properties)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperties(properties);
|
||||
|
||||
if (null != dynamicSuperProperties)
|
||||
{
|
||||
Dictionary<string, object> finalProperties = new Dictionary<string, object>();
|
||||
DE_PropertiesChecker.MergeProperties(dynamicSuperProperties.GetDynamicSuperProperties(), finalProperties);
|
||||
DE_PropertiesChecker.MergeProperties(properties, finalProperties);
|
||||
return serilize(finalProperties);
|
||||
}
|
||||
else
|
||||
{
|
||||
return serilize(properties);
|
||||
}
|
||||
|
||||
}
|
||||
public void Track(string eventName, Dictionary<string, object> properties)
|
||||
{
|
||||
DE_PropertiesChecker.CheckString(eventName);
|
||||
track(eventName, getFinalEventProperties(properties));
|
||||
}
|
||||
|
||||
public void Track(string eventName, Dictionary<string, object> properties, DateTime datetime)
|
||||
{
|
||||
DE_PropertiesChecker.CheckString(eventName);
|
||||
track(eventName, getFinalEventProperties(properties), datetime);
|
||||
}
|
||||
|
||||
public void Track(DataEyeAnalyticsEvent taEvent)
|
||||
{
|
||||
if (null == taEvent || null == taEvent.EventType)
|
||||
{
|
||||
DE_Log.w("Ignoring invalid TA event");
|
||||
return;
|
||||
}
|
||||
|
||||
if (taEvent.EventTime == null)
|
||||
{
|
||||
DE_Log.w("ppp null...");
|
||||
}
|
||||
DE_PropertiesChecker.CheckString(taEvent.EventName);
|
||||
DE_PropertiesChecker.CheckProperties(taEvent.Properties);
|
||||
track(taEvent);
|
||||
}
|
||||
|
||||
public void SetSuperProperties(Dictionary<string, object> superProperties)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperties(superProperties);
|
||||
setSuperProperties(serilize(superProperties));
|
||||
}
|
||||
|
||||
public void UnsetSuperProperty(string superPropertyName)
|
||||
{
|
||||
DE_PropertiesChecker.CheckString(superPropertyName);
|
||||
unsetSuperProperty(superPropertyName);
|
||||
}
|
||||
|
||||
public void ClearSuperProperty()
|
||||
{
|
||||
clearSuperProperty();
|
||||
}
|
||||
|
||||
|
||||
public void TimeEvent(string eventName)
|
||||
{
|
||||
DE_PropertiesChecker.CheckString(eventName);
|
||||
timeEvent(eventName);
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetSuperProperties()
|
||||
{
|
||||
return getSuperProperties();
|
||||
}
|
||||
|
||||
public void UserSet(Dictionary<string, object> properties)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperties(properties);
|
||||
userSet(serilize(properties));
|
||||
}
|
||||
|
||||
public void UserSet(Dictionary<string, object> properties, DateTime dateTime)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperties(properties);
|
||||
userSet(serilize(properties), dateTime);
|
||||
}
|
||||
|
||||
public void UserSetOnce(Dictionary<string, object> properties)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperties(properties);
|
||||
userSetOnce(serilize(properties));
|
||||
}
|
||||
|
||||
public void UserSetOnce(Dictionary<string, object> properties, DateTime dateTime)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperties(properties);
|
||||
userSetOnce(serilize(properties), dateTime);
|
||||
}
|
||||
|
||||
public void UserUnset(List<string> properties)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperteis(properties);
|
||||
userUnset(properties);
|
||||
}
|
||||
|
||||
public void UserUnset(List<string> properties, DateTime dateTime)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperteis(properties);
|
||||
userUnset(properties, dateTime);
|
||||
}
|
||||
|
||||
public void UserAdd(Dictionary<string, object> properties)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperties(properties);
|
||||
userAdd(serilize(properties));
|
||||
}
|
||||
|
||||
public void UserAdd(Dictionary<string, object> properties, DateTime dateTime)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperties(properties);
|
||||
userAdd(serilize(properties), dateTime);
|
||||
}
|
||||
|
||||
public void UserAppend(Dictionary<string, object> properties)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperties(properties);
|
||||
userAppend(serilize(properties));
|
||||
}
|
||||
|
||||
public void UserAppend(Dictionary<string, object> properties, DateTime dateTime)
|
||||
{
|
||||
DE_PropertiesChecker.CheckProperties(properties);
|
||||
userAppend(serilize(properties), dateTime);
|
||||
}
|
||||
|
||||
public void UserDelete()
|
||||
{
|
||||
userDelete();
|
||||
}
|
||||
|
||||
public void UserDelete(DateTime dateTime)
|
||||
{
|
||||
userDelete(dateTime);
|
||||
}
|
||||
|
||||
public void Flush()
|
||||
{
|
||||
flush();
|
||||
}
|
||||
|
||||
public void SetNetworkType(DataEyeAnalyticsAPI.NetworkType networkType)
|
||||
{
|
||||
setNetworkType(networkType);
|
||||
}
|
||||
|
||||
public string GetDeviceId()
|
||||
{
|
||||
return getDeviceId();
|
||||
}
|
||||
|
||||
public void SetDynamicSuperProperties(IDynamicSuperProperties dynamicSuperProperties)
|
||||
{
|
||||
if (!DE_PropertiesChecker.CheckProperties(dynamicSuperProperties.GetDynamicSuperProperties()))
|
||||
{
|
||||
DE_Log.d("TA.Wrapper(" + token.appid + ") - Cannot set dynamic super properties due to invalid properties.");
|
||||
}
|
||||
this.dynamicSuperProperties = dynamicSuperProperties;
|
||||
}
|
||||
|
||||
public void OptOutTracking()
|
||||
{
|
||||
optOutTracking();
|
||||
}
|
||||
|
||||
public void OptOutTrackingAndDeleteUser()
|
||||
{
|
||||
optOutTrackingAndDeleteUser();
|
||||
}
|
||||
|
||||
public void OptInTracking()
|
||||
{
|
||||
optInTracking();
|
||||
}
|
||||
|
||||
public void EnableTracking(bool enabled)
|
||||
{
|
||||
enableTracking(enabled);
|
||||
}
|
||||
|
||||
public void EnableEncrypt(bool enabled)
|
||||
{
|
||||
enableEncrypt(enabled);
|
||||
}
|
||||
|
||||
public DataEyeAnalyticsWrapper CreateLightInstance()
|
||||
{
|
||||
return createLightInstance(new DataEyeAnalyticsAPI.Token(rnd.Next().ToString(), token.serverUrl, token.mode, token.timeZone, token.reyunAppID, token.timeZoneId));
|
||||
}
|
||||
|
||||
internal string GetAppId()
|
||||
{
|
||||
return token.appid;
|
||||
}
|
||||
|
||||
public static void CalibrateTime(long timestamp)
|
||||
{
|
||||
calibrateTime(timestamp);
|
||||
}
|
||||
|
||||
public static void CalibrateTimeWithNtp(string ntpServer)
|
||||
{
|
||||
calibrateTimeWithNtp(ntpServer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49eb9ec132b9c419a870fc8af51a60ef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,381 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using DataEyeAnalytics.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DataEyeAnalytics.Wrapper
|
||||
{
|
||||
public partial class DataEyeAnalyticsWrapper
|
||||
{
|
||||
#if UNITY_IOS && !(UNITY_EDITOR)
|
||||
[DllImport("__Internal")]
|
||||
private static extern void start(string app_id, string server_url, int mode, string timeZoneId);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void identify(string app_id, string unique_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern string get_distinct_id(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void login(string app_id, string account_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void logout(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void track(string app_id, string event_name, string properties, long time_stamp_millis, string timezone);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void track_event(string app_id, string event_string);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void set_super_properties(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void unset_super_property(string app_id, string property_name);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void clear_super_properties(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern string get_super_properties(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void time_event(string app_id, string event_name);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_set(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_set_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_unset(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_unset_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_set_once(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_set_once_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_add(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_add_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_delete(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_delete_with_time(string app_id, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_append(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void user_append_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void flush(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void set_network_type(int type);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void enable_log(bool is_enable);
|
||||
[DllImport("__Internal")]
|
||||
private static extern string get_device_id();
|
||||
[DllImport("__Internal")]
|
||||
private static extern void enable_tracking(string app_id, bool enabled);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void opt_out_tracking(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void opt_out_tracking_and_delete_user(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void opt_in_tracking(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void create_light_instance(string app_id, string delegate_token);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void enable_autoTrack(string app_id, int events);
|
||||
[DllImport("__Internal")]
|
||||
private static extern string get_time_string(string app_id, long events);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void calibrate_time(long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void calibrate_time_with_ntp(string ntpServer);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void config_custom_lib_info(string lib_name, string lib_version);
|
||||
|
||||
private void init()
|
||||
{
|
||||
start(token.appid, token.serverUrl, (int)token.mode, token.getTimeZoneId());
|
||||
}
|
||||
|
||||
private void identify(string uniqueId)
|
||||
{
|
||||
identify(token.appid, uniqueId);
|
||||
}
|
||||
|
||||
private string getDistinctId()
|
||||
{
|
||||
return get_distinct_id(token.appid);
|
||||
}
|
||||
|
||||
private void login(string accountId)
|
||||
{
|
||||
login(token.appid, accountId);
|
||||
}
|
||||
|
||||
private void logout()
|
||||
{
|
||||
logout(token.appid);
|
||||
}
|
||||
|
||||
private void flush()
|
||||
{
|
||||
flush(token.appid);
|
||||
}
|
||||
|
||||
private static void setVersionInfo(string lib_name, string lib_version) {
|
||||
config_custom_lib_info(lib_name, lib_version);
|
||||
}
|
||||
|
||||
private void track(ThinkingAnalyticsEvent taEvent)
|
||||
{
|
||||
Dictionary<string, object> finalEvent = new Dictionary<string, object>();
|
||||
string extraId = taEvent.ExtraId;
|
||||
switch (taEvent.EventType)
|
||||
{
|
||||
case ThinkingAnalyticsEvent.Type.FIRST:
|
||||
finalEvent["event_type"] = "track_first";
|
||||
break;
|
||||
case ThinkingAnalyticsEvent.Type.UPDATABLE:
|
||||
finalEvent["event_type"] = "track_update";
|
||||
break;
|
||||
case ThinkingAnalyticsEvent.Type.OVERWRITABLE:
|
||||
finalEvent["event_type"] = "track_overwrite";
|
||||
break;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(extraId))
|
||||
{
|
||||
finalEvent["extra_id"] = extraId;
|
||||
}
|
||||
|
||||
finalEvent["event_name"] = taEvent.EventName;
|
||||
finalEvent["event_properties"] = taEvent.Properties;
|
||||
|
||||
if (taEvent.EventTime != DateTime.MinValue)
|
||||
{
|
||||
finalEvent["event_time"] = taEvent.EventTime;
|
||||
if (token.timeZone == ThinkingAnalyticsAPI.TATimeZone.Local)
|
||||
{
|
||||
switch (taEvent.EventTime.Kind)
|
||||
{
|
||||
case DateTimeKind.Local:
|
||||
finalEvent["event_timezone"] = "Local";
|
||||
break;
|
||||
case DateTimeKind.Utc:
|
||||
finalEvent["event_timezone"] = "UTC";
|
||||
break;
|
||||
case DateTimeKind.Unspecified:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
track_event(token.appid, serilize(finalEvent));
|
||||
}
|
||||
|
||||
private void track(string eventName, string properties)
|
||||
{
|
||||
track(token.appid, eventName, properties, 0, "");
|
||||
}
|
||||
|
||||
private void track(string eventName, string properties, DateTime dateTime)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
|
||||
string tz = "";
|
||||
if (token.timeZone == ThinkingAnalyticsAPI.TATimeZone.Local)
|
||||
{
|
||||
switch(dateTime.Kind)
|
||||
{
|
||||
case DateTimeKind.Local:
|
||||
tz = "Local";
|
||||
break;
|
||||
case DateTimeKind.Utc:
|
||||
tz = "UTC";
|
||||
break;
|
||||
case DateTimeKind.Unspecified:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tz = token.getTimeZoneId();
|
||||
}
|
||||
|
||||
track(token.appid, eventName, properties, currentMillis, tz);
|
||||
}
|
||||
|
||||
private void setSuperProperties(string superProperties)
|
||||
{
|
||||
set_super_properties(token.appid, superProperties);
|
||||
}
|
||||
|
||||
private void unsetSuperProperty(string superPropertyName)
|
||||
{
|
||||
unset_super_property(token.appid, superPropertyName);
|
||||
}
|
||||
|
||||
private void clearSuperProperty()
|
||||
{
|
||||
clear_super_properties(token.appid);
|
||||
}
|
||||
|
||||
private Dictionary<string, object> getSuperProperties()
|
||||
{
|
||||
string superPropertiesString = get_super_properties(token.appid);
|
||||
return TD_MiniJSON.Deserialize(superPropertiesString);
|
||||
}
|
||||
|
||||
private void timeEvent(string eventName)
|
||||
{
|
||||
time_event(token.appid, eventName);
|
||||
}
|
||||
|
||||
private void userSet(string properties)
|
||||
{
|
||||
user_set(token.appid, properties);
|
||||
}
|
||||
|
||||
private void userSet(string properties, DateTime dateTime)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
user_set_with_time(token.appid, properties, currentMillis);
|
||||
}
|
||||
|
||||
private void userUnset(List<string> properties)
|
||||
{
|
||||
foreach (string property in properties)
|
||||
{
|
||||
user_unset(token.appid, property);
|
||||
}
|
||||
}
|
||||
|
||||
private void userUnset(List<string> properties, DateTime dateTime)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
foreach (string property in properties)
|
||||
{
|
||||
user_unset_with_time(token.appid, property, currentMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private void userSetOnce(string properties)
|
||||
{
|
||||
user_set_once(token.appid, properties);
|
||||
}
|
||||
|
||||
private void userSetOnce(string properties, DateTime dateTime)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
user_set_once_with_time(token.appid, properties, currentMillis);
|
||||
}
|
||||
|
||||
private void userAdd(string properties)
|
||||
{
|
||||
user_add(token.appid, properties);
|
||||
}
|
||||
|
||||
private void userAdd(string properties, DateTime dateTime)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
user_add_with_time(token.appid, properties, currentMillis);
|
||||
}
|
||||
|
||||
private void userDelete()
|
||||
{
|
||||
user_delete(token.appid);
|
||||
}
|
||||
|
||||
private void userDelete(DateTime dateTime)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
user_delete_with_time(token.appid, currentMillis);
|
||||
}
|
||||
|
||||
private void userAppend(string properties)
|
||||
{
|
||||
user_append(token.appid, properties);
|
||||
}
|
||||
|
||||
private void userAppend(string properties, DateTime dateTime)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
user_append_with_time(token.appid, properties, currentMillis);
|
||||
}
|
||||
|
||||
private void setNetworkType(ThinkingAnalyticsAPI.NetworkType networkType)
|
||||
{
|
||||
set_network_type((int)networkType);
|
||||
}
|
||||
|
||||
private string getDeviceId()
|
||||
{
|
||||
return get_device_id();
|
||||
}
|
||||
|
||||
private void optOutTracking()
|
||||
{
|
||||
opt_out_tracking(token.appid);
|
||||
}
|
||||
|
||||
private void optOutTrackingAndDeleteUser()
|
||||
{
|
||||
opt_out_tracking_and_delete_user(token.appid);
|
||||
}
|
||||
|
||||
private void optInTracking()
|
||||
{
|
||||
opt_in_tracking(token.appid);
|
||||
}
|
||||
|
||||
private void enableTracking(bool enabled)
|
||||
{
|
||||
enable_tracking(token.appid, enabled);
|
||||
}
|
||||
|
||||
private void enableEncrypt(bool enabled)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private DataEyeAnalyticsWrapper createLightInstance(ThinkingAnalyticsAPI.Token delegateToken)
|
||||
{
|
||||
create_light_instance(token.appid, delegateToken.appid);
|
||||
return new DataEyeAnalyticsWrapper(delegateToken, false);
|
||||
}
|
||||
|
||||
private string getTimeString(DateTime dateTime)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
return get_time_string(token.appid, currentMillis);
|
||||
}
|
||||
|
||||
private void enableAutoTrack(AUTO_TRACK_EVENTS autoTrackEvents)
|
||||
{
|
||||
enable_autoTrack(token.appid, (int)autoTrackEvents);
|
||||
}
|
||||
|
||||
private static void calibrateTime(long timestamp)
|
||||
{
|
||||
calibrate_time(timestamp);
|
||||
}
|
||||
|
||||
private static void calibrateTimeWithNtp(string ntpServer)
|
||||
{
|
||||
calibrate_time_with_ntp(ntpServer);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c2465b793e664be2b03c8a225455ca5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user