A class in Root.Township, ATT.Analytics.
Analytics dispatcher that posts each analytics event to the Alta API as a generic event with the logged-in user's ID. Runs off the main thread.
Constructors
| Member | What it is |
|---|
AltaAnalyticsDispatcher(IAnalyticsService analyticsService) | Built by the game's dependency injection (VContainer), which passes the services in. |
Fields
3 private and internal fields
| Member | What it is |
|---|
private static readonly Logger logger | NLog logger for this class. |
private static readonly StringBuilder stringBuilder | Shared builder used by LogPretty. |
private static int userId | Cached user ID, -1 until read. |
Properties
1 private and internal property
| Member | What it is |
|---|
private static int UserId { get; } | Logged-in user's ID, cached after the first read until logout. |
Methods
| Member | What it is |
|---|
protected override void OnAnalyticsEvent(IReadonlyAnalyticsData data) | Sends the event on a background task. |
3 private and internal methods
| Member | What it is |
|---|
private static void LoggedOut() | Clears the cached user ID when the user logs out. |
private static void LogPretty(string dataName, Dictionary<string, object> props) | Logs the sent event name and its properties at debug level. |
private static async Task SendData(IReadonlyAnalyticsData data) | Turns the event's properties into a dictionary and posts it with PostGenericEventAsync. Errors are logged. |