Beispiel #1
0
    protected override void Awake()
    {
        if (!SaveManager.Load(this))
        {
            Ts                = 0;
            ToTalPlayCount    = 0;
            totalCoinReward   = 0;
            totalTrailReward  = 0;
            totalCoinRewardx2 = 0;
        }
        today = DateTime.UtcNow.AddHours(9).ToString("yyyy-MM-dd");

        FirebaseAnalytics.SetSessionTimeoutDuration(TimeSpan.FromSeconds(60f));

        if (!PlayerPrefs.HasKey("first_version"))
        {
            PlayerPrefs.SetString("first_version", Application.version);
        }
        var firstVersion = PlayerPrefs.GetString("first_version", Application.version);

        FirebaseAnalytics.SetUserProperty("first_version", firstVersion);

        Application.RequestAdvertisingIdentifierAsync((string advertisingId, bool trackingEnabled, string error) =>
        {
            Debug.Log("advertisingId " + advertisingId + " " + trackingEnabled + " " + error);
            if (trackingEnabled)
            {
                FirebaseAnalytics.SetUserProperty("ad_id", advertisingId);
                this.advertisingId = advertisingId;
                Debug.Log("FirebaseEventLogger :: Ad id set");
            }
        });
    }
Beispiel #2
0
 private void subscribeToUserProperty <A>(string key, UniRx.IObservable <A> dimension)
 {
     dimension.DistinctUntilChanged().Subscribe(delegate(A d)
     {
         FirebaseAnalytics.SetUserProperty(key, Convert.ToString(d));
     });
 }
Beispiel #3
0
    void Init()
    {
        AppOptions app = new AppOptions()
        {
            AppId           = "1:898200925370:android:5929dcbe0008296d",
            ApiKey          = "AIzaSyDHPBbm8rKurctnZXxegGpxESGw-UoiuCk",
            ProjectId       = "api-9101058431890075688-215796",
            MessageSenderId = "898200925370-haqpkh0jjaoreco3idi0fv2ltes2kh39.apps.googleusercontent.com",
        };

        FirebaseApp.Create(app, "Glider");

        Debug.Log("启用数据收集");
        FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

        FirebaseAnalytics.SetUserId("testUserId");

        FirebaseAnalytics.SetUserProperty(FirebaseAnalytics.UserPropertySignUpMethod, "Google_" + UnityEngine.Random.Range(0, 4000));


        FirebaseAnalytics.SetMinimumSessionDuration(new TimeSpan(0, 0, 30));
        FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 50, 0));
        LoginButton.onClick.AddListener(delegate() {
            AnalyticsLogin();
        });
        progressButton.onClick.AddListener(delegate() {
            AnalyticsProgress();
        });
        scoreButton.onClick.AddListener(delegate() {
            AnalyticsScore();
        });

        groupJoinButton.onClick.AddListener(delegate() {
            AnalyticsGroupJoin();
        });
        levelUpButton.onClick.AddListener(delegate() {
            AnalyticsLevelUp();
        });
        resetDataButton.onClick.AddListener(delegate() {
            ResetAnalyticsData();
        });
        displayAppIdButton.onClick.AddListener(delegate() {
            DisplayAnalyticsInstanceId();
        });
        SetUserButton.onClick.AddListener(delegate() {
            Debug.Log("设置userId");
            FirebaseAnalytics.SetUserId("user_" + UnityEngine.Random.Range(0, 4000));
        });
        SetUserPropertyButton.onClick.AddListener(delegate() {
            Debug.Log("设置user   flghtNumber");
            FirebaseAnalytics.SetUserProperty("flghtNumber", "shas--" + UnityEngine.Random.Range(0, 4000));
        });
        SetUserProperty2Button.onClick.AddListener(delegate() {
            Debug.Log("设置user   deathNumber");
            FirebaseAnalytics.SetUserProperty("deathNumber", "shas--" + UnityEngine.Random.Range(0, 4000));
        });
        testEventButton.onClick.AddListener(delegate() {
            FirebaseAnalytics.LogEvent("testEvent02", "xiaName", "夏海龙9000");
        });
    }
