コード例 #1
0
        public static void TryGetABTestPage(this HttpRequestBase httpRequest, Site site, out string pageVisitRuleName, out string matchedPage)
        {
            pageVisitRuleName = null;
            matchedPage       = null;
            var cookie = httpRequest.Cookies[Track_CookieName];

            if (cookie != null)
            {
                ABPageTestTrackingHelper.ParseTrackingToken(site, cookie.Value, out pageVisitRuleName, out matchedPage);
            }
        }
コード例 #2
0
        public override void OnResolvedPage(System.Web.Mvc.ControllerContext controllerContext, View.PageRequestContext pageRequestContext)
        {
            string pageVisitRuleName;
            string matchedPage;

            ABPageTestTrackingHelper.TryGetABTestPage(controllerContext.HttpContext.Request, pageRequestContext.Site, out pageVisitRuleName, out matchedPage);

            if (!string.IsNullOrEmpty(pageVisitRuleName) && !string.IsNullOrEmpty(matchedPage))
            {
                var pageVisitRule = _pageVisitRuleManager.Get(pageRequestContext.Site, pageVisitRuleName);
                if (pageVisitRule != null && !string.IsNullOrEmpty(pageVisitRule.ABTestGoalPage))
                {
                    if (pageVisitRule.ABTestGoalPage.EqualsOrNullEmpty(pageRequestContext.Page.FullName, StringComparison.OrdinalIgnoreCase))
                    {
                        _abPageTestResultManager.IncreaseHitTime(pageRequestContext.Site, pageVisitRuleName, matchedPage);
                    }
                }
            }
        }
コード例 #3
0
 public void OnMatched(PageMatchedContext matchedContext)
 {
     ABPageTestTrackingHelper.SetABTestPageCookie(matchedContext);
 }
コード例 #4
0
        public static void SetABTestPageCookie(PageMatchedContext matchedContext)
        {
            var trackingToken = ABPageTestTrackingHelper.ComposeTrackingToken(matchedContext);

            matchedContext.HttpContext.Response.SetCookie(new System.Web.HttpCookie(Track_CookieName, trackingToken));
        }