Beispiel #1
0
    private static void AuthUpdateUser()
    {
        if (!setupReady)
        {
            return;
        }
        if (auth == null)
        {
            return;
        }

        Firebase.Auth.FirebaseUser user = auth.CurrentUser;
        if (user == null)
        {
            return;
        }

        userName  = user.DisplayName;
        userEmail = user.Email;

        SetUserId(user.UserId);

        FirebaseAnalytics.SetUserProperty("email", userEmail);
        FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLogin);
    }
 public void AnalyticsGroupJoin()
 {
     // Log an event with a string parameter.
     DebugLog("Logging a group join event.");
     FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventJoinGroup, FirebaseAnalytics.ParameterGroupId,
                                "spoon_welders");
 }
Beispiel #3
0
    // Email+pass+name
    // ref: https://firebase.google.com/docs/auth/unity/password-auth
    public static void AuthCreateUser(string email, string password)
    {
        if (!setupReady)
        {
            return;
        }
        if (authPhases == -1)
        {
            return;
        }
        lastError  = "";
        authPhases = -1;

        auth = Firebase.Auth.FirebaseAuth.DefaultInstance;

        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => {
            if (task.IsCanceled)
            {
                lastError  = task.Exception.ToString();
                authPhases = 0;
                return;
            }

            if (task.IsFaulted)
            {
                lastError  = task.Exception.InnerExceptions[0].InnerException.Message;
                authPhases = 0;
                //foreach (Exception ie in e.InnerExceptions)
                //    Console.WriteLine("{0}: {1}", ie.GetType().Name,
                //                      ie.Message);

                return;
            }

            Firebase.Auth.FirebaseUser user = auth.CurrentUser;
            if (user != null)
            {
                user.SendEmailVerificationAsync().ContinueWith(task2 => {
                    if (task2.IsCanceled)
                    {
                        lastError  = task2.Exception.ToString();
                        authPhases = 0;
                        return;
                    }
                    if (task2.IsFaulted)
                    {
                        lastError  = task2.Exception.InnerExceptions[0].InnerException.Message;
                        authPhases = 0;
                        return;
                    }

                    authPhases = 1;
                    FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventSignUp);
                    AuthUpdateUser();
                    // Debug.LogFormat("User signed in successfully: {0} ({1})", newUser.DisplayName, newUser.UserId);
                });
            }
        });
    }
Beispiel #4
0
 public static void LogEventLevelPlay(int level, int stage)
 {
     //Parameter[] _pamLevelPlay = {
     //        new Parameter(FirebaseAnalytics.ParameterLevel, level),
     //        new Parameter("level_stage", stage)
     //        };
     FirebaseAnalytics.LogEvent(EVENT_STAGE_PLAY + (stage + 1) + "_level_" + (level + 1) /*, _pamLevelPlay*/);
 }
Beispiel #5
0
    public static void LogScreen(string screenName)
    {
                #if analytics
        FirebaseAnalytics.LogEvent("screen_view", "", screenName);

        ProjectManager.Log("[Analytics ScreenView] " + screenName);
                #endif
    }
Beispiel #6
0
 public void LevelBegin(string levelID)
 {
     if (!m_Init)
     {
         return;
     }
     FirebaseAnalytics.LogEvent(DataAnalysisDefine.EVENTID_STARTLEVEL, "levelID", levelID);
 }
Beispiel #7
0
 public static void LogEventLevelComplete(int level, int stage)//6
 {
     //Parameter[] _pamLevelComplete = {
     //        new Parameter(FirebaseAnalytics.ParameterLevel, level),
     //        new Parameter("level_stage", stage)
     //        };
     FirebaseAnalytics.LogEvent("stage_complete_" + (stage + 1) + "_level_" + (level + 1) /*, _pamLevelComplete*/);
 }
Beispiel #8
0
    public static void LogEvent(string contentType, string itemID)
    {
#if USE_FIREBASE && (UNITY_ANDROID || UNITY_IOS)
        FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventSelectContent,
                                   new Parameter(FirebaseAnalytics.ParameterContentType, contentType),
                                   new Parameter(FirebaseAnalytics.ParameterItemId, itemID));
#endif
    }
 private void SendApplicationQuitData()
 {
     if (sendAnalytics == false)
     {
         return;
     }
     FirebaseAnalytics.LogEvent(AnalyticsManager.EventSessionEnd, AnalyticsManager.ParamGamesPlayed, AnalyticsManager.GamesPlayedThisSession);
 }
Beispiel #10
0
 private void LogEventReviewPosted()
 {
     if (IsFirebaseInited)
     {
         FirebaseAnalytics.LogEvent("review_posted");
     }
     Debug.Log("EVENT: review_posted");
 }
 private void AddBarTimeToList(float time)
 {
     if (sendAnalytics == false)
     {
         return;
     }
     FirebaseAnalytics.LogEvent(AnalyticsManager.EventBarPlaced, AnalyticsManager.ParamBarTime, time);
 }
Beispiel #12
0
 private void LogEventAd(string moment)
 {
     if (IsFirebaseInited)
     {
         FirebaseAnalytics.LogEvent("ad_watched", PARAM_AD_MOMENT, moment);
     }
     Debug.Log($"EVENT: ad_watched\n{PARAM_AD_MOMENT}: {moment}");
 }
Beispiel #13
0
 private void LogEventNotifChanged(bool isOn)
 {
     if (IsFirebaseInited)
     {
         FirebaseAnalytics.LogEvent("notif", PARAM_NOTIF_ENABLED, isOn ? "ON" : "OFF");
     }
     Debug.Log($"EVENT: notif\n{PARAM_NOTIF_ENABLED}: {(isOn ? "ON" : "OFF")}");
 }
