|
|
@@ -1,104 +0,0 @@
|
|
|
-using System.Collections.Generic;
|
|
|
-using Fort23.UTool;
|
|
|
-using UnityEngine;
|
|
|
-using Utility;
|
|
|
-
|
|
|
-
|
|
|
-public class TalkingDataManager : Singleton<TalkingDataManager>
|
|
|
-{
|
|
|
- private string appID = "965461C1FE104336864EF6D7EBABC2A7";
|
|
|
-
|
|
|
-#if Taptap
|
|
|
- private string channelID = "Taptap_Android";
|
|
|
-#elif HaoYouKuaiBao
|
|
|
- private string channelID = "好友快报_Android";
|
|
|
-#elif Google
|
|
|
- private string channelID = "Google_Android";
|
|
|
-#else
|
|
|
- private string channelID = "Unity_Android";
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
- private bool isInitialized = false;
|
|
|
-
|
|
|
-
|
|
|
- public void CustomInit()
|
|
|
- {
|
|
|
- InitializeTalkingData();
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 初始化TalkingData SDK
|
|
|
- /// </summary>
|
|
|
- public void InitializeTalkingData()
|
|
|
- {
|
|
|
- if (isInitialized) return;
|
|
|
-
|
|
|
- try
|
|
|
- {
|
|
|
- // TalkingDataSDKConfig config = TalkingDataSDKConfig.CreateConfig();
|
|
|
- // config.SetIMEIAndMEIDEnabled(true) //不允许收集IMEI和MEID
|
|
|
- // .SetMACEnabled(true) //不允许收集MAC
|
|
|
- // .SetAppListEnabled(true) //不允许收集应用列表
|
|
|
- // .SetLocationEnabled(true) //不允许收集位置信息
|
|
|
- // .SetWifiEnabled(true); //不允许收集网络信息
|
|
|
-
|
|
|
- // TalkingDataSDK.SetConfig(config);
|
|
|
- TalkingDataSDK.BackgroundSessionEnabled();
|
|
|
- TalkingDataSDK.InitSDK(appID, channelID, "");
|
|
|
- TalkingDataSDK.StartA();
|
|
|
- isInitialized = true;
|
|
|
- LogTool.Log($"TalkingData 初始化成功 - AppID: {appID}, Channel: {channelID}");
|
|
|
- }
|
|
|
- catch (System.Exception e)
|
|
|
- {
|
|
|
- LogTool.Error($"TalkingData 初始化失败: {e.Message}");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 账户登录
|
|
|
- /// </summary>
|
|
|
- public void OnLogin()
|
|
|
- {
|
|
|
- if (!isInitialized) return;
|
|
|
-
|
|
|
- try
|
|
|
- {
|
|
|
- TalkingDataProfile profile = TalkingDataProfile.CreateProfile();
|
|
|
- profile.SetName(PlayerManager.Instance.PlayerName);
|
|
|
- profile.SetType(TalkingDataProfileType.TYPE1);
|
|
|
- profile.SetGender(TalkingDataGender.UNKNOWN);
|
|
|
- Dictionary<string, object> eventValue = new Dictionary<string, object>
|
|
|
- {
|
|
|
- };
|
|
|
- TalkingDataSDK.OnLogin(PlayerManager.Instance.PlayerName, profile, eventValue);
|
|
|
-
|
|
|
- LogTool.Log($"TalkingData 设置账户: {PlayerManager.Instance.PlayerName}");
|
|
|
- }
|
|
|
- catch (System.Exception e)
|
|
|
- {
|
|
|
- LogTool.Error($"TalkingData 设置账户失败: {e.Message}");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 记录自定义事件
|
|
|
- /// </summary>
|
|
|
- public void TrackEvent(string eventID, Dictionary<string, object> parameters,
|
|
|
- Dictionary<string, object> eventValue = null)
|
|
|
- {
|
|
|
- if (!isInitialized) return;
|
|
|
-
|
|
|
- try
|
|
|
- {
|
|
|
- TalkingDataSDK.OnEvent(eventID, parameters, eventValue);
|
|
|
- LogTool.Log($"TalkingData 记录事件: {eventID} ");
|
|
|
- }
|
|
|
- catch (System.Exception e)
|
|
|
- {
|
|
|
- LogTool.Error($"TalkingData 记录事件失败: {e.Message}");
|
|
|
- }
|
|
|
- }
|
|
|
-}
|