Skip to content

Commit

Permalink
Updated to v7.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dorin-ga committed Nov 28, 2023
1 parent 220793a commit eac66f4
Show file tree
Hide file tree
Showing 13 changed files with 129 additions and 136 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
---------
<!--(CHANGELOG_TOP)-->
**7.7.2**
* added optional external user id:increased resource currency limit from 20 to 50

**7.7.1**
* fixed a bug in the android user-id generation

Expand Down
126 changes: 0 additions & 126 deletions Editor/GA_SettingsInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ public class GA_SettingsInspector : UnityEditor.Editor
private GUIContent _infoLogBuild = new GUIContent("Info Log Build", "Show info messages from GA in builds (f.x. Xcode for iOS).");
private GUIContent _verboseLogBuild = new GUIContent("Verbose Log Build", "Show full info messages from GA in builds (f.x. Xcode for iOS). Noet that this option includes long JSON messages sent to the server.");
private GUIContent _useManualSessionHandling = new GUIContent("Use manual session handling", "Manually choose when to end and start a new session. Note initializing of the SDK will automatically start the first session.");

private GUIContent _enableSDKInitEvent = new GUIContent("Enable Startup Metrics", "Enables automatic startup performance data collection. This includes: application's boot time, general device specs (such as cpu model, number of cores, total memory, device resolution) and if this was the first time the user booted this application.");
private GUIContent _enableHealthEvent = new GUIContent("Enable Session Performance Metrics", "Enables automatic performance data collection across the whole session. This includes sampling fps, memory consumption & cpu usage without any noticeable performance impact.");

private GUIContent _enableAppBootTracking = new GUIContent("Boot time", "Will collect data on application start-up time (from launch until GameAnalytics has been initialized)");
private GUIContent _enableMemoryTracking = new GUIContent("Memory Snapshots", "Performance & error events will take memory usage snapshots");
private GUIContent _enableHardwareTracking = new GUIContent("Hardware Info", "Data about the user's hardware info and usage will be collected");
private GUIContent _enableFPSHistogram = new GUIContent("FPS Histogram", "Samples FPS across the whole session and compiles a histogram");
private GUIContent _enableMemoryHistogram = new GUIContent("Memory Usage Histogram", "Samples memory usage across the whole session & compiles a histogram");

#if UNITY_5_6_OR_NEWER
private GUIContent _usePlayerSettingsBunldeVersionForBuild = new GUIContent("Send Version* (Android, iOS) as build number", "The SDK will automatically fetch the version* number on Android and iOS and send it as the GameAnalytics build number.");
#else
Expand Down Expand Up @@ -82,10 +72,6 @@ public class GA_SettingsInspector : UnityEditor.Editor
private bool _debugSettingsIconOpen = false;
private GUIContent _debugSettingsIconMsg = new GUIContent("Debug settings allows you to enable info log for the editor or for builds (Xcode, etc.). Enabling verbose logging will show additional JSON messages in builds.");

private GUIContent _healthEventIcon;
private bool _healthEventIconOpen = false;
private GUIContent _healthEventIconMsg = new GUIContent("Enable automatic collection of performance metrics. Those will give you insight into your application's general performance such as fps, memory consumption and user hadrware");

private GUIContent _deleteIcon;
private GUIContent _homeIcon;
private GUIContent _infoIcon;
Expand Down Expand Up @@ -176,11 +162,6 @@ void OnEnable()
_debugSettingsIcon = new GUIContent(ga.InfoIcon, "Debug Settings.");
}

if (_healthEventIcon == null)
{
_healthEventIcon = new GUIContent(ga.InfoIcon, "Performance Metrics.");
}

