Exemple #1
0
 /// <summary>
 /// Raises an event to save the page data
 /// </summary>
 /// <param name="session"></param>
 /// <param name="page"></param>
 internal void RaiseSavePage(UserSession session, PageViewData page)
 {
     if (OnSavePage != null && page.SaveStatus == SaveStatus.RequiresSave)
     {
         OnSavePage(this, new UserPageViewArgs(session, page));
     }
 }
Exemple #2
0
        /// <summary>
        /// PageView is used whenever a user visits a page
        /// </summary>
        /// <param name="page">Current page being viewed</param>
        /// <param name="referrer">Current Referrer</param>
        /// <param name="isPostBack">Is Post Back</param>
        public void PageView(string page, string referrer, bool isPostBack)
        {
            using (TimedLock.Lock(_pageViewLockObject))
            {
                PageViewData newPageView = new PageViewData(page, referrer, isPostBack);
                _pageViews.Add(newPageView);

                if (UserSessionManager.SaveImmediately)
                {
                    newPageView.SaveStatus = Classes.SaveStatus.RequiresSave;
                    UserSessionManager.Instance.RaiseSavePage(this, newPageView);
                }
                else
                {
                    newPageView.SaveStatus = SaveStatus.Pending;
                }
            }

            int pages = _pageViews.Count - 1;

            if (pages >= 1)
            {
                // calculate page time for previous page
                PageViewData previousPage = _pageViews[pages - 1];
                previousPage.TotalTime = DateTime.UtcNow - previousPage.TimeStamp;

                // not a bounce as already moved onto another page
                if (Bounced)
                {
                    Bounced = false;
                }

                previousPage.SaveStatus = Classes.SaveStatus.RequiresSave;
                PageSaveStatus          = Classes.SaveStatus.RequiresSave;
            }

            CurrentPage = page;
        }