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); } }
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); } } } }
public void OnMatched(PageMatchedContext matchedContext) { ABPageTestTrackingHelper.SetABTestPageCookie(matchedContext); }
public static void SetABTestPageCookie(PageMatchedContext matchedContext) { var trackingToken = ABPageTestTrackingHelper.ComposeTrackingToken(matchedContext); matchedContext.HttpContext.Response.SetCookie(new System.Web.HttpCookie(Track_CookieName, trackingToken)); }