if (_deleteIcon == null)
{
_deleteIcon = new GUIContent(ga.DeleteIcon, "Delete.");
Expand Down Expand Up @@ -1542,113 +1523,6 @@ public override void OnInspectorGUI()
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();

const int layoutWidth = 35;
const int btnSize = 12;

GUILayout.BeginVertical("Performance");

GUILayout.BeginHorizontal();
//GUILayout.Space(-4);
GUILayout.Label("Performance Metrics (EXPERIMENTAL)", EditorStyles.largeLabel);

if (GUILayout.Button(_healthEventIcon, EditorStyles.iconButton, new GUILayoutOption[] {
GUILayout.Width(btnSize),
GUILayout.Height(btnSize)
}))
{
_healthEventIconOpen = !_healthEventIconOpen;
}
GUILayout.EndHorizontal();

if (_healthEventIconOpen)
{
GUILayout.BeginHorizontal();
TextAnchor tmpAnchor = GUI.skin.box.alignment;
GUI.skin.box.alignment = TextAnchor.UpperLeft;
Color tmpColor = GUI.skin.box.normal.textColor;
GUI.skin.box.normal.textColor = new Color(0.7f, 0.7f, 0.7f);
RectOffset tmpOffset = GUI.skin.box.padding;
GUI.skin.box.padding = new RectOffset(6, 6, 5, 32);
GUILayout.Box(_healthEventIconMsg);
GUI.skin.box.alignment = tmpAnchor;
GUI.skin.box.normal.textColor = tmpColor;
GUI.skin.box.padding = tmpOffset;
GUILayout.EndHorizontal();

Rect tmpRect = GUILayoutUtility.GetLastRect();
if (GUI.Button(new Rect(tmpRect.x + 5, tmpRect.y + tmpRect.height - 25, 80, 20), "Learn more"))
{
Application.OpenURL("https://docs.gameanalytics.com");
}
}

EditorGUILayout.Space();

GUILayout.BeginHorizontal();
GUILayout.Label(_enableHardwareTracking);
ga.EnableHardwareTracking = EditorGUILayout.Toggle("", ga.EnableHardwareTracking, GUILayout.Width(layoutWidth));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label(_enableMemoryTracking);
ga.EnableMemoryTracking = EditorGUILayout.Toggle("", ga.EnableMemoryTracking, GUILayout.Width(layoutWidth));
GUILayout.EndHorizontal();

EditorGUILayout.Space();
EditorGUILayout.Space();

GUILayout.BeginVertical("Startup Performance");

GUILayout.BeginHorizontal();
GUILayout.Space(-12);
EditorGUILayout.LabelField("Startup Performance", EditorStyles.boldLabel);
GUILayout.EndHorizontal();

EditorGUILayout.Space();

GUILayout.BeginHorizontal();
GUILayout.Label(_enableSDKInitEvent);
ga.EnableSDKInitEvent = EditorGUILayout.Toggle("", ga.EnableSDKInitEvent, GUILayout.Width(layoutWidth));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label(_enableAppBootTracking);
ga.EnableAppBootTimeTracking = EditorGUILayout.Toggle("", ga.EnableAppBootTimeTracking, GUILayout.Width(layoutWidth));
GUILayout.EndHorizontal();

GUILayout.EndVertical();

EditorGUILayout.Space();
EditorGUILayout.Space();

GUILayout.BeginVertical("Session Performance");

GUILayout.BeginHorizontal();
GUILayout.Space(-12);
EditorGUILayout.LabelField("Session Performance", EditorStyles.boldLabel);
GUILayout.EndHorizontal();

EditorGUILayout.Space();

GUILayout.BeginHorizontal();
GUILayout.Label(_enableHealthEvent);
ga.EnableHealthEvent = EditorGUILayout.Toggle("", ga.EnableHealthEvent, GUILayout.Width(layoutWidth));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label(_enableFPSHistogram);
ga.EnableFPSHistogram = EditorGUILayout.Toggle("", ga.EnableFPSHistogram, GUILayout.Width(layoutWidth));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label(_enableMemoryHistogram);
ga.EnableMemoryHistogram = EditorGUILayout.Toggle("", ga.EnableMemoryHistogram, GUILayout.Width(layoutWidth));
GUILayout.EndHorizontal();

GUILayout.EndVertical();

GUILayout.EndVertical();
}
#endregion // Settings.InspectorStates.Pref
}
Expand Down
Binary file modified Runtime/Android/gameanalytics.aar
Binary file not shown.
23 changes: 23 additions & 0 deletions Runtime/Scripts/GameAnalytics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,24 @@ public static String GetUserId()
return GA_Wrapper.getUserId();
}

/// <summary>
/// gets the current external user id (if any)
/// </summary>
public static String GetExternalUserId()
{
return GA_Wrapper.GetExternalUserId();
}

/// <summary>
/// Sets an optional external user id. Will be attached to every event. Has no impact on the GA process
/// Can be set or changed at any time
/// </summary>
/// <param name="externalUserId">External User identifier.</param>
public static void SetExternalUserId(string externalUserId)
{
GA_Wrapper.SetExternalUserId(externalUserId);
}

/// <summary>
/// Sets the enabled manual session handling.
/// </summary>
Expand Down Expand Up @@ -1002,6 +1020,11 @@ public static string GetRemoteConfigsContentAsString()
return GA_Wrapper.GetRemoteConfigsContentAsString();
}

public static string GetRemoteConfigsContentAsJSON()
{
return GA_Wrapper.GetRemoteConfigsContentAsJSON();
}

