Skip to main content

DeepLinkAnalyticsService

A class in Root.Township, the global namespace.

Client: sends Oculus deep-link analytics events (start, join, fail, cancel) to the Alta API with the player's Oculus ID. All static; failures are logged and ignored.

Constructors​

MemberWhat it is
DeepLinkAnalyticsService()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

23 private and internal fields
MemberWhat it is
private const string CancelReasonKeyEvent field name for the cancel reason.
private const string DeepLinkCancelKeyEvent name for a cancelled deep link.
private const string DeepLinkFailKeyEvent name for a failed deep link.
private const string DeepLinkJoinKeyEvent name for a successful deep-link join.
private const string DeepLinkStartKeyEvent name for a deep link starting.
private static readonly Dictionary<string, object> eventDataFields for the event being built; cleared after each send.
private const string FailReasonKeyEvent field name for the fail reason.
private const string FirstTimePlayerKeyEvent field name for the first-time player flag.
private const string InsideServerKeyJoin source text when the player was in a game scene.
private static bool isFirstTimePlayerSet by SetFirstTimePlayer, cleared after any event is sent.
private const string JoinSourceKeyEvent field name for the join source.
private static Logger loggerNLog logger for send failures.
private const string MainMenuKeyJoin source text when the player was in the menu scene.
private static string oculusIdCached Oculus user ID sent with every event.
private const string OtherErrorKeyFail reason text for any other error.
private const string OutsideGameKeyJoin source text for any other scene.
private const string PlayerBannedKeyFail reason text for a ban.
private const string PlayerWasAlreadyInServerKeyCancel reason text when the player was already on that server.
private const string PrivateServerKeyFail reason text for a private server.
private const string ServerFullKeyFail reason text for a full server.
private const string ServerIdKeyEvent field name for the server ID.
private const string SkippedDeepLinkForTutorialKeyCancel reason text when the tutorial was done first.
private const string WrongVersionKeyFail reason text for a version mismatch.

Methods​

MemberWhat it is
static void CreateCancelEvent(DeepLinkAnalyticsService.DeeplinkEventCancelReason cancelReason)Sends a cancel event with the reason as text. Two overloads for the two cancel reason enums.
static void CreateCancelEvent(DeepLinkAnalyticsService.DeepLinkEventCancelReason cancelReason)Sends a cancel event with the reason as text. Two overloads for the two cancel reason enums.
static void CreateFailEvent(DeeplinkEventFailReason failReason, int? serverId)Sends a fail event with the reason as text and the server ID.
static void CreateJoinEvent(int? serverId)Sends a join event with the server ID and whether this is a first-time player.
static void CreateStartEvent()Sends a start event saying where the link was opened: main menu, inside a server, or outside the game.
static void SetFirstTimePlayer()Marks the next event as from a first-time player.
5 private and internal methods
MemberWhat it is
private static async void CreateDeepLinkEvent(string eventTypeKey, int? serverId)Gets the Oculus ID once, adds the server ID, posts the event, then clears the data and the first-time flag.
private static string GetCancelReasonAsFormattedString(DeepLinkAnalyticsService.DeeplinkEventCancelReason cancelReason)Turns a cancel reason into its readable text. Throws on unknown values.
private static string GetCancelReasonAsFormattedString(DeepLinkAnalyticsService.DeepLinkEventCancelReason cancelReason)Turns a cancel reason into its readable text. Throws on unknown values.
private static string GetFailReasonAsFormattedString(DeeplinkEventFailReason failReason)Turns a fail reason into its readable text. Throws on unknown values.
private static string GetJoinSourceAsFormattedString(string joinSceneName)Maps the active scene name to main menu, inside server or outside game.