/// <summary> /// Use for persisted user session mode can guarantee uniqueness by machine+user /// </summary> /// <param name="domain"></param> /// <param name="trackingCode"></param> /// <param name="randomNumber">Random number that was generated on first launch</param> /// <param name="recentVisitCount">Recent visit count, must be incremented before passing in</param> /// <param name="firstVisitTimeStamp">Timestamp for first session</param> public AnalyticsClient(string domain, string trackingCode, int randomNumber, int recentVisitCount, DateTime?firstVisitTimestamp) { _sessionVariables = new VariableBucket(); Timestamp = ConvertToUnixTimestamp(DateTime.Now).ToString(); Domain = domain; RandomNumber = randomNumber.ToString(); TrackingCode = trackingCode; FirstSessionTimestamp = firstVisitTimestamp.HasValue ? ConvertToUnixTimestamp(firstVisitTimestamp.Value).ToString() : Timestamp; VisitCount = recentVisitCount; }
/// <summary> /// Use for persisted user session mode can guarantee uniqueness by machine+user /// </summary> /// <param name="domain"></param> /// <param name="trackingCode"></param> /// <param name="randomNumber">Random number that was generated on first launch</param> /// <param name="recentVisitCount">Recent visit count, must be incremented before passing in</param> /// <param name="firstVisitTimeStamp">Timestamp for first session</param> public AnalyticsClient(string domain, string trackingCode, int randomNumber, int recentVisitCount, DateTime? firstVisitTimestamp) { _sessionVariables = new VariableBucket(); Timestamp = ConvertToUnixTimestamp(DateTime.Now).ToString(); Domain = domain; RandomNumber = randomNumber.ToString(); TrackingCode = trackingCode; FirstSessionTimestamp = firstVisitTimestamp.HasValue ? ConvertToUnixTimestamp(firstVisitTimestamp.Value).ToString() : Timestamp; VisitCount = recentVisitCount; }
public void SubmitPageView(string page, string title, VariableBucket pageVariables) { var client = CreateBrowser(page, title); var variables = _sessionVariables.MergeWith(pageVariables); if (variables.Any()) { client.QueryString["utme"] = variables.ToUtme(); } ThreadPool.QueueUserWorkItem(state => { client.DownloadDataAsync(new Uri("__utm.gif", UriKind.Relative)); }); }
public VariableBucket MergeWith(VariableBucket other) { var variables = new KeyValuePair <string, string>?[5]; _variables.CopyTo(variables, 0); for (int i = 0; i < 5; i++) { if (other._variables[i] != null) { variables[i] = other._variables[i]; } } return(new VariableBucket(variables)); }
public VariableBucket MergeWith(VariableBucket other) { var variables = new KeyValuePair<string, string>?[5]; _variables.CopyTo(variables, 0); for (int i = 0; i < 5; i++) { if (other._variables[i] != null) { variables[i] = other._variables[i]; } } return new VariableBucket(variables); }
public void SubmitEvent(string page, string title, string category, string action, string label, string value, VariableBucket pageVariables) { var client = CreateBrowser(page, title); client.QueryString["utmt"] = "event"; client.QueryString["utme"] = FormatUtme(category, action, label, value); var variables = _sessionVariables.MergeWith(pageVariables); if (variables.Any()) { client.QueryString["utme"] += variables.ToUtme(); } ThreadPool.QueueUserWorkItem(state => { client.DownloadDataAsync(new Uri("__utm.gif", UriKind.Relative)); }); }
public void SubmitPageView(string page, string title, VariableBucket pageVariables) { var client = CreateBrowser(page, title); var variables = _sessionVariables.MergeWith(pageVariables); if (variables.Any()) client.QueryString["utme"] = variables.ToUtme(); ThreadPool.QueueUserWorkItem(state => { client.DownloadDataAsync(new Uri("__utm.gif", UriKind.Relative)); }); }
public void SubmitEvent(string page, string title, string category, string action, string label, string value, VariableBucket pageVariables) { var client = CreateBrowser(page, title); client.QueryString["utmt"] = "event"; client.QueryString["utme"] = FormatUtme(category, action, label, value); var variables = _sessionVariables.MergeWith(pageVariables); if (variables.Any()) client.QueryString["utme"] += variables.ToUtme(); ThreadPool.QueueUserWorkItem(state => { client.DownloadDataAsync(new Uri("__utm.gif", UriKind.Relative)); }); }