Beispiel #4
0
 public void SetProperties(params AnalyticsParameter[] parameters)
 {
     foreach (var item in parameters)
     {
         FirebaseAnalytics.SetUserProperty(item.Name, item.Value);
     }
 }
Beispiel #5
0
    public void InitializeFirebase()
    {
        firebaseInitialized = true;
        FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

        // Set the user's sign up method.
#if UNITY_IPHONE
        FirebaseAnalytics.SetUserProperty(
            "System",
            "IOS");
#elif UNITY_ANDROID
        FirebaseAnalytics.SetUserProperty(
            "System",
            "Android");
#else
        FirebaseAnalytics.SetUserProperty(
            "System",
            "Other");
#endif
        Config.userIdentify = SystemInfo.deviceUniqueIdentifier;
        FirebaseAnalytics.SetUserId(Config.userIdentify);
        Debug.Log("InitializeFirebaseInitializeFirebaseInitializeFirebaseInitializeFirebase");
        FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://pirson-escape-plan.firebaseio.com/");

        if (FirebaseApp.DefaultInstance.Options.DatabaseUrl != null)
        {
            FirebaseApp.DefaultInstance.SetEditorDatabaseUrl(FirebaseApp.DefaultInstance.Options.DatabaseUrl);
        }
    }
Beispiel #6
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);
    }
Beispiel #7
0
    void InitializeFirebase(bool firstLogin)
    {
        Debug.Log("Enabling data collection.");
        FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

        Debug.Log("Set user properties.");
        // Set the user's sign up method.
        FirebaseAnalytics.SetUserProperty(
            FirebaseAnalytics.UserPropertySignUpMethod,
            "Google");
        // Set the user ID.
        FirebaseAnalytics.SetUserId(SystemInfo.deviceUniqueIdentifier);

        // Set default session duration values.
        FirebaseAnalytics.SetMinimumSessionDuration(new TimeSpan(0, 0, 10));
        FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0));
        firebaseInitialized = true;

        Debug.Log("Logging a login event.");
        FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLogin);

        if (firstLogin)
        {
            Firebase.Analytics.FirebaseAnalytics.LogEvent(
                Firebase.Analytics.FirebaseAnalytics.EventTutorialBegin, new Firebase.Analytics.Parameter(Firebase.Analytics.FirebaseAnalytics.ParameterCreativeName,
                                                                                                          "JUEGO INICIADO&preguntas:0"));
        }
    }
Beispiel #8
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 #9
0
 void InitializeFirebase()
 {
     Debug.Log("Enabling data collection.");
     FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
     Debug.Log("Set user properties.");
     FirebaseAnalytics.SetUserProperty(FirebaseAnalytics.UserPropertySignUpMethod, "Google");
     FirebaseAnalytics.SetUserId("uber_user_510");
 }
        private static void SetDeviceIdentification()
        {
            if (!fireBaseActive)
            {
                return;
            }

            FirebaseAnalytics.SetUserProperty("deviceId", SystemInfo.deviceUniqueIdentifier);
        }
        public static void SetFirstOpen()
        {
            if (!fireBaseActive)
            {
                return;
            }

            FirebaseAnalytics.SetUserProperty("firstOpen", System.DateTime.Now.ToString());
        }
Beispiel #12
0
 public static void SetCustomKey(string key, string value)
 {
     if (!setupReady)
     {
         return;
     }
     Crashlytics.SetCustomKey(key, value);
     FirebaseAnalytics.SetUserProperty(key, value);
 }
        //Potentially do some checks backed by player prefs to ensure game start cant be called again before game end and game end cant be called before game start.
        //See how game pans out.
        public static void GameEndEvent()
        {
            if (!fireBaseActive)
            {
                return;
            }

            FirebaseAnalytics.LogEvent("gameEnded", "time", System.DateTime.Now.ToString());

            FirebaseAnalytics.SetUserProperty("inGame", false.ToString());
        }
        public ITracker SetUserProperty(string name, object value)
        {
            if (!StencilFirebase.IsReady)
            {
                return(this);
            }
            FirebaseAnalytics.SetUserProperty(name, value?.ToString());
#if STENCIL_FIREBASE
            Crashlytics.Log($"Set Property {name} = {value}");
            Crashlytics.SetCustomKey(name, value?.ToString() ?? "");
#endif
            return(this);
        }
