Exemplo n.º 1
0
        public Visit SpawnVisit()
        {
            var v = new Visit()
            {
                Group = this
            };

            v.UpdateState();

            var group = this;
            while (group != null)
            {
                if (group.Action != null)
                {
                    v.Action = group.Action;
                    break;
                }
                group = group.BaseGroup;
            }
            //if (PageSequenceGenerator != null)
            //{
            //    v.Pages.AddRange(PageSequenceGenerator.Generate(v));
            //}

            return v;
        }
Exemplo n.º 2
0
        private string GetUrl(Visit visit)
        {
            var url = ConversionUrl;
            if (UrlArguments != null)
            {
                var args = UrlArguments(visit);
                var q = url.IndexOf('?');
                url += (q != -1 && q != url.Length - 1 ? "&" : "") + args;
            }

            return url;
        }
        /// <summary>
        /// Call this method with the personalization rules that are relevant to the visitor to get the variations to show/include.        
        /// For example, if a personalization rule shows a sausage to German visitors then the rule should be included here only for Germans.                
        /// </summary>                
        public VisitContext CreateContext(Visit visit)
        {
            var key =
                DistributeEvenlyForSubGroups
                    ? _rules.Select((r, i) => r.IsRelevant(visit) ? 2L << i : 0)
                        .Aggregate(0L, (current, value) => current |= value)
                    : 0L;

            RoundRobinCounter counter;
            counter = _counters.TryGetValue(key, out counter)
                ? counter
                : _counters[key] = new RoundRobinCounter(new[] {Test.Experiences.Count});

            visit.UpdateState(Test.Experiences[counter.Next[0]]);
            return new VisitContext(this, visit);
        }
 public VisitContext CreateContext(Visit visit)
 {
     return new VisitContext(this, visit);
 }
Exemplo n.º 5
0
 public virtual string TransformUrl(string uri, Visit visit = null)
 {
     return(uri);
 }
Exemplo n.º 6
0
 protected abstract IVisitRequestContext <TResponseInfo> CreateVisitContext(Visit visit);
Exemplo n.º 7
0
 public Visit Resample(Visit visit, bool keepTags = true)
 {
     return keepTags ? visit.Clone() : visit.Group.SpawnVisit();
 }
Exemplo n.º 8
0
 public static TValue GetVariable <TValue>(this Visit obj, string key,
                                           TValue defaultValue = default(TValue))
 {
     return((TValue)obj.Variables.GetOrDefault(key, obj.Visitor.GetVariable(key, defaultValue)));
 }
Exemplo n.º 9
0
 public WebVisitContext(IVisitContextFactory factory, Visit visit)
     : base(factory, visit)
 {
     _webClient = new VisitWebClient(this);
     RequestData = new Dictionary<string, object>();
 }
Exemplo n.º 10
0
 public override bool IsRelevant(Visit visit)
 {
     return Filter.Include(visit);
 }