コード例 #1
0
        internal void Init()
        {
            _sessionIdRenewalIntervalInSeconds = AnalyticsConfig.sessionIdRenewalIntervalInSeconds;
            if (_sessionLengthTimer == null)
            {
                _sessionLengthTimer = new System.Timers.Timer(1000)
                {
                    Enabled = true, AutoReset = true
                };
                _sessionLengthTimer.Elapsed += (sender, args) => { SessionLength++; };
                _sessionLengthTimer.Start();
            }

            // no session count value yet => take the injected value
            if (!PlayerPrefs.HasKey(PlayerPrefSessionCountKey))
            {
                PlayerPrefs.SetInt(PlayerPrefSessionCountKey, AnalyticsStorageHelper.GetAppLaunchCount());
            }
            else
            {
                IncrementSessionCount();
            }

            SessionCount = PlayerPrefs.GetInt(PlayerPrefSessionCountKey, 0);

            ResetSession();
            RefreshCreationDate();
        }
コード例 #2
0
        /*private static void OnTrackPurchaseEvent(AnalyticsPurchaseInfo purchaseInfo)
         * {
         *  var data = new Dictionary<string, object> {
         *      {VoodooAnalyticsConstants.IAP_ID, purchaseInfo.productId},
         *      {VoodooAnalyticsConstants.PRICE, (float) purchaseInfo.localizedPrice},
         *      {VoodooAnalyticsConstants.CURRENCY, purchaseInfo.isoCurrencyCode},
         *  };
         *  VoodooAnalyticsManager.TrackEvent(EventName.iap, data);
         * }*/

        //private static void OnTrackPurchaseVerificationEvent(PurchaseAnalyticsInfo purchaseInfo, bool validated)
        //{
        //    var data = new Dictionary<string, object> {
        //        {VoodooAnalyticsConstants.IAP_ID, purchaseInfo.productId},
        //        {VoodooAnalyticsConstants.PRICE, (float) purchaseInfo.localizedPrice},
        //        {VoodooAnalyticsConstants.CURRENCY, purchaseInfo.isoCurrencyCode},
        //        {VoodooAnalyticsConstants.VALIDATED, validated}
        //    };
        //    VoodooAnalyticsManager.TrackEvent(EventName.iap, data);
        //}

        private static void OnGameStarted(string level, Dictionary <string, object> eventProperties)
        {
            var data = new Dictionary <string, object> {
                { VoodooAnalyticsConstants.LEVEL, level },
                { VoodooAnalyticsConstants.GAME_COUNT, AnalyticsStorageHelper.GetGameCount() },
                { VoodooAnalyticsConstants.HIGHEST_SCORE, AnalyticsStorageHelper.GetGameHighestScore() }
            };

            VoodooAnalyticsManager.TrackEvent(EventName.game_start, data, null, eventProperties);
        }
コード例 #3
0
        // Track game events
        // ================================================
        internal static void TrackApplicationLaunch()
        {
            AnalyticsStorageHelper.IncrementAppLaunchCount();
            //fire app launch events
            if (AnalyticsStorageHelper.IsFirstAppLaunch())
            {
                OnApplicationFirstLaunchEvent?.Invoke();
            }

            OnApplicationLaunchEvent?.Invoke();
        }
コード例 #4
0
        private static void OnGameFinished(bool levelComplete, float score, string level, Dictionary <string, object> eventProperties)
        {
            var data = new Dictionary <string, object> {
                { VoodooAnalyticsConstants.LEVEL, level },
                { VoodooAnalyticsConstants.GAME_COUNT, AnalyticsStorageHelper.GetGameCount() },
                { VoodooAnalyticsConstants.STATUS, levelComplete },
                { VoodooAnalyticsConstants.SCORE, score }
            };

            VoodooAnalyticsManager.TrackEvent(EventName.game_finish, data, null, eventProperties);
        }
コード例 #5
0
        internal static void TrackGameFinished(bool levelComplete, float score, string level, Dictionary <string, object> eventProperties)
        {
            HasGameStarted = false;
            AnalyticsStorageHelper.UpdateLevel(level);
            if (levelComplete)
            {
                // used to calculate the win rate (for RemoteConfig)
                AnalyticsStorageHelper.IncrementSuccessfulGameCount();
            }

            OnGamePlayed?.Invoke(AnalyticsStorageHelper.GetGameCount(), AnalyticsStorageHelper.UpdateGameHighestScore(score));
            OnGameFinishedEvent?.Invoke(levelComplete, score, level ?? NO_GAME_LEVEL, eventProperties);
        }
コード例 #6
0
 internal static void TrackGameStarted(string level, Dictionary <string, object> eventProperties = null)
 {
     HasGameStarted = true;
     AnalyticsStorageHelper.IncrementGameCount();
     OnGameStartedEvent?.Invoke(level ?? NO_GAME_LEVEL, eventProperties);
 }