Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add track for launch from dcl-editor #2476

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,38 @@ namespace DCL.PerformanceAndDiagnostics.Analytics
{
public class StaticCommonTraitsPlugin : EventPlugin
{
private const string DCL_EDITOR = "dcl-editor";

private readonly JsonElement sessionId;
private readonly JsonElement launcherAnonymousId;
private readonly JsonElement runtime;

private readonly JsonElement dclRendererType = SystemInfo.deviceType.ToString(); // Desktop, Console, Handeheld (Mobile), Unknown
private readonly JsonElement rendererVersion = Application.version;
private readonly JsonElement os = SystemInfo.operatingSystem;
private readonly JsonElement runtime;

public override PluginType Type => PluginType.Enrichment;

public StaticCommonTraitsPlugin(IAppArgs appArgs, LauncherTraits launcherTraits)
{
this.sessionId = !string.IsNullOrEmpty(launcherTraits.SessionId) ? launcherTraits.SessionId : SystemInfo.deviceUniqueIdentifier + DateTime.Now.ToString("yyyyMMddHHmmssfff");
this.launcherAnonymousId = launcherTraits.LauncherAnonymousId;
sessionId = !string.IsNullOrEmpty(launcherTraits.SessionId) ? launcherTraits.SessionId : SystemInfo.deviceUniqueIdentifier + DateTime.Now.ToString("yyyyMMddHHmmssfff");
launcherAnonymousId = launcherTraits.LauncherAnonymousId;

runtime = ChooseRuntime(appArgs);
}

private static string ChooseRuntime(IAppArgs appArgs)
{
if (Application.isEditor)
return "unity-editor";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we make all these literals const?


if (appArgs.HasFlag(DCL_EDITOR))
return DCL_EDITOR;

if (Debug.isDebugBuild || appArgs.HasDebugFlag())
return "debug";

runtime = Application.isEditor ? "editor" :
Debug.isDebugBuild || appArgs.HasDebugFlag() ? "debug" : "release";
return "release";
}

public override TrackEvent Track(TrackEvent trackEvent)
Expand Down