Beispiel #15
0
        public void AnalyticsLevelUp()
        {
            // Log an event with multiple parameters.
            //记录具有多个参数的事件。
            DebugLog("记录升级事件。== Logging a level up event.");
            FirebaseAnalytics.LogEvent(
                FirebaseAnalytics.EventLevelUp,
                new Parameter(FirebaseAnalytics.ParameterLevel, 5),
                new Parameter(FirebaseAnalytics.ParameterCharacter, "mrspoon"),
                new Parameter("hit_accuracy", 3.14f)
                );

            FirebaseAnalytics.SetUserProperty("deathNumber", "shas--" + UnityEngine.Random.Range(0, 4000));
        }
Beispiel #16
0
    void InitializeFirebase()
    {
        FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

        // Set the user's sign up method.
        FirebaseAnalytics.SetUserProperty(
            FirebaseAnalytics.UserPropertySignUpMethod,
            "Google");
        // Set the user ID.
        FirebaseAnalytics.SetUserId("uber_user_510");
        // Set default session duration values.
        FirebaseAnalytics.SetMinimumSessionDuration(new TimeSpan(0, 0, 10));
        FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0));
        _firebaseInitialized = true;
    }
Beispiel #17
0
        // Handle initialization of the necessary firebase modules:
        /// <summary>
        /// 处理必要的FixBASE模块的初始化:
        /// </summary>
        void InitializeFirebase()
        {
            DebugLog("启用数据收集。== Enabling data collection.");
            FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

            DebugLog("设置用户属性。== Set user properties.");
            // Set the user's sign up method.
            FirebaseAnalytics.SetUserProperty(FirebaseAnalytics.UserPropertySignUpMethod, "Google_" + UnityEngine.Random.Range(0, 4000));
            // Set the user ID.
            FirebaseAnalytics.SetUserId("uber_user_" + UnityEngine.Random.Range(0, 4000));
            // Set default session duration values.
            FirebaseAnalytics.SetMinimumSessionDuration(new TimeSpan(0, 0, 10));
            FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0));
            firebaseInitialized = true;
        }
Beispiel #18
0
        // Handle initialization of the necessary firebase modules:
        void InitializeFirebase()
        {
            DebugLog("Enabling data collection.");
            FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

            DebugLog("Set user properties.");
            // Set the user's sign up method.
            FirebaseAnalytics.SetUserProperty(
                FirebaseAnalytics.UserPropertySignUpMethod,
                "Google");
            // Set the user ID.
            FirebaseAnalytics.SetUserId("uber_user_510");
            // Set default session duration values.
            FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0));
            firebaseInitialized = true;
        }
        //Nuevo metodo
        public void GetTipoUsu()
        {
            if (File.Exists(App.FileUsu))
            {
                string TipoUsu = File.ReadAllText(App.FileUsu);

                mFirebaseAnalytics = FirebaseAnalytics.GetInstance(MainActivity.getmInstanceActivity());

                mFirebaseAnalytics.SetUserProperty("Tipo_Usuario", TipoUsu);
            }
            else
            {
                mFirebaseAnalytics = FirebaseAnalytics.GetInstance(MainActivity.getmInstanceActivity());
                mFirebaseAnalytics.SetUserProperty("Tipo_Usuario", "Invitado");
            }
        }
    public static void SetUser(string title, object property)
    {
#if USE_FIREBASE
        try
        {
            if (instance == null || DependencyStatus != DependencyStatus.Available || property == null)
            {
                return;
            }
            FirebaseAnalytics.SetUserProperty(title, property.ToString());
        }
        catch (Exception ex)
        {
            Debug.LogError("[Firebase] SetUser: " + ex.Message);
        }
#endif
    }