// ----------------------- A/B TESTING ---------------------- //
public static string GetABTestingId()
{
Expand Down
10 changes: 1 addition & 9 deletions Runtime/Scripts/Setup/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public struct HelpInfo
/// The version of the GA Unity Wrapper plugin
/// </summary>
[HideInInspector]
public static string VERSION = "7.7.1";
public static string VERSION = "7.7.2";

[HideInInspector]
public static bool CheckingForUpdates = false;
Expand Down Expand Up @@ -134,14 +134,6 @@ public struct HelpInfo
public bool SendExampleGameDataToMyGame = false;
//public bool UseBundleVersion = false;

public bool EnableSDKInitEvent = false;
public bool EnableHealthEvent = false;
public bool EnableHardwareTracking = false;
public bool EnableMemoryTracking = false;
public bool EnableFPSHistogram = false;
public bool EnableMemoryHistogram = false;
public bool EnableAppBootTimeTracking = false;

public bool InternetConnectivity;

public List<string> CustomDimensions01 = new List<string>();
Expand Down
10 changes: 10 additions & 0 deletions Runtime/Scripts/Wrapper/GA_AndroidWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ private static string getABTestingVariantId()
return GA.CallStatic<string>("getABTestingVariantId");
}

private static string getExternalUserId()
{
return GA.CallStatic<string>("getExternalUserId");
}

private static void configureExternalUserId(string externalUserId)
{
GA.CallStatic("configureExternalUserId", externalUserId);
}

private static void startTimer(string key)
{
GA.CallStatic("startTimer", key);
Expand Down
28 changes: 28 additions & 0 deletions Runtime/Scripts/Wrapper/GA_Wrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,16 @@ public static string GetRemoteConfigsContentAsString()
return getRemoteConfigsContentAsString();
}

public static string GetRemoteConfigsContentAsJSON()
{
#if UNITY_IOS && !(UNITY_EDITOR)
return getRemoteConfigsContentAsJSON();
#else
return GetRemoteConfigsContentAsString();
#endif
}


public static string GetABTestingId()
{
return getABTestingId();
Expand All @@ -663,6 +673,24 @@ public static string GetABTestingVariantId()
return getABTestingVariantId();
}

public static void SetExternalUserId(string userId)
{
#if (UNITY_IOS || UNITY_ANDROID) && !(UNITY_EDITOR)
configureExternalUserId(userId);
#else
return;
#endif
}

public static string GetExternalUserId()
{
#if (UNITY_IOS || UNITY_ANDROID) && !(UNITY_EDITOR)
return getExternalUserId();
#else
return "";
#endif
}

private static string DictionaryToJsonString(IDictionary<string, object> dict)
{
Hashtable table = new Hashtable();
Expand Down
11 changes: 11 additions & 0 deletions Runtime/Scripts/Wrapper/GA_iOSWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public partial class GA_Wrapper
[DllImport ("__Internal")]
private static extern void configureUserId(string userId);

[DllImport ("__Internal")]
private static extern void configureExternalUserId(string userId);

[DllImport ("__Internal")]
private static extern void configureAutoDetectAppVersion(bool flag);

Expand Down Expand Up @@ -121,6 +124,10 @@ public partial class GA_Wrapper
[return: MarshalAs(UnmanagedType.LPStr)]
private static extern string getRemoteConfigsContentAsString();

[DllImport ("__Internal")]
[return: MarshalAs(UnmanagedType.LPStr)]
private static extern string getRemoteConfigsContentAsJSON();

[DllImport ("__Internal")]
[return: MarshalAs(UnmanagedType.LPStr)]
private static extern string getABTestingId();
Expand All @@ -145,6 +152,10 @@ public partial class GA_Wrapper
[return: MarshalAs(UnmanagedType.LPStr)]
public static extern string getUserId();

[DllImport ("__Internal")]
[return: MarshalAs(UnmanagedType.LPStr)]
public static extern string getExternalUserId();

[DllImport ("__Internal")]
public static extern void useRandomizedId(bool flag);

Expand Down
37 changes: 37 additions & 0 deletions Runtime/iOS/GameAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,23 @@ typedef enum GAAdError : NSInteger
*/
+ (void)configureUserId:(NSString *)userId;

/*!
@method
@abstract Set a custom external unique user_id identifying the user.
Has no impact on any GA process, but will be added to every event
Can be changed at any point
@discussion <i>Example usage:</i>
<pre><code>
[GameAnalytics configureExternalUserId:@"24566"];
</code></pre>
@param userId
(String max length=64)
*/
+ (void)configureExternalUserId:(NSString *)userId;

/* @IF WRAPPER */

/*
Expand Down Expand Up @@ -1558,6 +1575,17 @@ typedef enum GAAdError : NSInteger
*/
+ (NSString *)getRemoteConfigsContentAsString;

/*!
@method
@abstract Get remote configs configurations as a valid json
@availability Available since (TBD)
@attribute For internal use.
*/
+ (NSString *)getRemoteConfigsContentAsJSON;

/*!
@method
Expand Down Expand Up @@ -1587,6 +1615,15 @@ typedef enum GAAdError : NSInteger
*/
+ (NSString *)getUserId;

/*!
@method
@abstract Get the external user id
@availability Available since (TBD)
*/
+ (NSString *)getExternalUserId;

/*!
@method
Expand Down
Loading

0 comments on commit eac66f4

Please sign in to comment.