UrchinAnalyticsClient should exist for the scope of your application and is the primary entry point for tracking via Urchin.
        public void UrchinUriBuilder_GetFinalCustomVariables_Selects_Correct_Final_Variables()
        {
            var analyticsClient = new UrchinAnalyticsClient();
            analyticsClient.SessionCustomVariables[0] = new CustomVariable("session-one-name", "session-one-value");
            analyticsClient.SessionCustomVariables[2] = new CustomVariable("session-three-name", "session-three-value");
            analyticsClient.VisitorCustomVariables[0] = new CustomVariable("Visitor-one-name", "Visitor-one-value");
            analyticsClient.VisitorCustomVariables[1] = new CustomVariable("Visitor-two-name", "Visitor-two-value");

            var activityScopedVariables = new CustomVariableSlots();
            activityScopedVariables[0] = new CustomVariable("activity-one-name", "activity-one-value");
            activityScopedVariables[1] = new CustomVariable("activity-two-name", "activity-two-value");
            activityScopedVariables[3] = new CustomVariable("activity-four-name", "activity-four-value");

            var final = analyticsClient.GetFinalCustomVariables(activityScopedVariables).ToDictionary(s => s.Slot);

            Assert.AreEqual(CustomVariableScope.Visitor, final[0].Scope);
            Assert.AreEqual(CustomVariableScope.Visitor, final[1].Scope);
            Assert.AreEqual(CustomVariableScope.Session, final[2].Scope);
            Assert.AreEqual(CustomVariableScope.Activity, final[3].Scope);

            Assert.AreEqual("Visitor-one-name", final[0].Variable.Name);
            Assert.AreEqual("Visitor-two-name", final[1].Variable.Name);
            Assert.AreEqual("session-three-name", final[2].Variable.Name);
            Assert.AreEqual("activity-four-name", final[3].Variable.Name);
        }
 private static UrchinAnalyticsClient CreateSampleClient(Action<Uri> sender)
 {
     var configuration = new UrchinConfiguration("UA-1234-5", "FindHostName");
     var sessionManager = new SessionManager(TimeSpan.FromDays(1), null);
     var environment = new Environment("en-gb");
     var urchinAnalyticsClient = new UrchinAnalyticsClient();
     urchinAnalyticsClient.Configure(configuration, sessionManager, environment, sender);
     return urchinAnalyticsClient;
 }
        /// <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="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(UrchinConfiguration configuration, TimeSpan? uploadInterval = null)
        {
            Debug.Assert(Client == null);
            if (Client != null) return;

            await StartRequesterAsync(uploadInterval ?? TimeSpan.FromSeconds(5));
            await RestoreSessionAsync(TimeSpan.FromMinutes(20));

            Client = new UrchinAnalyticsClient(configuration, sessionManager, new WindowsStoreEnvironment(), requester.Add);
            Client.TrackEvent("Start", "ApplicationLifecycle");
            Client.TrackPageView("Home", "/");

            HookEvents();
        }