Пример #1
0
        public void HandleAddToCartCTATags(WesofHtmlTag[] Tags, ref ServerResponse sRep)
        {
            //Check if the clients currently assigned MVT's are addtocart tests
            Variation[] relevantTestAssignments = MVTHistory.MatchLiveMVTWithTestType(sRep.Cookie.ModifiedMVTAssignments, TestTypesEnum.ADDTOCARTBUTTON);
            if (relevantTestAssignments != null)
            {
                //Todo, the client is already assigned to live AddToCartButton test(s)
                for (int i = 0; i < relevantTestAssignments.Length; i++)
                {
                    relevantTestAssignments[i].ApplyModification(ref Tags, ref sRep);
                }

                return;
            }


            //Check if there is already a live mvt that experiments with the add to cart.
            int assignToMVTId = MVTHistory.GetSuitableLiveMVTforNewGUIDAssignment(TestTypesEnum.ADDTOCARTBUTTON);
            int assignToVariation;

            if (assignToMVTId == -1)
            {
                //No suitable live MVT found. Generate a new one.
                assignToMVTId = CreateNewAddToCartMVT();
            }

            //Check if a test is available
            if (assignToMVTId > -1)
            {
                assignToVariation = AssignGuidToMVT(assignToMVTId, sRep.Cookie.Wesof_GUID, ref sRep);
                if (assignToVariation > -1)
                {
                    Variation v = MVTHistory.GetVariant(assignToMVTId, assignToVariation);
                    if (v != null)
                    {
                        v.ApplyModification(ref Tags, ref sRep);
                    }
                    else
                    {
                        if (Configuration.IsDebugModeOn)
                        {
                            _CLI.Out("Error. Expected variation object, returned null.", true, false);
                        }
                    }
                }
            }
            else
            {
                //Check if all the possible variations tested
                if (AddToCartButton.IsAllVariationTested())
                {
                    //Let's apply the winning variant.
                    AddToCartButton.ApplyChangesBasedOnLatestWinner(ref Tags, ref sRep);
                }
            }

            _CLI.RefreshStatDashboard();
        }
Пример #2
0
        internal static void IncrementConversionOnGuid(string guid)
        {
            for (int i = 0; i < _History.Count; i++)
            {
                if (_History[i].IsActive)
                {
                    Variation v = _History[i].GetVariantWithGuid(guid);
                    if (v != null)
                    {
                        bool previousConversionState = v.ConvertGuid(guid);

                        if (previousConversionState == false)
                        {
                            UpdateTestAnalysis(_History[i]);
                        }
                    }
                }
            }

            _CLI.RefreshStatDashboard();
        }