Beispiel #1
0
        private int?GetObjectGroupID(ref string[] headerOptions)
        {
            foreach (string prop in headerOptions)
            {
                if (prop.ToUpper().Contains(Configuration.TAG_OBJECTGROUPID))
                {
                    char[]   sepearator = { ':' };
                    string[] value      = prop.Split(sepearator, StringSplitOptions.RemoveEmptyEntries);

                    if (value.Length == 2)
                    {
                        int?result = null;
                        try
                        {
                            result = int.Parse(value[1]);
                        } catch
                        {
                            if (Configuration.IsDebugModeOn)
                            {
                                _CLI.Out("Error. Cannot convert objectGroupID to number from string.");
                            }
                            return(null);
                        }
                        return(result);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            return(null);
        }
Beispiel #2
0
        public static void UnAsssignGUIDfromFinishedTests(ref ServerResponse sRep)
        {
            if (sRep.Cookie.ModifiedMVTAssignments == null)
            {
                return;
            }

            for (int i = 0; i < sRep.Cookie.ModifiedMVTAssignments.Length; i++)
            {
                string s = sRep.Cookie.ModifiedMVTAssignments[i];

                string[] tmp   = s.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
                int      index = IndexById(int.Parse(tmp[0]));

                //check if this is a valid mvt id
                if (index == -1)
                {
                    sRep.Cookie.ModifiedMVTAssignments[i] = String.Empty;
                    if (Configuration.IsDebugModeOn)
                    {
                        _CLI.Out("Cannot find the MVT id sent by the client.", true, false);
                    }

                    continue;
                }

                //Check if the MVT is still live
                if (_History[index].IsActive == false)
                {
                    sRep.Cookie.ModifiedMVTAssignments[i] = String.Empty;
                }
            }

            sRep.Cookie.CleanUpModifiedMVTList();
        }
        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();
        }
        public static AddToCartButtonVariation GetVariant(int id, ref string original)
        {
            //Check if the id is 0. If it is, this is considered to be the absolute control.
            if (id == 0)
            {
                //Keep the modified and unmodified text the same. This is has some performance hit.
                AbsoluteControl.UnModified = original;
                AbsoluteControl.Modified   = original;
                return(AbsoluteControl);
            }



            int idIndex = 0;

            for (idIndex = 0; idIndex < Variations.Capacity; idIndex++)
            {
                if (Variations[idIndex].id == id)
                {
                    break;
                }
            }

            //Could not find variation with the ID number
            if (idIndex == Variations.Capacity)
            {
                if (Configuration.IsDebugModeOn)
                {
                    _CLI.Out("AddToCartButton: Cannot find the variant with id: " + id.ToString() + "):\n", true, false);
                }

                return(null);
            }

            GenerateVariant(idIndex, original);
            return(Variations[idIndex]);
        }
Beispiel #5
0
        public static void PrintStats(CommandLineInterface _CLI)
        {
            string result = "\n\n********** MVT STATS **********\n\n";


            int TotalMVTs = MVTHistory.GetMVTCount(false);
            int LiveMVTs  = MVTHistory.GetMVTCount(true);

            result += "Total MVTs: " + TotalMVTs.ToString() + "\n";
            result += "Live MVTs: " + LiveMVTs.ToString() + "\n";

            if (LiveMVTs == 0)
            {
                result += "\n\n********** MVT STATS **********\n\n";
                _CLI.Out(result, false, false);
                return;
            }

            MultiVariateTest[] LiveTests = MVTHistory.GetLiveTests();

            if (LiveTests == null || LiveTests.Length == 0)
            {
                result += "\n\n********** MVT STATS **********\n\n";

                //No live tests found, check if all completed.
                result += "\n No live tests running currently.\n";
                if (AddToCartButton.IsAllVariationTested())
                {
                    result += "All the 'Add To Cart Button' type variants have been tested. The best performing variant is live on 100%.";
                }

                _CLI.Out(result, false, false);
                return;
            }



            for (int i = 0; i < LiveTests.Length; i++)
            {
                result += "\n----\n";

                result += "MVT ID: " + LiveTests[i].Id.ToString() + "\n";
                result += "Variant number (including control): " + LiveTests[i].GetNumberOfVariants().ToString() + "\n";
                result += "Launch date: " + LiveTests[i].GetLaunchDateTime.ToString() + "\n\n";

                MVTResult testResult = LiveTests[i].GetResult;
                if (testResult != null)
                {
                    result += "Variants (including control): " + testResult.Variants.ToString() + "\n";
                    result += "Any variant reached significance: " + testResult.ReachedSignificance.ToString() + "\n";


                    result += "Visitors: ";
                    for (int j = 0; j < testResult.Variants; j++)
                    {
                        result += "[" + j.ToString() + "]: " + testResult.SampleSize[j] + "\t";
                    }
                    result += "\n";

                    result += "Converted visitors: ";
                    for (int j = 0; j < testResult.Variants; j++)
                    {
                        result += "[" + j.ToString() + "]: " + testResult.ConvertedSize[j] + "\t";
                    }
                    result += "\n";

                    result += "Means: ";
                    for (int j = 0; j < testResult.Variants; j++)
                    {
                        result += "[" + j.ToString() + "]: " + testResult.Means[j] + "\t";
                    }
                    result += "\n";

                    result += "Standard Deviations: ";
                    for (int j = 0; j < testResult.Variants; j++)
                    {
                        result += "[" + j.ToString() + "]: " + testResult.STDevs[j] + "\t";
                    }
                    result += "\n\n";

                    result += "T-Score: ";
                    for (int j = 0; j < testResult.Variants - 1; j++)
                    {
                        result += "[" + j.ToString() + "]: " + testResult.TScores[j] + "\t";
                    }
                    result += "\n";

                    result += "Degree of Freedom: ";
                    for (int j = 0; j < testResult.Variants - 1; j++)
                    {
                        result += "[" + j.ToString() + "]: " + testResult.DFree[j] + "\t";
                    }
                    result += "\n";

                    result += "Next known Degree Freedom: ";
                    for (int j = 0; j < testResult.Variants - 1; j++)
                    {
                        result += "[" + j.ToString() + "]: " + testResult.NextDFree[j] + "\t";
                    }
                    result += "\n";

                    result += "Required P for next DF: ";
                    for (int j = 0; j < testResult.Variants - 1; j++)
                    {
                        result += "[" + j.ToString() + "]: " + testResult.ReqPVal[j] + "\t";
                    }
                    result += "\n";

                    result += "Is significant: ";
                    for (int j = 0; j < testResult.Variants - 1; j++)
                    {
                        result += "[" + j.ToString() + "]: " + testResult.ReachedSignificance[j] + "\t";
                    }
                    result += "\n";


                    result += "\nNote: [0] is the control variant";
                }
                else
                {
                    result += "Results not analysed yet.\n";
                }

                result += "\n----\n";
            }

            result += "\n\n********** MVT STATS **********\n\n";
            _CLI.Out(result, false, false);
        }
Beispiel #6
0
        public static void PrintDashboard(CommandLineInterface _CLI)
        {
            int TotalMVTs        = MVTHistory.GetMVTCount(false);
            int LiveMVTs         = MVTHistory.GetMVTCount(true);
            int CompletedMVTs    = TotalMVTs - LiveMVTs;
            int PositiveMVTs     = MVTHistory.GetMVTCount(TestResultType.Positive);
            int NegativeMVTs     = MVTHistory.GetMVTCount(TestResultType.Negative);
            int InconclusiveMVTs = MVTHistory.GetMVTCount(TestResultType.Inconclusive);

            MultiVariateTest[] LiveTests = MVTHistory.GetLiveTests();

            string result = "************************** OVERALL TESTING SUMMARY *************************\n\n";

            result += "Total MVTs launched: " + TotalMVTs.ToString()
                      + " (" + CompletedMVTs.ToString() + " completed, "
                      + LiveMVTs.ToString() + " currently live)\n";

            result += "Test results:\t" + PositiveMVTs.ToString() + " Positive\t"
                      + NegativeMVTs.ToString() + " Negative\t"
                      + InconclusiveMVTs.ToString() + " Inconclusive (abandoned) \n\n";

            if (LiveTests != null && LiveTests.Length > 0)
            {
                result += "******************************** LIVE TESTS ********************************\n";

                for (int i = 0; i < LiveTests.Length; i++)
                {
                    int           testId  = LiveTests[i].Id;
                    TestTypesEnum type    = LiveTests[i].TestType;
                    string        typeStr = "";
                    if (type == TestTypesEnum.ADDTOCARTBUTTON)
                    {
                        typeStr = "Add to Cart Btn";
                    }

                    DateTime?launched       = LiveTests[i].GetLaunchDateTime;
                    int      variantsNumber = LiveTests[i].GetNumberOfVariants();

                    MVTResult TResult = LiveTests[i].GetResult;



                    result += "[MVT ID: " + testId.ToString() + "]  [Type: " + typeStr
                              + "]  [Launch date: " + launched.ToString() + "]\n";

                    result += "[Variants: " + variantsNumber.ToString() + " (including control)]\n";


                    //Displaying ctr and test variant change details
                    //Only "Add to cart" A/B test display supported currently.
                    if (variantsNumber == 2 && type == TestTypesEnum.ADDTOCARTBUTTON)
                    {
                        AddToCartButtonVariation ctrVar = (AddToCartButtonVariation)LiveTests[i].GetVariant(0).GetVariationType();
                        AddToCartButtonVariation tstVar = (AddToCartButtonVariation)LiveTests[i].GetVariant(1).GetVariationType();

                        result += "[Control: ";
                        if (ctrVar.colorPalette == null && ctrVar.addToCartTextCopies == null)
                        {
                            result += "No changes";
                        }
                        else
                        {
                            if (ctrVar.colorPalette != null)
                            {
                                result += "Colour: " + ctrVar.colorPalette + "   ";
                            }

                            if (ctrVar.addToCartTextCopies != null)
                            {
                                result += "Copy change: " + ctrVar.addToCartTextCopies;
                            }
                        }
                        result += "]\n";

                        result += "[Test: ";
                        if (tstVar.colorPalette == null && tstVar.addToCartTextCopies == null)
                        {
                            result += "No changes";
                        }
                        else
                        {
                            if (tstVar.colorPalette != null)
                            {
                                result += "Colour: " + tstVar.colorPalette + "   ";
                            }

                            if (tstVar.addToCartTextCopies != null)
                            {
                                result += "Copy change: " + tstVar.addToCartTextCopies;
                            }
                        }
                        result += "]\n\n";
                    }

                    //Displaying ctr and test variant visitors, cvr and stdev. Works for A/B only.
                    if (TResult != null && variantsNumber == 2)
                    {
                        if (TResult.SampleSize.Length > 1 &&
                            TResult.Means.Length > 1 &&
                            TResult.ConvertedSize.Length > 1 &&
                            TResult.STDevs.Length > 1)
                        {
                            result += "\t[Visitors]\t[Converted]\t[%]\t[Std Dev]\n";

                            result += "CTRL\t" + TResult.SampleSize[0].ToString() + "\t\t"
                                      + TResult.ConvertedSize[0].ToString() + "\t\t"
                                      + TruncString((TResult.Means[0] * 100).ToString(), 4) + "%\t"
                                      + TruncString(TResult.STDevs[0].ToString(), 5) + "\n";



                            result += "TEST\t" + TResult.SampleSize[1].ToString() + "\t\t"
                                      + TResult.ConvertedSize[1].ToString() + "\t\t"
                                      + TruncString((TResult.Means[1] * 100).ToString(), 4) + "%\t"
                                      + TruncString(TResult.STDevs[1].ToString(), 5) + "\n\n";

                            result += "[T-score: " + TruncString(TResult.TScores[0].ToString(), 6) + "]  "
                                      + "[Degree of freedom: " + TResult.DFree[0].ToString()
                                      + " (next known is " + TResult.NextDFree[0].ToString() + ")]\n";

                            result += "[Required P for next Degree of Freedom: " + TruncString(TResult.ReqPVal[0].ToString(), 6) + "]\n";
                        }
                    }

                    result += "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
                }
            }
            else
            {
                //No live tests found, check if all completed.
                result += "\n No live tests running currently.\n";

                if (AddToCartButton.IsAllVariationTested())
                {
                    result += "All the 'Add To Cart Button' type variants have been tested. The best performing variant is live on 100%.";
                }
            }

            _CLI.Out(result, false, false);
        }