/// <summary> /// Start CSharpAnalytics by restoring the session state, starting the background sender, /// hooking up events to track and firing the application start event and home page view to analytics. /// Call this just before Window.Current.Activate() in your App.OnLaunched method. /// </summary> /// <param name="configuration">Configuration to use, must at a minimum specify your Google Analytics ID and app name.</param> /// <param name="appName">Application name to use for the user agent tracking.</param> /// <param name="uploadInterval">How often to upload to the server. Lower times = more traffic but realtime. Defaults to 5 seconds.</param> /// <returns>A Task that will complete once CSharpAnalytics is available.</returns> /// <example>await AutoAnalytics.StartAsync(new Configuration("UA-123123123-1", "myapp.someco.com"));</example> public static async Task StartAsync(Configuration configuration, string appName, TimeSpan? uploadInterval = null) { currentAppName = appName; await StartRequesterAsync(uploadInterval ?? TimeSpan.FromSeconds(5)); await RestoreSessionAsync(configuration.SessionTimeout); Client = new AnalyticsClient(configuration, sessionManager, new WindowsStoreEnvironment(), requester.Add); Client.TrackEvent("ApplicationLifecycle", "Start"); Client.TrackPageView("Home", "/"); HookEvents(Application.Current); }