Changeset 1246523
- Timestamp:
- 09/16/2015 09:54:05 AM (11 years ago)
- Location:
- octavius-rocks
- Files:
-
- 1 deleted
- 11 edited
- 30 copied
-
tags/1.3.6 (copied) (copied from octavius-rocks/trunk)
-
tags/1.3.6/LICENSE.txt (copied) (copied from octavius-rocks/trunk/LICENSE.txt)
-
tags/1.3.6/admin (copied) (copied from octavius-rocks/trunk/admin)
-
tags/1.3.6/admin/class-octavius-ajax.php (copied) (copied from octavius-rocks/trunk/admin/class-octavius-ajax.php) (2 diffs)
-
tags/1.3.6/admin/class-octavius-client-admin.php (copied) (copied from octavius-rocks/trunk/admin/class-octavius-client-admin.php) (1 diff)
-
tags/1.3.6/admin/class-octavius-client-settings.php (copied) (copied from octavius-rocks/trunk/admin/class-octavius-client-settings.php)
-
tags/1.3.6/admin/css/octavius-meta-box-ab.css (copied) (copied from octavius-rocks/trunk/admin/css/octavius-meta-box-ab.css) (1 diff)
-
tags/1.3.6/admin/js/octavius-admin-core.js (copied) (copied from octavius-rocks/trunk/admin/js/octavius-admin-core.js)
-
tags/1.3.6/admin/js/octavius-dashboard.js (copied) (copied from octavius-rocks/trunk/admin/js/octavius-dashboard.js) (7 diffs)
-
tags/1.3.6/admin/js/octavius-meta-box-ab.js (copied) (copied from octavius-rocks/trunk/admin/js/octavius-meta-box-ab.js) (4 diffs)
-
tags/1.3.6/admin/partials/octavius-client-admin-settings-display.php (deleted)
-
tags/1.3.6/admin/partials/octavius-dashboard-ab.php (copied) (copied from octavius-rocks/trunk/admin/partials/octavius-dashboard-ab.php) (1 diff)
-
tags/1.3.6/admin/partials/octavius-dashboard-top-clicks.php (copied) (copied from octavius-rocks/trunk/admin/partials/octavius-dashboard-top-clicks.php)
-
tags/1.3.6/admin/partials/octavius-meta-box-ab-results.php (copied) (copied from octavius-rocks/trunk/admin/partials/octavius-meta-box-ab-results.php) (1 diff)
-
tags/1.3.6/admin/partials/octavius-meta-box-ab.php (copied) (copied from octavius-rocks/trunk/admin/partials/octavius-meta-box-ab.php)
-
tags/1.3.6/admin/partials/octavius-settings-ab.php (copied) (copied from octavius-rocks/trunk/admin/partials/octavius-settings-ab.php)
-
tags/1.3.6/admin/partials/octavius-settings-server.php (copied) (copied from octavius-rocks/trunk/admin/partials/octavius-settings-server.php)
-
tags/1.3.6/admin/partials/octavius-settings-tabs.php (copied) (copied from octavius-rocks/trunk/admin/partials/octavius-settings-tabs.php)
-
tags/1.3.6/classes (copied) (copied from octavius-rocks/trunk/classes)
-
tags/1.3.6/grid (copied) (copied from octavius-rocks/trunk/grid)
-
tags/1.3.6/grid/box-classes/grid-octavius-live-box.inc (copied) (copied from octavius-rocks/trunk/grid/box-classes/grid-octavius-live-box.inc)
-
tags/1.3.6/includes (copied) (copied from octavius-rocks/trunk/includes)
-
tags/1.3.6/includes/class-octavius-client.php (copied) (copied from octavius-rocks/trunk/includes/class-octavius-client.php) (2 diffs)
-
tags/1.3.6/includes/class-octavius-rocks-ab-variants-store.php (copied) (copied from octavius-rocks/trunk/includes/class-octavius-rocks-ab-variants-store.php) (1 diff)
-
tags/1.3.6/index.php (copied) (copied from octavius-rocks/trunk/index.php)
-
tags/1.3.6/languages (copied) (copied from octavius-rocks/trunk/languages)
-
tags/1.3.6/octavius-client.php (copied) (copied from octavius-rocks/trunk/octavius-client.php) (1 diff)
-
tags/1.3.6/public (copied) (copied from octavius-rocks/trunk/public)
-
tags/1.3.6/public/class-octavius-client-public.php (copied) (copied from octavius-rocks/trunk/public/class-octavius-client-public.php)
-
tags/1.3.6/readme.txt (copied) (copied from octavius-rocks/trunk/readme.txt) (2 diffs)
-
tags/1.3.6/uninstall.php (copied) (copied from octavius-rocks/trunk/uninstall.php)
-
trunk/admin/class-octavius-ajax.php (modified) (2 diffs)
-
trunk/admin/class-octavius-client-admin.php (modified) (1 diff)
-
trunk/admin/css/octavius-meta-box-ab.css (modified) (1 diff)
-
trunk/admin/js/octavius-dashboard.js (modified) (7 diffs)
-
trunk/admin/js/octavius-meta-box-ab.js (modified) (4 diffs)
-
trunk/admin/partials/octavius-dashboard-ab.php (modified) (1 diff)
-
trunk/admin/partials/octavius-meta-box-ab-results.php (modified) (1 diff)
-
trunk/includes/class-octavius-client.php (modified) (2 diffs)
-
trunk/includes/class-octavius-rocks-ab-variants-store.php (modified) (1 diff)
-
trunk/octavius-client.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
octavius-rocks/tags/1.3.6/admin/class-octavius-ajax.php
r1220938 r1246523 60 60 "content_id" => $pid, 61 61 "title"=>get_the_title($pid), 62 "date"=>get_the_date("m-d-Y", $pid), 62 63 "locked" => false, 63 64 ); … … 70 71 } 71 72 wp_send_json(array('success' => true, "result" => $result)); 73 } 74 75 public function get_ab_posts_not_chosen(){ 76 $post_ids = array(); 77 78 //get all posts that have no chosen variant 79 $args = array( 80 'meta_query' => array( 81 array( 82 'key' => '_octavius_rocks_variant', 83 'compare' => 'NOT EXISTS' 84 ), 85 ) 86 ); 87 // The Query 88 $the_query = new WP_Query( $args ); 89 // The Loop 90 if ( $the_query->have_posts() ) { 91 while ( $the_query->have_posts() ) { 92 $the_query->the_post(); 93 array_push($post_ids, get_the_ID()); 94 } 95 } 96 /* Restore original Post Data */ 97 wp_reset_postdata(); 98 99 wp_send_json($post_ids); 72 100 } 73 101 -
octavius-rocks/tags/1.3.6/admin/class-octavius-client-admin.php
r1239714 r1246523 190 190 $number = intval($_POST['widget-octavius-ab-limit']); 191 191 $widget_options['ab_limit'] = $number; 192 $widget_options["ab_type"] = $_POST["widget-octavius-ab-type"];193 192 $this->dashboardOptions($widget_options); 194 193 } 195 194 196 echo '<p><label for="octavius-ab-limit">' . __(' Limit for variants:'). '</label>';195 echo '<p><label for="octavius-ab-limit">' . __('Minimum Number for total clicks: '). '</label>'; 197 196 echo '<input id="octavius-ab-limit" name="widget-octavius-ab-limit" type="text" value="' . $widget_options["ab_limit"] . '" size="5" /></p>'; 198 $selected = "selected='selected'";199 197 ?> 200 <p><?php echo __("Event type"); ?>201 <select name="widget-octavius-ab-type">202 <option value="" <?php if($widget_options["ab_type"] == "") echo $selected ?>><?php echo __("All"); ?></option>203 <option value="pageview" <?php if($widget_options["ab_type"] == "pageview") echo $selected ?>><?php echo __("Pageviews"); ?></option>204 <option value="click" <?php if($widget_options["ab_type"] == "click") echo $selected ?>><?php echo __("Clicks"); ?></option>205 </select>206 </p>207 198 <?php 208 199 } -
octavius-rocks/tags/1.3.6/admin/css/octavius-meta-box-ab.css
r1220938 r1246523 66 66 width: 100%; 67 67 } 68 /** 69 * ab report styles 70 */ 71 .octavius-rocks-ab-report{ 72 margin: 20px 0; 73 } -
octavius-rocks/tags/1.3.6/admin/js/octavius-dashboard.js
r1220938 r1246523 26 26 var oc = null; 27 27 28 var theDate = new Date('09-10-2015');//daten when rendered was tracked on zett 29 28 30 this.init = function(octavius){ 29 31 oc = octavius; 30 32 socket = octavius.socket; 31 33 32 34 this.init_top(); 33 35 this.init_ab(); … … 40 42 * upate table on socket event 41 43 */ 42 socket.on('update_ab_top_contents', function(data){ 43 console.log(data); 44 // TODO: send all content ids to backend and check if already done 45 // TODO: display all over limit and hide all closed 44 socket.on('update_ab_top_reports', function(data){ 45 if(data.error){ //if no results found 46 $results_ab.empty(); 47 $loading_ab.css("visibility", "hidden"); 48 $results_ab.append("Momentan keine Posts für die Auswertung verfügbar."); 49 return; 50 } 46 51 var content_ids = []; 47 52 var ids_map = {}; 48 53 var content_id = ""; 49 for( var i = 0; i < data. result.length; i++){50 var result = data .result[i];54 for( var i = 0; i < data.length; i++){ 55 var result = data[i]; 51 56 if(content_id == result.content_id) continue; 52 57 content_id = result.content_id; … … 64 69 $results_ab.empty(); 65 70 $loading_ab.css("visibility", "hidden"); 66 console.log(_data); 67 if(!_data.success){ 68 console.error(_data); 69 } else { 70 for( var i = 0; i < _data.result.length; i++){ 71 var result = _data.result[i]; 72 if(result.locked) continue; 73 var ob = ids_map[result.content_id]; 74 var $tr = $("<tr></tr>"); 75 $tr.append("<td><a href='/wp-admin/post.php?post=" 76 +ob.content_id+"&action=edit'>"+result.title+ 77 "</a></td>"); 78 $tr.append("<td>"+ob.variant+" <small>["+ob.hits+" hits]</small></td>"); 79 var $button = $button_template.clone(); 80 $button.show(); 81 var $td = $("<td></td>") 82 .addClass("octavius-rocks-variant-submit") 83 .attr("data-pid",result.content_id) 84 .attr("data-slug",ob.variant); 85 $tr.append($td.append($button)); 86 $results_ab.append($tr); 71 for( var i = 0; i < _data.result.length; i++){ 72 var result = _data.result[i]; 73 var releaseDate = new Date(result.date); 74 if(theDate > releaseDate) continue; //cannot calculate signigicance for old posts 75 var ob = ids_map[result.content_id]; 76 if(ob.significance.error) continue; //hide results with not calculatable significance 77 var $tr = $("<tr></tr>"); 78 $tr.append("<td><a href='/wp-admin/post.php?post=" 79 +ob.content_id+"&action=edit'>"+result.title+ 80 "</a></td>"); 81 82 //chose variant by highest conversion rate 83 var winner_variant_slug = 'standard'; 84 var winner_variant_conversionrate = ob.conversion_rates.standard; 85 86 //TODO show significance 87 if(ob.significance['95'] || ob.significance['99']){ //only give possibility to chose other than standard when is significantly better 88 for(var conversion_rate_slug in ob.conversion_rates){ 89 if(ob.conversion_rates[conversion_rate_slug] > winner_variant_conversionrate){ 90 winner_variant_slug = conversion_rate_slug; 91 winner_variant_conversionrate = ob.conversion_rates[conversion_rate_slug]; 92 } 93 } 87 94 } 95 $tr.append("<td>"+winner_variant_slug+" <small>["+winner_variant_conversionrate+"%]</small></td>"); 96 var $button = $button_template.clone(); 97 $button.show(); 98 var $td = $("<td></td>") 99 .addClass("octavius-rocks-variant-submit") 100 .attr("data-pid",result.content_id) 101 .attr("data-slug",winner_variant_slug); 102 $tr.append($td.append($button)); 103 $results_ab.append($tr); 88 104 } 89 105 }, … … 91 107 console.log([a,b,c]); 92 108 } 93 }); 109 }); 94 110 95 111 }); … … 100 116 $results_ab.on("click", "[type=submit]", function(){ 101 117 var $info = $(this).closest(".octavius-rocks-variant-submit"); 118 //TODO working? 102 119 var pid = $info.attr("data-pid"); 103 120 var slug = $info.attr("data-slug"); … … 109 126 data: {pid: pid, variant_slug: slug}, 110 127 success: function(_data){ 111 console.log(_data);112 128 if(_data.success){ 113 129 $info.closest("tr").remove(); … … 133 149 return; 134 150 } 135 var filters = [];136 if($type_ab.val() != ""){137 filters.push({ name: "event_type", value: $type_ab.val() });138 }139 151 140 socket.emit("get_ab_top_contents",{ limit: $limit_ab.val(), filters: filters }); 152 // get all ids from posts that have no chosen variant 153 $.ajax({ 154 url: ajaxurl+"?action=get_ab_posts_not_chosen", 155 method: "POST", 156 success: function(_data){ 157 socket.emit("get_ab_top_reports",{ limit: $limit_ab.val(), content_ids: _data }); 158 }, 159 error: function(a,b,c){ 160 console.log([a,b,c]); 161 } 162 }); 141 163 } 142 164 /** -
octavius-rocks/tags/1.3.6/admin/js/octavius-meta-box-ab.js
r1220938 r1246523 50 50 var post_id; 51 51 var variants = {}; 52 var $report_wrapper; 52 53 this.init = function(octavius){ 53 54 oc = octavius; … … 58 59 $metabox = $("#octavius_rocks_ab_results"); 59 60 $wrapper = $metabox.find(".octavius-rocks-ab-results"); 61 $report_wrapper = $metabox.find('.octavius-rocks-ab-report'); 60 62 post_id = $wrapper.attr("data-post-id"); 61 63 $metabox.on("click",".octavius-rocks-refresh", this.refresh.bind(this) ); … … 64 66 this.get_variants(); 65 67 socket.on("update_variants_hits", this.update_variants_hits); 68 //get ab report 69 //TODO only for posts younger than render tracking 70 socket.on("update_get_ab_report", this.update_ab_report); 71 this.get_ab_report(); 66 72 } 67 73 this.select_variant = function(e){ … … 154 160 }); 155 161 } 162 //check if post is newer than date when render tracking was enabled 163 this.is_rendered_tracked = function(releaseDateString){ 164 var theDateString = '09-10-2015'; 165 var theDate = new Date(theDateString); 166 var releaseDate = new Date(releaseDateString); 167 if(theDate <= releaseDate){ 168 return true; 169 } 170 return false; 171 } 172 this.show_too_old_notice = function(){ 173 $report_wrapper.html("Dieser Eintrag ist zu alt. Es liegen keine Daten zur Berechnung der Signifikanz vor."); 174 } 175 this.get_ab_report = function(){ 176 //TODO use one class doing this. Use class in octavius_grid 177 //check if post is released after the day rendering was tracked 178 if(!this.is_rendered_tracked($report_wrapper.attr("data-octavius-postdate"))){ 179 this.show_too_old_notice(); 180 return; 181 } 182 if(!oc.admincore.is_ready){ 183 setTimeout(this.get_ab_report.bind(this), 100); 184 return; 185 } 186 socket.emit("get_ab_report", {content_id:post_id}); 187 } 188 this.update_ab_report = function(data){ 189 //build html 190 var html = "<h2>AB-Test Ergebnisse</h2>"; 191 html += "<strong>Rendered</strong>"; 192 for(var variant in data.rendered_total){ 193 var number = data.rendered_total[variant]; 194 html += "<br>"+variant+": "+number; 195 } 196 html += "<br><br><strong>Clicked</strong>"; 197 for(var variant in data.clicked_total){ 198 var number = data.clicked_total[variant]; 199 html += "<br>"+variant+": "+number; 200 } 201 html += "<br><br><strong>Conversion Rate</strong>"; 202 for(var variant in data.rendered_total){ 203 var numberRendered = data.rendered_total[variant]; 204 var numberClicked = data.clicked_total[variant]; 205 var conversionRate = "No Data available"; 206 if(!isNaN(numberClicked) && !isNaN(numberRendered) && numberRendered > 0){ 207 var conversionRate = numberClicked/numberRendered*100+"%"; 208 } 209 html += "<br>"+variant+": "+conversionRate; 210 } 211 //significance 212 if(data.significance){ 213 html += "<br><br><strong>Signifikanz</strong>"; 214 if(data.significance.error){ 215 html += "<br>Keine Aussage über die Signifikanz möglich (Datengrundlage zu gering)."; 216 } 217 if(data.significance['95']){ 218 html += "<br>Die Daten sind statistisch signifikant."; 219 } 220 if(data.significance['99']){ 221 html += "<br>Die Daten sind statistisch höchst signifikant."; 222 } 223 if(data.significance['not']){ 224 html += "<br>Die Daten sind statistisch nicht signifikant."; 225 } 226 } 227 //add html to dom 228 $report_wrapper.html(html); 229 230 } 156 231 this.get_event_type = function(){ 157 232 return $metabox.find(".octavius-rocks-select-event-type").val(); -
octavius-rocks/tags/1.3.6/admin/partials/octavius-dashboard-ab.php
r1220938 r1246523 1 1 <input type="hidden" id="octavius-rocks-ab-limit" value="<?php echo $limit; ?>" /> 2 <input type="hidden" id="octavius-rocks-ab-type" value="<?php echo $type; ?>">3 2 <div id="octavius-rocks-ab-button-template"><?php echo submit_button(__("Use variant"), "small"); ?></div> 4 3 <table class="wp-list-table widefat fixed striped"> -
octavius-rocks/tags/1.3.6/admin/partials/octavius-meta-box-ab-results.php
r1220938 r1246523 20 20 <p>Chart is loading...</p> 21 21 </div> 22 23 <div class="octavius-rocks-ab-report" data-octavius-postdate="<?php echo get_the_date('m-d-Y');?>">Report is loading...</div> -
octavius-rocks/tags/1.3.6/includes/class-octavius-client.php
r1239714 r1246523 38 38 39 39 $this->plugin_name = 'octavius-client'; 40 $this->version = '1.3. 5';40 $this->version = '1.3.6'; 41 41 42 42 $this->load_dependencies(); … … 153 153 */ 154 154 $this->loader->add_action('wp_ajax_get_ab_info', $ajax, 'get_ab_info'); 155 156 /** 157 * get all post ids from not chosen ab posts 158 */ 159 $this->loader->add_action('wp_ajax_get_ab_posts_not_chosen', $ajax, 'get_ab_posts_not_chosen'); 155 160 156 161 /** -
octavius-rocks/tags/1.3.6/includes/class-octavius-rocks-ab-variants-store.php
r1236313 r1246523 47 47 return get_post_meta($post_id,"_octavius_rocks_variant",true); 48 48 } 49 public function get_posts_variant_not_set(){ 50 $args = array( 51 'meta_key' => '_octavius_rocks_variant' 52 ); 53 $the_query = new WP_Query( $args ); 54 //Make array with postids 55 $post_ids = []; 56 if ( $the_query->have_posts() ) { 57 while ( $the_query->have_posts() ) { 58 $post_ids[] = get_the_title(); 59 } 60 } 61 /* Restore original Post Data */ 62 wp_reset_postdata(); 63 return $post_ids; 64 } 49 65 /** 50 66 * is octavius enabled? -
octavius-rocks/tags/1.3.6/octavius-client.php
r1239714 r1246523 8 8 * Plugin URI: http://www.palasthotel.de 9 9 * Description: Tacking click paths 10 * Version: 1.3. 510 * Version: 1.3.6 11 11 * Author: PALASTHOTEL by Edward 12 12 * Author URI: http://www.palasthotel.de -
octavius-rocks/tags/1.3.6/readme.txt
r1239714 r1246523 5 5 Requires at least: 4.0 6 6 Tested up to: 4.3 7 Stable tag: 1.3. 5s7 Stable tag: 1.3.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 33 33 34 34 == Changelog == 35 36 = 1.3.6 = 37 * Dashboard widget calculates results for posts by significance 35 38 36 39 = 1.3.5 = -
octavius-rocks/trunk/admin/class-octavius-ajax.php
r1220938 r1246523 60 60 "content_id" => $pid, 61 61 "title"=>get_the_title($pid), 62 "date"=>get_the_date("m-d-Y", $pid), 62 63 "locked" => false, 63 64 ); … … 70 71 } 71 72 wp_send_json(array('success' => true, "result" => $result)); 73 } 74 75 public function get_ab_posts_not_chosen(){ 76 $post_ids = array(); 77 78 //get all posts that have no chosen variant 79 $args = array( 80 'meta_query' => array( 81 array( 82 'key' => '_octavius_rocks_variant', 83 'compare' => 'NOT EXISTS' 84 ), 85 ) 86 ); 87 // The Query 88 $the_query = new WP_Query( $args ); 89 // The Loop 90 if ( $the_query->have_posts() ) { 91 while ( $the_query->have_posts() ) { 92 $the_query->the_post(); 93 array_push($post_ids, get_the_ID()); 94 } 95 } 96 /* Restore original Post Data */ 97 wp_reset_postdata(); 98 99 wp_send_json($post_ids); 72 100 } 73 101 -
octavius-rocks/trunk/admin/class-octavius-client-admin.php
r1239714 r1246523 190 190 $number = intval($_POST['widget-octavius-ab-limit']); 191 191 $widget_options['ab_limit'] = $number; 192 $widget_options["ab_type"] = $_POST["widget-octavius-ab-type"];193 192 $this->dashboardOptions($widget_options); 194 193 } 195 194 196 echo '<p><label for="octavius-ab-limit">' . __(' Limit for variants:'). '</label>';195 echo '<p><label for="octavius-ab-limit">' . __('Minimum Number for total clicks: '). '</label>'; 197 196 echo '<input id="octavius-ab-limit" name="widget-octavius-ab-limit" type="text" value="' . $widget_options["ab_limit"] . '" size="5" /></p>'; 198 $selected = "selected='selected'";199 197 ?> 200 <p><?php echo __("Event type"); ?>201 <select name="widget-octavius-ab-type">202 <option value="" <?php if($widget_options["ab_type"] == "") echo $selected ?>><?php echo __("All"); ?></option>203 <option value="pageview" <?php if($widget_options["ab_type"] == "pageview") echo $selected ?>><?php echo __("Pageviews"); ?></option>204 <option value="click" <?php if($widget_options["ab_type"] == "click") echo $selected ?>><?php echo __("Clicks"); ?></option>205 </select>206 </p>207 198 <?php 208 199 } -
octavius-rocks/trunk/admin/css/octavius-meta-box-ab.css
r1220938 r1246523 66 66 width: 100%; 67 67 } 68 /** 69 * ab report styles 70 */ 71 .octavius-rocks-ab-report{ 72 margin: 20px 0; 73 } -
octavius-rocks/trunk/admin/js/octavius-dashboard.js
r1220938 r1246523 26 26 var oc = null; 27 27 28 var theDate = new Date('09-10-2015');//daten when rendered was tracked on zett 29 28 30 this.init = function(octavius){ 29 31 oc = octavius; 30 32 socket = octavius.socket; 31 33 32 34 this.init_top(); 33 35 this.init_ab(); … … 40 42 * upate table on socket event 41 43 */ 42 socket.on('update_ab_top_contents', function(data){ 43 console.log(data); 44 // TODO: send all content ids to backend and check if already done 45 // TODO: display all over limit and hide all closed 44 socket.on('update_ab_top_reports', function(data){ 45 if(data.error){ //if no results found 46 $results_ab.empty(); 47 $loading_ab.css("visibility", "hidden"); 48 $results_ab.append("Momentan keine Posts für die Auswertung verfügbar."); 49 return; 50 } 46 51 var content_ids = []; 47 52 var ids_map = {}; 48 53 var content_id = ""; 49 for( var i = 0; i < data. result.length; i++){50 var result = data .result[i];54 for( var i = 0; i < data.length; i++){ 55 var result = data[i]; 51 56 if(content_id == result.content_id) continue; 52 57 content_id = result.content_id; … … 64 69 $results_ab.empty(); 65 70 $loading_ab.css("visibility", "hidden"); 66 console.log(_data); 67 if(!_data.success){ 68 console.error(_data); 69 } else { 70 for( var i = 0; i < _data.result.length; i++){ 71 var result = _data.result[i]; 72 if(result.locked) continue; 73 var ob = ids_map[result.content_id]; 74 var $tr = $("<tr></tr>"); 75 $tr.append("<td><a href='/wp-admin/post.php?post=" 76 +ob.content_id+"&action=edit'>"+result.title+ 77 "</a></td>"); 78 $tr.append("<td>"+ob.variant+" <small>["+ob.hits+" hits]</small></td>"); 79 var $button = $button_template.clone(); 80 $button.show(); 81 var $td = $("<td></td>") 82 .addClass("octavius-rocks-variant-submit") 83 .attr("data-pid",result.content_id) 84 .attr("data-slug",ob.variant); 85 $tr.append($td.append($button)); 86 $results_ab.append($tr); 71 for( var i = 0; i < _data.result.length; i++){ 72 var result = _data.result[i]; 73 var releaseDate = new Date(result.date); 74 if(theDate > releaseDate) continue; //cannot calculate signigicance for old posts 75 var ob = ids_map[result.content_id]; 76 if(ob.significance.error) continue; //hide results with not calculatable significance 77 var $tr = $("<tr></tr>"); 78 $tr.append("<td><a href='/wp-admin/post.php?post=" 79 +ob.content_id+"&action=edit'>"+result.title+ 80 "</a></td>"); 81 82 //chose variant by highest conversion rate 83 var winner_variant_slug = 'standard'; 84 var winner_variant_conversionrate = ob.conversion_rates.standard; 85 86 //TODO show significance 87 if(ob.significance['95'] || ob.significance['99']){ //only give possibility to chose other than standard when is significantly better 88 for(var conversion_rate_slug in ob.conversion_rates){ 89 if(ob.conversion_rates[conversion_rate_slug] > winner_variant_conversionrate){ 90 winner_variant_slug = conversion_rate_slug; 91 winner_variant_conversionrate = ob.conversion_rates[conversion_rate_slug]; 92 } 93 } 87 94 } 95 $tr.append("<td>"+winner_variant_slug+" <small>["+winner_variant_conversionrate+"%]</small></td>"); 96 var $button = $button_template.clone(); 97 $button.show(); 98 var $td = $("<td></td>") 99 .addClass("octavius-rocks-variant-submit") 100 .attr("data-pid",result.content_id) 101 .attr("data-slug",winner_variant_slug); 102 $tr.append($td.append($button)); 103 $results_ab.append($tr); 88 104 } 89 105 }, … … 91 107 console.log([a,b,c]); 92 108 } 93 }); 109 }); 94 110 95 111 }); … … 100 116 $results_ab.on("click", "[type=submit]", function(){ 101 117 var $info = $(this).closest(".octavius-rocks-variant-submit"); 118 //TODO working? 102 119 var pid = $info.attr("data-pid"); 103 120 var slug = $info.attr("data-slug"); … … 109 126 data: {pid: pid, variant_slug: slug}, 110 127 success: function(_data){ 111 console.log(_data);112 128 if(_data.success){ 113 129 $info.closest("tr").remove(); … … 133 149 return; 134 150 } 135 var filters = [];136 if($type_ab.val() != ""){137 filters.push({ name: "event_type", value: $type_ab.val() });138 }139 151 140 socket.emit("get_ab_top_contents",{ limit: $limit_ab.val(), filters: filters }); 152 // get all ids from posts that have no chosen variant 153 $.ajax({ 154 url: ajaxurl+"?action=get_ab_posts_not_chosen", 155 method: "POST", 156 success: function(_data){ 157 socket.emit("get_ab_top_reports",{ limit: $limit_ab.val(), content_ids: _data }); 158 }, 159 error: function(a,b,c){ 160 console.log([a,b,c]); 161 } 162 }); 141 163 } 142 164 /** -
octavius-rocks/trunk/admin/js/octavius-meta-box-ab.js
r1220938 r1246523 50 50 var post_id; 51 51 var variants = {}; 52 var $report_wrapper; 52 53 this.init = function(octavius){ 53 54 oc = octavius; … … 58 59 $metabox = $("#octavius_rocks_ab_results"); 59 60 $wrapper = $metabox.find(".octavius-rocks-ab-results"); 61 $report_wrapper = $metabox.find('.octavius-rocks-ab-report'); 60 62 post_id = $wrapper.attr("data-post-id"); 61 63 $metabox.on("click",".octavius-rocks-refresh", this.refresh.bind(this) ); … … 64 66 this.get_variants(); 65 67 socket.on("update_variants_hits", this.update_variants_hits); 68 //get ab report 69 //TODO only for posts younger than render tracking 70 socket.on("update_get_ab_report", this.update_ab_report); 71 this.get_ab_report(); 66 72 } 67 73 this.select_variant = function(e){ … … 154 160 }); 155 161 } 162 //check if post is newer than date when render tracking was enabled 163 this.is_rendered_tracked = function(releaseDateString){ 164 var theDateString = '09-10-2015'; 165 var theDate = new Date(theDateString); 166 var releaseDate = new Date(releaseDateString); 167 if(theDate <= releaseDate){ 168 return true; 169 } 170 return false; 171 } 172 this.show_too_old_notice = function(){ 173 $report_wrapper.html("Dieser Eintrag ist zu alt. Es liegen keine Daten zur Berechnung der Signifikanz vor."); 174 } 175 this.get_ab_report = function(){ 176 //TODO use one class doing this. Use class in octavius_grid 177 //check if post is released after the day rendering was tracked 178 if(!this.is_rendered_tracked($report_wrapper.attr("data-octavius-postdate"))){ 179 this.show_too_old_notice(); 180 return; 181 } 182 if(!oc.admincore.is_ready){ 183 setTimeout(this.get_ab_report.bind(this), 100); 184 return; 185 } 186 socket.emit("get_ab_report", {content_id:post_id}); 187 } 188 this.update_ab_report = function(data){ 189 //build html 190 var html = "<h2>AB-Test Ergebnisse</h2>"; 191 html += "<strong>Rendered</strong>"; 192 for(var variant in data.rendered_total){ 193 var number = data.rendered_total[variant]; 194 html += "<br>"+variant+": "+number; 195 } 196 html += "<br><br><strong>Clicked</strong>"; 197 for(var variant in data.clicked_total){ 198 var number = data.clicked_total[variant]; 199 html += "<br>"+variant+": "+number; 200 } 201 html += "<br><br><strong>Conversion Rate</strong>"; 202 for(var variant in data.rendered_total){ 203 var numberRendered = data.rendered_total[variant]; 204 var numberClicked = data.clicked_total[variant]; 205 var conversionRate = "No Data available"; 206 if(!isNaN(numberClicked) && !isNaN(numberRendered) && numberRendered > 0){ 207 var conversionRate = numberClicked/numberRendered*100+"%"; 208 } 209 html += "<br>"+variant+": "+conversionRate; 210 } 211 //significance 212 if(data.significance){ 213 html += "<br><br><strong>Signifikanz</strong>"; 214 if(data.significance.error){ 215 html += "<br>Keine Aussage über die Signifikanz möglich (Datengrundlage zu gering)."; 216 } 217 if(data.significance['95']){ 218 html += "<br>Die Daten sind statistisch signifikant."; 219 } 220 if(data.significance['99']){ 221 html += "<br>Die Daten sind statistisch höchst signifikant."; 222 } 223 if(data.significance['not']){ 224 html += "<br>Die Daten sind statistisch nicht signifikant."; 225 } 226 } 227 //add html to dom 228 $report_wrapper.html(html); 229 230 } 156 231 this.get_event_type = function(){ 157 232 return $metabox.find(".octavius-rocks-select-event-type").val(); -
octavius-rocks/trunk/admin/partials/octavius-dashboard-ab.php
r1220938 r1246523 1 1 <input type="hidden" id="octavius-rocks-ab-limit" value="<?php echo $limit; ?>" /> 2 <input type="hidden" id="octavius-rocks-ab-type" value="<?php echo $type; ?>">3 2 <div id="octavius-rocks-ab-button-template"><?php echo submit_button(__("Use variant"), "small"); ?></div> 4 3 <table class="wp-list-table widefat fixed striped"> -
octavius-rocks/trunk/admin/partials/octavius-meta-box-ab-results.php
r1220938 r1246523 20 20 <p>Chart is loading...</p> 21 21 </div> 22 23 <div class="octavius-rocks-ab-report" data-octavius-postdate="<?php echo get_the_date('m-d-Y');?>">Report is loading...</div> -
octavius-rocks/trunk/includes/class-octavius-client.php
r1239714 r1246523 38 38 39 39 $this->plugin_name = 'octavius-client'; 40 $this->version = '1.3. 5';40 $this->version = '1.3.6'; 41 41 42 42 $this->load_dependencies(); … … 153 153 */ 154 154 $this->loader->add_action('wp_ajax_get_ab_info', $ajax, 'get_ab_info'); 155 156 /** 157 * get all post ids from not chosen ab posts 158 */ 159 $this->loader->add_action('wp_ajax_get_ab_posts_not_chosen', $ajax, 'get_ab_posts_not_chosen'); 155 160 156 161 /** -
octavius-rocks/trunk/includes/class-octavius-rocks-ab-variants-store.php
r1236313 r1246523 47 47 return get_post_meta($post_id,"_octavius_rocks_variant",true); 48 48 } 49 public function get_posts_variant_not_set(){ 50 $args = array( 51 'meta_key' => '_octavius_rocks_variant' 52 ); 53 $the_query = new WP_Query( $args ); 54 //Make array with postids 55 $post_ids = []; 56 if ( $the_query->have_posts() ) { 57 while ( $the_query->have_posts() ) { 58 $post_ids[] = get_the_title(); 59 } 60 } 61 /* Restore original Post Data */ 62 wp_reset_postdata(); 63 return $post_ids; 64 } 49 65 /** 50 66 * is octavius enabled? -
octavius-rocks/trunk/octavius-client.php
r1239714 r1246523 8 8 * Plugin URI: http://www.palasthotel.de 9 9 * Description: Tacking click paths 10 * Version: 1.3. 510 * Version: 1.3.6 11 11 * Author: PALASTHOTEL by Edward 12 12 * Author URI: http://www.palasthotel.de -
octavius-rocks/trunk/readme.txt
r1239714 r1246523 5 5 Requires at least: 4.0 6 6 Tested up to: 4.3 7 Stable tag: 1.3. 5s7 Stable tag: 1.3.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 33 33 34 34 == Changelog == 35 36 = 1.3.6 = 37 * Dashboard widget calculates results for posts by significance 35 38 36 39 = 1.3.5 =
Note: See TracChangeset
for help on using the changeset viewer.