Beispiel #21
0
        public bool InitWithConfig(SDKConfig config, SDKAdapterConfig adapterConfig)
        {
            SDKMgr.S.RegisterFilebaseDepInitCB(() =>
            {
                FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

                FirebaseAnalytics.SetUserProperty(
                    FirebaseAnalytics.UserPropertySignUpMethod,
                    "Unity");
                // Set the user ID.
                FirebaseAnalytics.SetUserId("my_user");
                // Set default session duration values.
                FirebaseAnalytics.SetMinimumSessionDuration(new TimeSpan(0, 0, 10));
                FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0));
                m_Init = true;
            });
            return(true);
        }
Beispiel #22
0
    /// <summary>
    /// Sets the property for this user which is logged along with the events of this user.
    /// Warning: It is against the rules to log personal information even if it's hashed such as email or names!
    /// </summary>
    /// <param name="propertyName">Property name.</param>
    /// <param name="propertyValue">Property value.</param>
    public static void SetUserProperty(string propertyName, string propertyValue)
    {
                #if analytics
        if (!IsReserved(propertyName))
        {
            bool doesPropertyValueNeedLimiting = propertyValue.Length > 36;

            if (doesPropertyValueNeedLimiting)
            {
                propertyValue = propertyValue.Substring(0, 36);
            }

            FirebaseAnalytics.SetUserProperty(propertyName, propertyValue);
            Crashlytics.SetKeyValue(propertyName, propertyValue);

            ProjectManager.Log("[Analytics User Property] " + propertyName + " = " + propertyValue);
        }
                #endif
    }
Beispiel #23
0
        public static void Setup(string userId)
        {
            DebugLog.Normal("Firebase Analytics : データ収集を有効化します");
            FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

#if UNITY_ANDROID
            FirebaseAnalytics.SetUserProperty(
                "OS",
                "Android");
#elif UNITY_IOS
            FirebaseAnalytics.SetUserProperty(
                "OS",
                "iOS");
#else
            FirebaseAnalytics.SetUserProperty(
                "OS",
                "Other");
#endif
            FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0));
            FirebaseAnalytics.SetUserId(userId);
        }
        private void SendOnGameEndData()
        {
            if (sendAnalytics == false)
            {
                return;
            }


            string    gotHighScore      = ScoreKeeper.GotHighScoreThisRound == true ? "true" : "false";
            Parameter paramGotHighScore = new Parameter(AnalyticsManager.ParamHighScore, gotHighScore);

            int       score      = ScoreKeeper.Score;
            Parameter paramScore = new Parameter(AnalyticsManager.ParamScore, score);

            double    timeScaleOnEnd = FindObjectOfType <TimeController>().CurrentTime;
            Parameter paramTimeScale = new Parameter(AnalyticsManager.ParamTimeScale, timeScaleOnEnd);

            double    averageBarTime      = AnalyticsManager.BarTimesAverage;
            Parameter paramAverageBarTime = new Parameter(AnalyticsManager.ParamAverageBarTime, averageBarTime);

            FirebaseAnalytics.LogEvent(AnalyticsManager.EventGameEnd, paramGotHighScore, paramScore, paramTimeScale, paramAverageBarTime);
            FirebaseAnalytics.SetUserProperty(AnalyticsManager.UserPropGamesPlayed, AnalyticsManager.GamesPlayedInLifetime.ToString());
        }
 public void SetUserProperty(string name, string value)
 {
     FirebaseAnalytics.SetUserProperty(name, value);
 }
Beispiel #26
0
 private void SetNickName(string userNickName)
 {
     FirebaseAnalytics.SetUserProperty("Nick", userNickName);
     //Crashlytics.SetCustomKey("Nick", userNickName);
 }
