private void CreatePage(HttpContext httpContext, VisitorDataSet.VisitsRow visit) { VisitorDataSet.PagesRow row = visit.CreatePage(); var endDateTime = QueryStringHelper.SessionEndDateTime; if (endDateTime != DateTime.MinValue) visit.EndDateTime = endDateTime; VisitorDataSet.PagesDataTable table = (VisitorDataSet.PagesDataTable)row.Table; row.UrlText = WebUtil.GetRawUrl(); string urlText = row.UrlText; int length = urlText.IndexOfAny("?#".ToCharArray()); if (length >= 0) { urlText = urlText.Left(length); } row.Url = urlText.Right(table.UrlColumn.MaxLength); DeviceItem device = Context.Device; row.DeviceId = (device != null) ? device.ID.Guid : Guid.Empty; Item item = Context.Item; if (item != null) { row.ItemId = item.ID.Guid; row.ItemLanguage = item.Language.Name; row.ItemVersion = item.Version.Number; } }
// Methods private void Parse(HttpRequest request, VisitorDataSet.VisitsRow visit) { Assert.ArgumentNotNull(request, "request"); string urlReferrerValue = QueryStringHelper.SessionUrlReferrer; Uri urlReferrer = null; if (!String.IsNullOrEmpty(urlReferrerValue)) { if( !urlReferrerValue.StartsWith("http://") || !urlReferrerValue.StartsWith("https://") ) urlReferrerValue = "http://" + urlReferrerValue + HttpContext.Current.Request.Url.Query; urlReferrer = new Uri(urlReferrerValue); } else { urlReferrer = request.UrlReferrer; } if (urlReferrer == null) { visit.Keywords = Tracker.Visitor.DataContext.GetKeywords(string.Empty); visit.ReferringSite = Tracker.Visitor.DataContext.GetReferringSite(string.Empty); visit.Referrer = string.Empty; } else { visit.ReferringSite = Tracker.Visitor.DataContext.GetReferringSite(urlReferrer.Host); visit.Referrer = urlReferrer.ToString(); ParseReferrerArgs args2 = new ParseReferrerArgs { UrlReferrer = urlReferrer, Visit = visit }; ParseReferrerArgs args = args2; ParseReferrerPipeline.Run(args); if (visit.Keywords == null) { visit.Keywords = Tracker.Visitor.DataContext.GetKeywords(string.Empty); } } }