Beispiel #1
0
        /// <summary>
        /// Processes the specified arguments.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public override void Process(InitializeTrackerArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            if (args.IsSessionEnd)
            {
                return;
            }

            HttpContextBase httpContext = args.HttpContext;

            if (httpContext == null)
            {
                args.AbortPipeline();
                return;
            }

            this.CreateAndInitializePage(args.Session.Interaction);
        }
        public override void Process(InitializeTrackerArgs args)
        {
            try
            {
                Sitecore.Diagnostics.Assert.ArgumentNotNull(args, "args");
                HttpContext current = HttpContext.Current;

                if (current == null)
                {
                    args.AbortPipeline();
                }
                else
                {
                    Visitor visitor = Tracker.Visitor;
                    if (visitor.Settings.IsNew)
                    {
                        this.CreateVisitor(args, visitor);
                    }

                    VisitorDataSet.VisitsRow visit = null;
                    if (!visitor.Settings.IsFirstRequest)
                    {
                        visit = visitor.GetCurrentVisit();
                    }
                    if (visit == null)
                    {
                        visit = this.CreateVisit(current, visitor);
                    }

                    var startDateTime = QueryStringHelper.SessionStartDateTime;

                    if (startDateTime != DateTime.MinValue)
                        visit.StartDateTime = startDateTime;

                    this.CreatePage(current, visit);
                }
            }
            catch (Exception exp)
            {
                Sitecore.Diagnostics.Log.Error("Traffic generator initialize pipeline: " + exp.InnerException, this);
            }
        }
        /// <summary>
        /// Processes the specified HttpRequest pipeline arguments.
        /// </summary>
        /// <param name="args">The HttpRequest arguments.</param>
        public override void Process(InitializeTrackerArgs args)
        {
            Assert.ArgumentNotNull(args, nameof(args));

            // Ignore requests if itemresolver should not be applied (see method for details).
            if (this.IgnoreRequest(args))
            {
                return;
            }

            var httpContext = args.HttpContext;

            if (httpContext == null)
            {
                args.AbortPipeline();
                return;
            }


            this.CreateAndInitializePage(httpContext, args.Session.Interaction);
        }
        public override void Process(InitializeTrackerArgs args)
        {
            if (HttpContext.Current == null)
            {
                args.AbortPipeline();
                return;
            }

            //no need to restart visit if visit is new
            if (Tracker.Visitor.Settings.IsNew || Tracker.Visitor.Settings.IsFirstRequest || Tracker.CurrentVisit.VisitPageCount < 1)
            {
                return;
            }

            //look for campaign id in query string
            Guid campaign;
            var  campaignStr = WebUtil.GetQueryString(Settings.GetSetting("Analytics.CampaignQueryStringKey")).Trim();

            if (string.IsNullOrEmpty(campaignStr) || !Guid.TryParse(campaignStr, out campaign))
            {
                return;
            }

            //don't restart if the campaign isn't changing
            if (!Tracker.CurrentVisit.IsCampaignIdNull() && Tracker.CurrentVisit.CampaignId == campaign)
            {
                return;
            }

            var current = HttpContext.Current;
            var cookie  = current.Response.Cookies["SC_ANALYTICS_SESSION_COOKIE"];

            if (cookie == null)
            {
                cookie = new HttpCookie("SC_ANALYTICS_SESSION_COOKIE");
                current.Response.Cookies.Add(cookie);
            }
            cookie.Value = "";
        }