Beispiel #27
0
    public void InitializeGameAnalytics()
    {
        if (!base.Inited)
        {
            AnalyticsService analytics      = PersistentSingleton <AnalyticsService> .Instance;
            IAPService       instance       = PersistentSingleton <IAPService> .Instance;
            AdService        instance2      = PersistentSingleton <AdService> .Instance;
            SessionService   sessionService = PersistentSingleton <SessionService> .Instance;
            PlayerData       playerData     = PlayerData.Instance;
            instance.IAPCompleted.Subscribe(delegate(IAPTransactionState iapCompleted)
            {
                analytics.TrackEvent("IAP_Complete", iapCompleted.asDictionary(), string.Empty);
            });
            instance.IAPNotCompleted.Subscribe(delegate(IAPNotCompleted iapNotCompleted)
            {
                analytics.TrackEvent("IAP_Not_Complete", iapNotCompleted.asDictionary(), string.Empty);
            });
            instance.IAPValidated.Subscribe(delegate(IAPTransactionState iapValidated)
            {
                analytics.TrackEvent("IAP_Validated", iapValidated.asDictionary(), string.Empty);
            });
            instance2.AdStarted.Subscribe(delegate(AdWatched adStarted)
            {
                analytics.TrackEvent("Ad_Started", adStarted.asDictionary(), string.Empty);
            });
            (from adResult in instance2.AdResults
             where adResult.result == AdService.V2PShowResult.Finished
             select adResult).Subscribe(delegate(AdWatched adWatched)
            {
                analytics.TrackEvent("Ad_Watched", adWatched.asDictionary(), "fb_mobile_content_view");
            });
            (from adResult in instance2.AdResults
             where adResult.result == AdService.V2PShowResult.Failed || adResult.result == AdService.V2PShowResult.Skipped
             select adResult).Subscribe(delegate(AdWatched adFailed)
            {
                analytics.TrackEvent("Ad_Failed", adFailed.asDictionary(), string.Empty);
            });
            (from a in instance2.AdLoadRequests
             select a.asDictionary(ServerTimeService.NowTicks())).Subscribe(delegate(Dictionary <string, string> adLoadRequest)
            {
                analytics.TrackEvent("Ad_Load", adLoadRequest, string.Empty);
            });
            (from isNewUser in sessionService.newUser
             where isNewUser
             select isNewUser).Subscribe(delegate
            {
                analytics.TrackEvent("New_User", new Dictionary <string, string>(), string.Empty);
            });
            playerData.SessionNumber.Subscribe(delegate
            {
                analytics.TrackEvent("Session_Started", new Dictionary <string, string>
                {
                    {
                        "LastSavedBy",
                        playerData.LastSavedBy
                    },
                    {
                        "HoursSinceLastSession",
                        ((int)TimeSpan.FromTicks(sessionService.TicksSinceLastSave()).TotalHours).ToString()
                    },
                    {
                        "Lifetime_BlocksDestroyed",
                        CountLifetimeBlocksDestroyed()
                    }
                }, string.Empty);
            });
            playerData.SessionNumber.Subscribe(delegate
            {
                analytics.TrackEvent("Session_Balance", new Dictionary <string, string>
                {
                    {
                        "Material_Grass",
                        playerData.BlocksCollected[0].Value.ToString()
                    },
                    {
                        "Material_Dirt",
                        playerData.BlocksCollected[1].Value.ToString()
                    },
                    {
                        "Material_Wood",
                        playerData.BlocksCollected[2].Value.ToString()
                    },
                    {
                        "Material_Stone",
                        playerData.BlocksCollected[3].Value.ToString()
                    },
                    {
                        "Material_Metal",
                        playerData.BlocksCollected[4].Value.ToString()
                    },
                    {
                        "Material_Gold",
                        playerData.BlocksCollected[5].Value.ToString()
                    },
                    {
                        "Material_Jelly",
                        playerData.BlocksCollected[6].Value.ToString()
                    }
                }, string.Empty);
            });
            (from ord in PrestigeTriggered
             where ord == PrestigeOrder.PrestigeStart
             select ord).Subscribe(delegate
            {
                analytics.TrackEvent("Prestige", new Dictionary <string, string>
                {
                    {
                        "Material_Grass",
                        ((double)playerData.BlocksInBackpack[0].Value * Singleton <CumulativeBonusRunner> .Instance.BonusMult[13].Value.ToDouble()).ToString()
                    },
                    {
                        "Material_Dirt",
                        ((double)playerData.BlocksInBackpack[1].Value * Singleton <CumulativeBonusRunner> .Instance.BonusMult[14].Value.ToDouble()).ToString()
                    },
                    {
                        "Material_Wood",
                        ((double)playerData.BlocksInBackpack[2].Value * Singleton <CumulativeBonusRunner> .Instance.BonusMult[15].Value.ToDouble()).ToString()
                    },
                    {
                        "Material_Stone",
                        ((double)playerData.BlocksInBackpack[3].Value * Singleton <CumulativeBonusRunner> .Instance.BonusMult[16].Value.ToDouble()).ToString()
                    },
                    {
                        "Material_Metal",
                        ((double)playerData.BlocksInBackpack[4].Value * Singleton <CumulativeBonusRunner> .Instance.BonusMult[17].Value.ToDouble()).ToString()
                    },
                    {
                        "Material_Gold",
                        ((double)playerData.BlocksInBackpack[5].Value * Singleton <CumulativeBonusRunner> .Instance.BonusMult[18].Value.ToDouble()).ToString()
                    },
                    {
                        "Material_Jelly",
                        ((double)playerData.BlocksInBackpack[6].Value * Singleton <CumulativeBonusRunner> .Instance.BonusMult[19].Value.ToDouble()).ToString()
                    }
                }, string.Empty);
            });
            playerData.TutorialStep.Skip(1).Subscribe(delegate(int step)
            {
                analytics.TrackEvent("FTUE_Stage_Done", new Dictionary <string, string>
                {
                    {
                        "FTUE_Stage",
                        Singleton <TutorialGoalCollectionRunner> .Instance.GetOrCreatePlayerGoalRunner(step - 1).GoalConfig.ID
                    },
                    {
                        "FTUE_Stage_ID",
                        (step - 1).ToString()
                    }
                }, (step < Singleton <EconomyHelpers> .Instance.GetTutorialGoalAmount() - 1) ? string.Empty : "fb_mobile_tutorial_completion");
            });
            playerData.TutorialStep.Skip(1).Subscribe(delegate(int step)
            {
                Analytics.CustomEvent("FTUE_Stage_Done", new Dictionary <string, object>
                {
                    {
                        "FTUE_Stage",
                        Singleton <TutorialGoalCollectionRunner> .Instance.GetOrCreatePlayerGoalRunner(step - 1).GoalConfig.ID
                    },
                    {
                        "FTUE_Stage_ID",
                        (step - 1).ToString()
                    }
                });
            });
            GemTransactions.Subscribe(delegate(GemTransaction transaction)
            {
                analytics.TrackEvent("Gem_Transaction", transaction.asDictionary(), (!(transaction.transaction == "spendFunds")) ? string.Empty : "fb_mobile_spent_credits", transaction.amount);
            });
            ChestTransactions.Subscribe(delegate(ChestTransaction transaction)
            {
                analytics.TrackEvent("Chest_Transaction", transaction.asDictionary(), string.Empty);
            });
            KeyTransactions.Subscribe(delegate(KeyTransaction transaction)
            {
                analytics.TrackEvent("Key_Added", transaction.asDictionary(), string.Empty);
            });
            BerryTransaction.Subscribe(delegate(BerryTransaction transaction)
            {
                analytics.TrackEvent("Berry_Added", transaction.asDictionary(), string.Empty);
            });
            PopupDecisions.Subscribe(delegate(PopupDecision decision)
            {
                analytics.TrackEvent("Popup_Decision", decision.asDictionary(), string.Empty);
            });
            (from coins in playerData.LifetimeCoins.Pairwise()
             where coins.Previous.exponent != coins.Current.exponent
             select coins).Subscribe(delegate
            {
                analytics.TrackEvent("New_LTE_Digit", new Dictionary <string, string>(), string.Empty);
            });
            playerData.LifetimeChunk.Skip(1).Subscribe(delegate
            {
                analytics.TrackEvent("New_Max_Chunk", new Dictionary <string, string>(), string.Empty);
            });
            playerData.LifetimeCreatures.Skip(1).Subscribe(delegate
            {
                analytics.TrackEvent("New_Max_Companions", new Dictionary <string, string>(), string.Empty);
            });
            HeroStateFactory.GetOrCreateHeroState(0).LifetimeLevel.Skip(1).Subscribe(delegate
            {
                analytics.TrackEvent("New_Max_Hero_Level", new Dictionary <string, string>(), string.Empty);
            });
            GoalCompleted.Subscribe(delegate(PlayerGoalRunner goal)
            {
                analytics.TrackEvent("Achievement_Completed", new Dictionary <string, string>
                {
                    {
                        "Goal_ID",
                        goal.GoalConfig.ID
                    }
                }, "fb_mobile_achievement_unlocked");
            });
            NewBundle.Subscribe(delegate(IAPProductEnum bundle)
            {
                analytics.TrackEvent("Offer_Given", new Dictionary <string, string>
                {
                    {
                        "Offer",
                        bundle.ToString()
                    }
                }, string.Empty);
            });
            GearUpgraded.Subscribe(delegate(GearRunner gear)
            {
                analytics.TrackEvent("Gear_Upgrade", new Dictionary <string, string>
                {
                    {
                        "GearLevel",
                        gear.Level.ToString()
                    },
                    {
                        "GearID",
                        gear.GearIndex.ToString()
                    }
                }, string.Empty);
            });
            SkillUsed.Subscribe(delegate(SkillsEnum skill)
            {
                analytics.TrackEvent("Skill_Used", new Dictionary <string, string>
                {
                    {
                        "Skill",
                        skill.ToString()
                    },
                    {
                        "Lifetime_Used",
                        playerData.SkillStates[(int)skill].LifetimeUsed.Value.ToString()
                    }
                }, string.Empty);
            });
            BossBattleResult.Skip(1).Subscribe(delegate(bool result)
            {
                analytics.TrackEvent("BossBattleResult", new Dictionary <string, string>
                {
                    {
                        "Result",
                        result.ToString()
                    },
                    {
                        "Current_Chunk",
                        playerData.MainChunk.Value.ToString()
                    }
                }, string.Empty);
            });
            ObjectTapped.Subscribe(delegate(string obj)
            {
                analytics.TrackEvent("Object_Tapped", new Dictionary <string, string>
                {
                    {
                        "Object_Tapped",
                        obj
                    }
                }, string.Empty);
            });

            /*XPromoPlugin.XPromoActions.Subscribe(delegate(XPromoAction XPromoAction)
             * {
             *      analytics.TrackEvent("X_Promo_Action", XPromoAction.asDictionary(), string.Empty);
             * });*/
            PersistentSingleton <ARService> .Instance.LevelEditorEvent.Subscribe(delegate(string editorEvent)
            {
                analytics.TrackEvent("Level_Editor", new Dictionary <string, string>
                {
                    {
                        "Event",
                        editorEvent
                    }
                }, string.Empty);
            });

            PersistentSingleton <AnalyticsService> .Instance.FortunePodsResult.Subscribe(delegate(FortunePodResult result)
            {
                analytics.TrackEvent("Fortune_Pod_Result", result.asDictionary(), string.Empty);
            });

            (from chunk in playerData.MainChunk.Skip(1)
             where chunk == 22 && PlayerData.Instance.LifetimePrestiges.Value == 0 && !Singleton <QualitySettingsRunner> .Instance.LowFPS.Value
             select chunk).Subscribe(delegate
            {
                SceneLoader.Instance.StartCoroutine(TrackFpsRuotine());
            });
            (from hr in playerData.HasReviewed.Skip(1)
             where hr
             select hr).Subscribe(delegate
            {
                analytics.TrackEvent("fb_mobile_rate", new Dictionary <string, string>
                {
                    {
                        "fb_max_rating_value",
                        "5"
                    }
                }, "fb_mobile_rate", 5f);
            });
            playerData.Trophies.Skip(1).Subscribe(delegate(int trophies)
            {
                AnalyticsService analyticsService       = analytics;
                Dictionary <string, string> dictionary  = new Dictionary <string, string>();
                Dictionary <string, string> dictionary2 = dictionary;
                TournamentTier tournamentTier           = (TournamentTier)trophies;
                dictionary2.Add("RewardType", tournamentTier.ToString());
                analyticsService.TrackEvent("TournamentReward", dictionary, string.Empty);
            });
            (from tour in TournamentEvent
             where tour
             select tour).Subscribe(delegate
            {
                analytics.TrackEvent("TournamentStarted", new Dictionary <string, string>
                {
                    {
                        "Current_Chunk",
                        playerData.MainChunk.Value.ToString()
                    }
                }, string.Empty);
            });
            (from tour in TournamentEvent
             where !tour
             select tour).Subscribe(delegate
            {
                analytics.TrackEvent("TournamentEnded", new Dictionary <string, string>
                {
                    {
                        "Current_Chunk",
                        playerData.MainChunk.Value.ToString()
                    },
                    {
                        "Highest_Chunk_Reached",
                        Singleton <TournamentRunner> .Instance.PlayerHighestWorld.Value.ToString()
                    },
                    {
                        "Position",
                        Singleton <TournamentRunner> .Instance.PlayerRank.Value.ToString()
                    }
                }, string.Empty);
            });
            (from p in Observable.EveryApplicationPause()
             where !p && FB.IsInitialized
             select p).Subscribe(delegate
            {
                FB.ActivateApp();
            });
            FirebaseAnalytics.SetUserId(playerData.PlayerId);
            FirebaseAnalytics.SetUserProperty("AppGenuine", (!Application.genuineCheckAvailable) ? "N/A" : Application.genuine.ToString());
            FirebaseAnalytics.SetUserProperty("Build_Number", Application.version);
            subscribeToUserProperty("Days_Retained", playerData.DaysRetained);
            // FirebaseAnalytics.SetUserProperty("Games_Installed", XPromoPlugin.InstalledApps());
            FirebaseAnalytics.SetUserProperty("Friends_Giftable", PersistentSingleton <FacebookAPIService> .Instance.FBPlayers.Count.ToString());
            FirebaseAnalytics.SetUserProperty("Friends_Playing", PersistentSingleton <FacebookAPIService> .Instance.FBPlayers.Values.Count((FBPlayer p) => p.Playing).ToString());
            subscribeToUserProperty("Has_Reviewed", playerData.HasReviewed);
            FirebaseAnalytics.SetUserProperty("Hours_In_Lifetime", ((int)TimeSpan.FromTicks(sessionService.TicksPlayedInLifetime()).TotalHours).ToString());
            FirebaseAnalytics.SetUserProperty("Segments", string.Join(",", PersistentSingleton <GameSettings> .Instance.Segments.ToArray()));
            subscribeToUserProperty("Music", MusicVolume);
            subscribeToUserProperty("Notifications_Decided", playerData.NotificationDecision);
            subscribeToUserProperty("Online", ConnectivityService.InternetConnectionAvailable);
            subscribeToUserProperty("Review_State", playerData.ReviewState);
            subscribeToUserProperty("Sound", SFXVolume);
            subscribeToUserProperty("AR_Editor_Supported", ARSupported);
            FirebaseAnalytics.SetUserProperty("Language", playerData.Language);
            FirebaseAnalytics.SetUserProperty("PFID", playerData.PFId.Value);
            FirebaseAnalytics.SetUserProperty("FBID", playerData.FBId.Value);
            base.Inited = true;
        }
    }