Beispiel #14
0
        /// <summary>
        /// 记录没有参数的事件。
        /// </summary>
        public void AnalyticsLogin()
        {
            // Log an event with no parameters.
            DebugLog("登录事件。==Logging a login event.");
            FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLogin);

            FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventSelectContent, "dsdsd" + UnityEngine.Random.Range(0, 4000), UnityEngine.Random.Range(0, 4000));
        }
Beispiel #15
0
 private void LogEventTaskEnd(bool isDone)
 {
     if (IsFirebaseInited)
     {
         FirebaseAnalytics.LogEvent("task_end", PARAM_TASK_DONE, isDone ? "DONE" : "FAILED");
     }
     Debug.Log($"EVENT: task_end\n{PARAM_TASK_DONE}: {(isDone ? "DONE" : "FAILED")}");
 }
Beispiel #16
0
        void LOG_ONBOARDING_SWIPE(int position)
        {
            var bundle = new Bundle();

            bundle.PutInt("POSITION", position);
            bundle.PutString("TIMESTAMP", System.DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString());
            firebaseAnalytics.LogEvent("ONBOARDING_SWIPE", bundle);
        }
Beispiel #17
0
        /// <summary>
        /// 用字符串参数记录事件。
        /// </summary>
        public void AnalyticsGroupJoin()
        {
            // Log an event with a string parameter.
            DebugLog("记录组联接事件。==Logging a group join event.");
            FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventJoinGroup, FirebaseAnalytics.ParameterGroupId, "spoon_welders");

            FirebaseAnalytics.SetUserProperty("flghtNumber", "shas--" + UnityEngine.Random.Range(0, 4000));
        }
Beispiel #18
0
 public void CustomEvent(string eventID, string label = null)
 {
     if (!m_Init)
     {
         return;
     }
     FirebaseAnalytics.LogEvent(eventID, "description", label == null ? "" : label);
 }
Beispiel #19
0
        void LOG_EVENT_WITH_ACTION(string eventName, string action)
        {
            var bundle = new Bundle();

            bundle.PutString("ACTION", action);
            bundle.PutString("TIMESTAMP", System.DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString());
            firebaseAnalytics.LogEvent(eventName, bundle);
        }
    public static void ActivateAnalytics()
    {
#if UNITY_EDITOR
        Debug.Log("event sended");
#elif UNITY_IOS || UNITY_ANDROID
        FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLogin);
#endif
    }
        public static void UserLoginSignup(String signupMethod, Boolean isSignup = false)
        {
            var bundle = new Bundle();

            bundle.PutString(FirebaseAnalytics.Param.SignUpMethod, signupMethod);
            if (analytics == null)
            {
                analytics = FirebaseAnalytics.GetInstance(Application.Context);
            }
            if (isSignup)
            {
                analytics.LogEvent(FirebaseAnalytics.Event.SignUp, bundle);
            }
            else
            {
                analytics.LogEvent(FirebaseAnalytics.Event.Login, bundle);
            }
        }
    public static void LogEvent(string key)
    {
#if UNITY_EDITOR
        Debug.Log("event sended - " + key);
#elif UNITY_IOS || UNITY_ANDROID
        FirebaseAnalytics.LogEvent(key);
        Debug.Log("Sended log event - " + key);
#endif
    }
        private void SendProjectileFiredData(bool success)
        {
            if (sendAnalytics == false || success == false)
            {
                return;
            }

            FirebaseAnalytics.LogEvent(AnalyticsManager.EventProjectileFired);
        }
Beispiel #24
0
 public void SendStoryTutorialPassed()
 {
     if (_firebaseInitialized)
     {
         FirebaseAnalytics.LogEvent("story_tutorial_passed");
     }
     Analytics.CustomEvent("story_tutorial_passed");
     _amplitude.logEvent("story_tutorial_passed");
 }
Beispiel #25
0
 public void SendRollback()
 {
     if (_firebaseInitialized)
     {
         FirebaseAnalytics.LogEvent("rollback");
     }
     Analytics.CustomEvent("rollback");
     _amplitude.logEvent("rollback");
 }
    public static void LogPlayerLevel(int level)
    {
#if UNITY_EDITOR
        Debug.Log("event sended");
#elif UNITY_IOS || UNITY_ANDROID
        FirebaseAnalytics.LogEvent(FirebaseAnalytics.ParameterLevel, "reached level", level);
        Debug.Log("Sended log event - level: " + level);
#endif
    }
Beispiel #27
0
        public static void LogEvent(string eventName)
        {
            if (!FirebaseIsReady)
            {
                return;
            }

            FirebaseAnalytics.LogEvent(eventName);
        }
    public static void LogEvent(string key, string valueName, string value)
    {
#if UNITY_EDITOR
        Debug.Log("event sended - " + key);
#elif UNITY_IOS || UNITY_ANDROID
        FirebaseAnalytics.LogEvent(key, valueName, value);
        Debug.Log("Sended log event - " + key + " value name - " + valueName + " value - " + value);
#endif
    }
Beispiel #29
0
 public void AnalyticsScore()
 {
     // Log an event with an int parameter.
     DebugLog("Logging a post-score event.");
     FirebaseAnalytics.LogEvent(
         FirebaseAnalytics.EventPostScore,
         FirebaseAnalytics.ParameterScore,
         42);
 }
        public void LogEvent(string name, string parameterName, string parameterValue)
        {
            if (Status != ServiceStatus.Initialized)
            {
                return;
            }

            FirebaseAnalytics.LogEvent(name, parameterName, parameterValue);
        }