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"); }); }
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")); } }
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"); } }); }
void InitializeFirebase() { UnityEngine.Debug.Log("AnalyticsFirebase Inited"); IsInit = true; FirebaseAnalytics.SetAnalyticsCollectionEnabled(true); FirebaseAnalytics.SetUserId(DeviceID.UUID); FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 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; }
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; }
// 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; }
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); }
private void Start() { FirebaseAnalytics.SetAnalyticsCollectionEnabled(true); var userInfo = UserInfoManager.Get().GetUserInfo(); SetUserId(userInfo.userID); SetNickName(userInfo.userNickName); userInfo.RegisterOnSetUserId(SetUserId); userInfo.RegisterOnSetUserNickName(SetNickName); FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0)); Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => { FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLogin); }); }
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 static int authPhases = 0;//1=authenticated; 0=none; -1=trying public static void Setup() { if (setupReady) { return; } FirebaseApp.LogLevel = LogLevel.Debug; FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task => { var dependencyStatus = task.Result; if (dependencyStatus == DependencyStatus.Available) { // Create and hold a reference to your FirebaseApp, // where app is a Firebase.FirebaseApp property of your application class. FirebaseApp app = FirebaseApp.DefaultInstance; // Set a flag here to indicate whether Firebase is ready to use by your app. setupReady = true; // user default SetUserId(Application.buildGUID); //analytics FirebaseAnalytics.SetAnalyticsCollectionEnabled(true); FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0)); // listeners DynamicLinks.DynamicLinkReceived += OnDynamicLink; } else { Debug.LogError(System.String.Format( "Could not resolve all Firebase dependencies: {0}", dependencyStatus)); // Firebase Unity SDK is not safe to use here. } } ); }