/// <summary>
 /// Set user gender.
 /// </summary>
 /// <param name="gender">Gender of user (Persists cross session).</param>
 public static void SetGender(GA_Setup.GAGender gender)
 {
     GA_Setup.SetGender(gender);
 }
Example #2
0
 /// <summary>
 /// Set user gender.
 /// </summary>
 /// <param name="gender">Gender of user (Persists cross session).</param>
 public static void SetGender(GAGender gender)
 {
     GA_Setup.SetGender(gender);
 }
Example #3
0
 /// <summary>
 /// Set user birth year.
 /// </summary>
 /// <param name="birthYear">Birth year of user (Persists cross session).</param>
 public static void SetBirthYear(int birthYear)
 {
     GA_Setup.SetBirthYear(birthYear);
 }
Example #4
0
 /// <summary>
 /// Set user facebook id.
 /// </summary>
 /// <param name="facebookId">Facebook id of user (Persists cross session).</param>
 public static void SetFacebookId(string facebookId)
 {
     GA_Setup.SetFacebookId(facebookId);
 }
Example #5
0
        private static void InternalInitialize()
        {
            if (!Application.isPlaying)
            {
                return; // no need to setup anything else if we are in the editor and not playing
            }
            if (SettingsGA.InfoLogBuild)
            {
                GA_Setup.SetInfoLog(true);
            }

            if (SettingsGA.VerboseLogBuild)
            {
                GA_Setup.SetVerboseLog(true);
            }

            int platformIndex = GetPlatformIndex();

            GA_Wrapper.SetUnitySdkVersion("unity " + Settings.VERSION);
            GA_Wrapper.SetUnityEngineVersion("unity " + GetUnityVersion());

            if (platformIndex >= 0)
            {
                if (GameAnalytics.SettingsGA.UsePlayerSettingsBuildNumber)
                {
                    for (int i = 0; i < GameAnalytics.SettingsGA.Platforms.Count; ++i)
                    {
                        if (GameAnalytics.SettingsGA.Platforms [i] == RuntimePlatform.Android || GameAnalytics.SettingsGA.Platforms [i] == RuntimePlatform.IPhonePlayer)
                        {
                            GameAnalytics.SettingsGA.Build [i] = Application.version;
                        }
                    }
                }
                GA_Wrapper.SetBuild(SettingsGA.Build [platformIndex]);
            }

            if (SettingsGA.CustomDimensions01.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions01(SettingsGA.CustomDimensions01);
            }

            if (SettingsGA.CustomDimensions02.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions02(SettingsGA.CustomDimensions02);
            }

            if (SettingsGA.CustomDimensions03.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions03(SettingsGA.CustomDimensions03);
            }

            if (SettingsGA.ResourceItemTypes.Count > 0)
            {
                GA_Setup.SetAvailableResourceItemTypes(SettingsGA.ResourceItemTypes);
            }

            if (SettingsGA.ResourceCurrencies.Count > 0)
            {
                GA_Setup.SetAvailableResourceCurrencies(SettingsGA.ResourceCurrencies);
            }

            if (SettingsGA.UseManualSessionHandling)
            {
                SetEnabledManualSessionHandling(true);
            }
        }
Example #6
0
 /// <summary>
 /// Set 3rd custom dimension.
 /// </summary>
 /// <param name="customDimension">One of the available dimension values set in Settings (Setup tab). Will persist cross session. Set to null to remove again.</param>
 public static void SetCustomDimension03(string customDimension)
 {
     GA_Setup.SetCustomDimension03(customDimension);
 }
