Ejemplo n.º 1
0
        public static function print_min_confidence_for_significance_field()
        {
            $field_name = 'min_confidence_for_significance';
            printf('<input type="range" id="%1$s" name="nelioab_settings[%1$s]" min="90" max="100" step="1" value="%2$s" %3$s /><br>', $field_name, NelioABSettings::get_min_confidence_for_significance(), self::get_pro_details());
            ?>
			<span <?php 
            echo self::get_pro_details('description');
            ?>
 id="value_<?php 
            echo $field_name;
            ?>
"></span>
			<script type="text/javascript">
				jQuery("#<?php 
            echo $field_name;
            ?>
").on("input change", function() {
					var str = "<?php 
            $str = __('Minimum confidence value is set to <strong>{value}%</strong> (at least 95% is recommended).', 'nelioab');
            $str = str_replace('"', '\\"', $str);
            echo $str;
            ?>
";
					var value = jQuery(this).attr('value');
					if ( value == '100' )
						value = '99';
					str = str.replace( '{value}', value );
					jQuery("#value_<?php 
            echo $field_name;
            ?>
").html(str);
				});
				jQuery("#<?php 
            echo $field_name;
            ?>
").trigger("change");
			</script>
			<div class="the-descr" style="display:none;"><span <?php 
            echo self::get_pro_details('description');
            ?>
><?php 
            _e('The confidence value tells you how "trustable" is the fact that one alternative is better than the original. Changing this value will modify the visual clues in Nelio\'s Dashboard and Progress of the Experiment (lower confidence values means that the "green light" appears sooner).', 'nelioab');
            ?>
</span></div>
			<?php 
        }
Ejemplo n.º 2
0
 /**
  * Sets the result status of this experiment to the given status and confidence.
  *
  * @param int $status     the new status of the experiment.
  * @param int $confidence the confidence (from 0 to 100) we have in the status of the current results.
  *
  * @return void
  *
  * @since 3.0.0
  */
 public function set_result_status($status, $confidence)
 {
     $this->result_status = NelioABGTest::get_result_status_from_str($status);
     if (NelioABGTest::WINNER == $this->result_status) {
         if (NelioABSettings::get_min_confidence_for_significance() <= $confidence) {
             $this->result_status = NelioABGTest::WINNER_WITH_CONFIDENCE;
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Returns PHPDOC
  *
  * @param int $status PHPDOC
  *
  * @return string PHPDOC
  *
  * @since PHPDOC
  */
 public static function generate_status_message($status)
 {
     $message = '';
     switch ($status) {
         case NelioABGTest::WINNER_WITH_CONFIDENCE:
             $message = sprintf(__('There is a clear winner, with a confidence greater than %s%%', 'nelioab'), NelioABSettings::get_min_confidence_for_significance());
             break;
         case NelioABGTest::WINNER:
             $message = sprintf(__('There is a possible winner, but keep in mind the confidence does not reach %s%%', 'nelioab'), NelioABSettings::get_min_confidence_for_significance());
             break;
         case NelioABGTest::NO_CLEAR_WINNER:
             $message = __('There is not enough data to determine any winner', 'nelioab');
             break;
         case NelioABGTest::NOT_ENOUGH_VISITS:
             $message = __('There are not enough visits', 'nelioab');
             break;
         case NelioABGTest::UNKNOWN:
         default:
             $message = __('There are not enough visits', 'nelioab');
     }
     return $message;
 }
Ejemplo n.º 4
0
 /**
  * PHPDOC
  *
  * @param int $max PHPDOC
  * @param int $min PHPDOC
  *
  * @return string PHPDOC
  *
  * @since PHPDOC
  */
 private static function select_confidence($max, $min = -1)
 {
     if ($min === -1) {
         $min = $max;
         ++$max;
     }
     $confidence = NelioABSettings::get_min_confidence_for_significance();
     if ($min <= $confidence && $confidence < $max) {
         return ' selected="selected" ';
     } else {
         return ' ';
     }
 }
        protected function print_experiment_status($exp, $res, $the_winner, $the_winner_confidence, $originals_conversion_rate, $best_alt, $best_alt_conversion_rate, $best_alt_improvement_factor)
        {
            if ($res) {
                $message = NelioABGTest::generate_status_message($res->get_summary_status());
            } else {
                $message = NelioABGTest::generate_status_message(false);
            }
            $src = nelioab_admin_asset_link('/images/progress-no.png');
            if ($best_alt > 0) {
                $best_alt = '(' . __('Alternative', 'nelioab') . ' ' . $best_alt . ')';
            } else {
                $best_alt = '';
            }
            $arrow = '';
            $stats_color = 'auto';
            $gain = '';
            if (self::NO_WINNER == $the_winner) {
                $main_message = __('Testing...', 'nelioab');
                if (NelioABExperiment::STATUS_RUNNING == $exp->get_status()) {
                    $status_message = __('No alternative is better than the rest', 'nelioab');
                } else {
                    $status_message = __('No alternative was better than the rest', 'nelioab');
                }
            } else {
                $main_message = __('¡Winner!', 'nelioab');
                if ($the_winner == 0) {
                    if ($the_winner_confidence >= NelioABSettings::get_min_confidence_for_significance()) {
                        $status_message = sprintf(__('Original wins with a %1$s%% confidence', 'nelioab'), $the_winner_confidence);
                    } else {
                        $status_message = sprintf(__('Original wins with just a %1$s%% confidence', 'nelioab'), $the_winner_confidence);
                    }
                } else {
                    if ($the_winner_confidence >= NelioABSettings::get_min_confidence_for_significance()) {
                        $status_message = sprintf(__('Alternative %1$s wins with a %2$s%% confidence', 'nelioab'), $the_winner, $the_winner_confidence);
                    } else {
                        $status_message = sprintf(__('Alternative %1$s wins with just a %2$s%% confidence', 'nelioab'), $the_winner, $the_winner_confidence);
                    }
                }
                if ($the_winner_confidence >= NelioABSettings::get_min_confidence_for_significance()) {
                    $src = nelioab_admin_asset_link('/images/progress-yes.png');
                } else {
                    $src = nelioab_admin_asset_link('/images/progress-yes-no.png');
                }
            }
            $print_improvement = false;
            if (is_numeric($best_alt_improvement_factor)) {
                // gain
                $alt_results = $this->results->get_alternative_results();
                $ori_conversions = $alt_results[0]->get_num_of_conversions();
                $aux = $ori_conversions * $this->goal->get_benefit() * $best_alt_improvement_factor / 100;
                $print_improvement = true;
                // format improvement factor
                if ($best_alt_improvement_factor < 0) {
                    $arrow = 'fa-arrow-down';
                    $stats_color = 'red';
                    $best_alt_improvement_factor = $best_alt_improvement_factor * -1;
                } else {
                    if ($best_alt_improvement_factor > 0) {
                        $arrow = 'fa-arrow-up';
                        $stats_color = 'green';
                    } else {
                        $print_improvement = false;
                        $arrow = 'fa-arrow-none';
                        $stats_color = 'black';
                    }
                }
                if ($aux > 0) {
                    $gain = sprintf(__('%1$s%2$s', 'nelioab', 'money'), NelioABSettings::get_conv_unit(), number_format_i18n($aux, 2));
                } else {
                    $gain = sprintf(__('%1$s%2$s', 'nelioab', 'money'), NelioABSettings::get_conv_unit(), number_format_i18n($aux * -1, 2));
                }
            }
            ?>

			<div id="info-status">
				<span class="main-message"><?php 
            echo $main_message;
            ?>
</span>
				<img src="<?php 
            echo $src;
            ?>
" title="<?php 
            echo $message;
            ?>
" alt="<?php 
            echo $message;
            ?>
" class="masterTooltip animated flipInY"/>
				<span class="additional-message"><?php 
            echo $status_message;
            ?>
</span>
			</div>
			<div id="ori-status">
				<span class="ori-name"><?php 
            _e('Original', 'nelioab');
            ?>
</span>
				<div id="ori-cr">
					<span class="ori-cr-title"><?php 
            _e('Conversion Rate', 'nelioab');
            ?>
</span>
					<span class="ori-cr-value"><?php 
            printf('%s %%', $originals_conversion_rate);
            ?>
</span>
				</div>
			</div>
			<div id="alt-status">
				<span class="alt-name"><?php 
            _e('Best Alternative', 'nelioab');
            ?>
 <?php 
            echo $best_alt;
            ?>
</span>
				<div id="alt-cr">
					<span class="alt-cr-title"><?php 
            _e('Conversion Rate', 'nelioab');
            ?>
</span>
					<span class="alt-cr"><?php 
            printf('%s %%', $best_alt_conversion_rate);
            ?>
</span>
				</div>
				<div id="alt-stats" style="color:<?php 
            echo $stats_color;
            ?>
;">
					<span class="alt-if"><i class="fa <?php 
            echo $arrow;
            ?>
" style="vertical-align: top;"></i><?php 
            if ($print_improvement) {
                printf('%s%%', $best_alt_improvement_factor);
            }
            ?>
</span>
					<span class="alt-ii"><i class="fa <?php 
            echo $arrow;
            ?>
" style="vertical-align: top;"></i><?php 
            if ($print_improvement) {
                echo $gain;
            }
            ?>
</span>
				</div>
			</div>
		<?php 
        }