From 95271aaa9877f3dd8b7c560f234d7f0c0d2426bb Mon Sep 17 00:00:00 2001 From: huyufei Date: Thu, 1 Aug 2024 12:44:47 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=20=E8=B0=83=E6=95=B4=20Firebase?= =?UTF-8?q?Login=20=E5=90=8E=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E7=9A=84=E5=B1=9E=E6=80=A7=E4=B8=8A=E6=8A=A5=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyufei --- Runtime/GuruCore/Runtime/Analytics/Analytics.Const.cs | 2 ++ Runtime/GuruCore/Runtime/Analytics/Analytics.Custom.cs | 10 ++-------- Runtime/GuruCore/Runtime/Analytics/Analytics.cs | 5 +---- Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Auth.cs | 1 + 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Runtime/GuruCore/Runtime/Analytics/Analytics.Const.cs b/Runtime/GuruCore/Runtime/Analytics/Analytics.Const.cs index 26c0acd..84ecb66 100644 --- a/Runtime/GuruCore/Runtime/Analytics/Analytics.Const.cs +++ b/Runtime/GuruCore/Runtime/Analytics/Analytics.Const.cs @@ -125,6 +125,8 @@ namespace Guru public const string PropertyNoAds = "no_ads"; // 玩家是否去广告 public const string PropertyATTStatus = "att_status"; // ATT 状态 public const string PropertyGDPR = "gdpr"; // GDPR状态 + public const string PropertySignUpMethod = "sign_up_method"; // 用户登录方式 + // 经济相关 public const string ParameterBalance = "balance"; // 用于余额 diff --git a/Runtime/GuruCore/Runtime/Analytics/Analytics.Custom.cs b/Runtime/GuruCore/Runtime/Analytics/Analytics.Custom.cs index 29c9f77..f0aca6c 100644 --- a/Runtime/GuruCore/Runtime/Analytics/Analytics.Custom.cs +++ b/Runtime/GuruCore/Runtime/Analytics/Analytics.Custom.cs @@ -22,8 +22,7 @@ namespace Guru // private const string VALUE_NOT_FOR_IOS = "not_support_for_ios"; // private const string VALUE_ONLY_FOR_IOS = "idfa_only_for_ios"; - - private static bool IsDebug { get; set; } = false; + private static bool _isGuruAnalyticInitOnce = false; public static void InitGuruAnalyticService(string firebaseId) @@ -33,11 +32,6 @@ namespace Guru try { -#if UNITY_EDITOR - IsDebug = true; -#else - IsDebug = initConfig.isDebug; -#endif string appId = IPMConfig.IPM_X_APP_ID; string deviceInfo = new DeviceInfoData().ToString(); @@ -54,7 +48,7 @@ namespace Guru GuruAnalytics.Init(appId, deviceInfo, () => { - SetUserProperty(GuruAnalyticsConfig.KEY_GURU_ANALYTICS_EXP, GuruAnalytics.Instance.ExpGroupId); + SetUserProperty(GuruAnalyticsConfigManager.KEY_GURU_ANALYTICS_EXP, GuruAnalytics.Instance.ExperimentGroupId); OnGuruAnalyticsInitComplete(); }, IsDebug); // Android 初始化 UpdateAllUserProperties(); diff --git a/Runtime/GuruCore/Runtime/Analytics/Analytics.cs b/Runtime/GuruCore/Runtime/Analytics/Analytics.cs index b4bbcd0..ac0e712 100644 --- a/Runtime/GuruCore/Runtime/Analytics/Analytics.cs +++ b/Runtime/GuruCore/Runtime/Analytics/Analytics.cs @@ -45,7 +45,7 @@ namespace Guru private static bool _isInitOnce; //Analytics是否初始化完成 public static bool EnableDebugAnalytics; //允许Debug包上报打点 - public static bool IsDebugMode => PlatformUtil.IsDebug(); + private static bool IsDebug => PlatformUtil.IsDebug(); private static bool IsFirebaseReady => FirebaseUtil.IsFirebaseInitialized; private static AdjustEventDriver _adjustEventDriver; @@ -83,7 +83,6 @@ namespace Guru FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0)); // --- 上报用户事件 --- - SetUserProperty(FirebaseAnalytics.UserPropertySignUpMethod, "Google"); SetUserProperty(PropertyDeviceID, IPMConfig.IPM_DEVICE_ID); // SetUserProperty(PropertyFirstOpenTime, FirstOpenTime); @@ -228,8 +227,6 @@ namespace Guru return; } - - if (eventSetting == null) eventSetting = DefaultEventSetting; var dataStr = ""; diff --git a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Auth.cs b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Auth.cs index 6ca3e39..3a65488 100644 --- a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Auth.cs +++ b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Auth.cs @@ -78,6 +78,7 @@ namespace Guru bool success = FirebaseUser != null; onLoginResult?.Invoke(success); _retryDelayTime = LOGIN_RETRY_INTERVAL; + Analytics.SetUserProperty(Analytics.PropertySignUpMethod, "google"); // 上报用户登录属性 }); }