-
Notifications
You must be signed in to change notification settings - Fork 0
Unity Analytics
Got a "Heads up!" warning and you ended up here? Scroll all the way down for your solution.
- This page describes the legacy, deprecated Unity Analytics (UA) that no longer accepts integration of new projects.
- If you haven't linked your project to Unity Analytics by June 22, 2021, this is not the page you are looking for.
- UniSwitcher 1.2.3 and later supports the new analytics system that succeeded UA. Please refer to this page for information about tracking Scene changes by UniSwitcher by the new Analytics.
- If you have, you may read on to start tracking scene changes, but keep in mind that Unity will eventually shut down this legacy system and it is recommended that you migrate to UGS Analytics.
- If you haven't linked your project to Unity Analytics by June 22, 2021, this is not the page you are looking for.
This plugin supports Unity Analytics. When UniSwitcher detects UA is enabled, it can send the 'ScreenVisit' event whenever PerformSceneTransition is called.
If you want to track scene switch events, you need to add UniSwitcher.Domain.IReportable to your BaseScene implementation.
Unity Analytics has a rate limit on the number of events sent per set time.
Since UniSwitcher reports every scene change (its destination) using AnalyticsEvent.ScreenVisit by default, too many scene changes in a short period can easily cause the game to hit the rate limit. Such change can occur if you implement, e.g., a dialog scene that can occur multiple times.
By implementing IReportable, you can suppress the scene transition event sent to Unity Analytics.
The interface IReportable requires implementing the DoNotReport method.
This method indicates Scenes that should not be reported of their transitions, e.g., scenes that contain dialogs.
public class Scene: BaseScene, IReportable
{
// Your implementation here
/// <summary>
/// If this returns true, DO NOT SEND ANALYTICS REPORT.
/// </summary>
/// <returns></returns>
public bool DoNotReport()
{
var self = this;
return NonReportingScenes().Any(scene => self == scene);
}
// Suppose that this is your pause dialog scene.
public static Scene PauseDialog => new Scene("pause_dialog.unity");
/// <summary>
/// Scenes you DON'T want to send analytics reports about
/// because, e.g., it can be loaded in quick succession.
/// NOTE: This is just one way to implement this behavior;
/// if you have a better idea, you may use it instead.
/// </summary>
/// <returns></returns>
private static IEnumerable<Scene> NonReportingScenes()
{
// List all scenes you want to suppress using 'yield return.'
yield return PauseDialog;
}
}This plugin can send Analytics events to Unity Analytics when Scene transitions occur. You received this message because UniSwitcher detected the "Analytics Library" package in your Unity project.
⬇️ Choose the headings that best describe your situation, and follow the instructions to get rid of this message. ⬇️
In this case, it is best that you remove the "Analytics Library" package (com.unity.analytics) entirely from your Unity project.
Use Package Manager to remove it.
In this case, you can suppress the "Heads up!" message by overriding this member in your BaseScene class.
public class MyScene: BaseScene {
// Set this member to true to suppress the message entirely.
public override bool SuppressEvent => true;
}Please follow the instruction above on this page (note: Unity Analytics is deprecated and migration to UGS Analytics is recommended.)