Example #7
0
        private static void Initialize()
        {
            if (!Application.isPlaying)
            {
                return;                 // no need to setup anything else if we are in the editor and not playing
            }
                        #if UNITY_EDITOR
            Debug.Log("GameAnalytics running in Unity Editor: event validation disabled.");
                        #endif

            if (SettingsGA.InfoLogBuild)
            {
                GA_Setup.SetInfoLog(true);
            }

            if (SettingsGA.VerboseLogBuild)
            {
                GA_Setup.SetVerboseLog(true);
            }

#if UNITY_ANDROID && !UNITY_EDITOR
            AndroidJavaClass  jc       = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject activity = jc.GetStatic <AndroidJavaObject>("currentActivity");

            AndroidJavaClass ga = new AndroidJavaClass("com.gameanalytics.sdk.GAPlatform");
            ga.CallStatic("initializeWithActivity", activity);
#endif

            GAPlatform platform = GetPlatform();

            GA_Wrapper.SetUnitySdkVersion("unity " + Settings.VERSION);
            GA_Wrapper.SetUnityEngineVersion("unity " + GetUnityVersion());

            if (platform != GAPlatform.None)
            {
                int index = (int)platform;
                GA_Wrapper.SetBuild(SettingsGA.Build[index - 1]);
            }

            if (SettingsGA.CustomDimensions01.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions01(SettingsGA.CustomDimensions01);
            }

            if (SettingsGA.CustomDimensions02.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions02(SettingsGA.CustomDimensions02);
            }

            if (SettingsGA.CustomDimensions03.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions03(SettingsGA.CustomDimensions03);
            }

            if (SettingsGA.ResourceItemTypes.Count > 0)
            {
                GA_Setup.SetAvailableResourceItemTypes(SettingsGA.ResourceItemTypes);
            }

            if (SettingsGA.ResourceCurrencies.Count > 0)
            {
                GA_Setup.SetAvailableResourceCurrencies(SettingsGA.ResourceCurrencies);
            }

            if (platform != GAPlatform.None)
            {
                int index = (int)platform;
                GA_Wrapper.Initialize(SettingsGA.GetGameKey(index - 1), SettingsGA.GetSecretKey(index - 1));
            }
            else
            {
                Debug.LogWarning("Unsupported platform: " + Application.platform);
            }
        }
Example #8
0
        private static void Initialize()
        {
            if (!Application.isPlaying)
            {
                return;                 // no need to setup anything else if we are in the editor and not playing
            }
            if (SettingsGA.InfoLogBuild)
            {
                GA_Setup.SetInfoLog(true);
            }

            if (SettingsGA.VerboseLogBuild)
            {
                GA_Setup.SetVerboseLog(true);
            }

            int platformIndex = GetPlatformIndex();

            GA_Wrapper.SetUnitySdkVersion("unity " + Settings.VERSION);
            GA_Wrapper.SetUnityEngineVersion("unity " + GetUnityVersion());

            if (platformIndex >= 0)
            {
                GA_Wrapper.SetBuild(SettingsGA.Build[platformIndex]);
            }

            if (SettingsGA.CustomDimensions01.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions01(SettingsGA.CustomDimensions01);
            }

            if (SettingsGA.CustomDimensions02.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions02(SettingsGA.CustomDimensions02);
            }

            if (SettingsGA.CustomDimensions03.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions03(SettingsGA.CustomDimensions03);
            }

            if (SettingsGA.ResourceItemTypes.Count > 0)
            {
                GA_Setup.SetAvailableResourceItemTypes(SettingsGA.ResourceItemTypes);
            }

            if (SettingsGA.ResourceCurrencies.Count > 0)
            {
                GA_Setup.SetAvailableResourceCurrencies(SettingsGA.ResourceCurrencies);
            }

            if (SettingsGA.UseManualSessionHandling)
            {
                SetEnabledManualSessionHandling(true);
            }

            if (platformIndex >= 0)
            {
                if (!SettingsGA.UseCustomId)
                {
                    GA_Wrapper.Initialize(SettingsGA.GetGameKey(platformIndex), SettingsGA.GetSecretKey(platformIndex));
                }
                else
                {
                    Debug.Log("Custom id is enabled. Initialize is delayed until custom id has been set.");
                }
            }
            else
            {
                Debug.LogWarning("Unsupported platform (or missing platform in settings): " + Application.platform);
            }
        }