/// <summary> /// Starts the session. /// </summary> public static void StartSession() { GA_Wrapper.StartSession(); }
/// <summary> /// Ends the session. /// </summary> public static void EndSession() { GA_Wrapper.EndSession(); }
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); } }
/// <summary> /// Sets the enabled manual session handling. /// </summary> /// <param name="enabled">If set to <c>true</c> enabled.</param> public static void SetEnabledManualSessionHandling(bool enabled) { GA_Wrapper.SetEnabledManualSessionHandling(enabled); }
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); } }
/// <summary> /// Sets the custom identifier. /// </summary> /// <param name="userId">User identifier.</param> public static void SetCustomId(string userId) { Debug.Log("Initializing with custom id: " + userId); GA_Wrapper.SetCustomUserId(userId); }
public static string GetConfigurationsContentAsString() { return(GA_Wrapper.GetConfigurationsContentAsString()); }
private static void CreateNewEvent(GAErrorSeverity severity, string message) { GA_Wrapper.AddErrorEvent(severity, message); }
public static bool IsCommandCenterReady() { return(GA_Wrapper.IsCommandCenterReady()); }
public static string GetCommandCenterValueAsString(string key, string defaultValue) { return(GA_Wrapper.GetCommandCenterValueAsString(key, defaultValue)); }
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); } }
/// <summary> /// Sets the enabled event submission. /// </summary> /// <param name="enabled">If set to <c>true</c> enabled.</param> public static void SetEnabledEventSubmission(bool enabled) { GA_Wrapper.SetEnabledEventSubmission(enabled); }
public static void NewEvent(GAResourceFlowType flowType, string currency, float amount, string itemType, string itemId) { GA_Wrapper.AddResourceEvent(flowType, currency, amount, itemType, itemId); }