Better Google Analytics - Version 1.0.10

Version Description

  • Change: Removed async attribute from script tag for better compatibility with certain themes
  • Enhancement: Set Google Analytics sample rate to 100 if something internal to WordPress removes that setting somehow
  • Enhancement: Updated Google Analytics Goal management to take advantage of new responsive table methods in WordPress 4.3
  • Enhancement: Google Analytics Experiments allow adding custom third-party experiment types via hooks and actions
  • Security: Added input sanitization callback to settings
  • Flagged for WordPress 4.3.0 compatibility
Download this release

Release Info

Developer digitalpoint
Plugin Icon 128x128 Better Google Analytics
Version 1.0.10
Comparing to
See all releases

Code changes from version 1.0.9 to 1.0.10

assets/digitalpoint/css/admin.css CHANGED
@@ -1 +1 @@
1
- .ba_error{background-color:#333;width:40%;position:absolute;top:200px;left:30%;border:1px black solid;box-shadow:0 0 0 10px rgba(100,100,100,.7);border-radius:3px;color:white;padding:10px;opacity:.9;z-index:10}.ba_error .dismiss{float:right;margin-top:40px}#contextual-help-link-wrap{z-index:10}#better-analytics_sidebar_wrapper{position:absolute;right:20px;width:275px;margin-left:10px}#better-analytics_sidebar{position:relative;top:15px}#better-analytics_sidebar .pro{display:none}#better-analytics_sidebar>div{border-color:#ddd #bbb #bbb #ddd;padding:10px}#better-analytics_sidebar h4{margin-top:2em}#better-analytics_sidebar>.postbox>h4{margin-top:0}#better-analytics_sidebar .dashicons-twitter{vertical-align:middle;font-size:16px;height:18px}#better-analytics_settings form{margin-right:285px}@media only screen and (max-width:960px){#better-analytics_settings form{margin-right:215px}#better-analytics_sidebar_wrapper{width:205px}#better-analytics_sidebar .postbox{min-width:185px}}@media screen and (max-width:782px){#better-analytics_sidebar{display:none}#better-analytics_settings form{margin-right:0}}#ba_settings.form-table .dashicons-before{opacity:.6}#ba_settings.form-table th,#ba_test.form-table th{white-space:nowrap;text-align:right}#ba_monitor{padding-right:20px}#ba_monitor td{white-space:nowrap}#ba_monitor td:last-of-type{white-space:normal}@media screen and (max-width:782px){.form-table th{text-align:left!important}.responsiveHide{display:none}}.tooltipster-better_analytics{border-radius:5px;border:2px solid #000;background:#4c4c4c;color:#fff;opacity:.9}.tooltipster-better_analytics .tooltipster-content{font-family:Arial,sans-serif;font-size:12px;line-height:18px;padding:8px 10px;overflow:hidden}.tooltipster-better_analytics .tooltipster-content a{color:#7bf}.tooltipster-better_analytics .tooltipster-content a:hover{color:#9df}.group_api input[type="text"]{width:100%}#ba_test .can_auto_config{background-color:lightgoldenrodyellow}#ba_test .good{color:green;font-size:24px;padding-right:10px}#ba_test .bad{color:red;font-size:24px;padding-right:10px}#ba_test .unknown{color:orange;font-size:24px}#ba_test th+td{vertical-align:top}#ba_test.form-table th,#ba_test.form-table td,#parameters.form-table th,#parameters.form-table td{padding-top:10px;padding-bottom:10px;line-height:1em}#ba_test.form-table th{padding-top:15px}.ba_monitor_form #parameters.form-table th{padding-top:18px}#ba_test .description{color:#777;font-size:12px;line-height:1.5em!important}#ba_test .description ul{list-style:disc;padding-left:30px}.table{display:table;width:95%}.table .row{display:table-row}.table .row.header{font-size:11px;color:#032a46;background:#6cb2e4 linear-gradient(rgba(255,255,255,0.35) 0,rgba(255,255,255,0.35) 50%,rgba(255,255,255,0) 100%)}.table .cell{text-align:center;display:table-cell;border-bottom:1px solid #a5cae4;border-right:1px solid #a5cae4;padding:5px 0;width:12.5%;transition:all 1s;opacity:0;background-color:#176093}.table .cell:first-of-type{border-left:1px solid #a5cae4}.table .row.header .cell{font-weight:bold;border-top:1px solid #6cb2e4;border-bottom:1px solid #65a5d1;border-right:0;border-left:0;background-color:transparent}#Heatmap .row:nth-of-type(2) .cell{border-top:1px solid #a5cae4}#Heatmap .row .cell:nth-of-type(2){border-left:1px solid #a5cae4}#Heatmap .row:first-of-type,#Heatmap .row:first-of-type .cell,#Heatmap .row .cell:first-of-type{border:0;font-weight:bold;background-color:transparent;opacity:1}#Heatmap .row .cell:first-of-type{text-align:right;padding-right:10px;white-space:nowrap}#parameters.form-table th{text-align:right;padding-top:15px}#ba_chart,#ba_realtime_charts{display:none}#ba_realtime_charts>div{display:inline-block;vertical-align:top;line-height:1em}#ba_rt_users{width:30%;text-align:center;padding-top:50px}#ba_rt_users .number{font-weight:bold;font-size:400%;transition:background-color 5s}#ba_rt_users .number.up{background-color:lightgreen;transition:background-color 0s}#ba_rt_users .number.down{background-color:#e77;transition:background-color 0s}#ba_rt_map{width:70%}#ba_rt_medium,#ba_rt_device{width:50%}#ba_realtime_charts #ba_rt_keywords,#ba_realtime_charts #ba_rt_referral_path,#ba_realtime_charts #ba_rt_page_path{display:block;width:100%;padding:15px 0}.google-visualization-table-td{word-wrap:break-word;word-break:break-all;overflow:hidden}#better-analytics_settings .pro{border:2px dashed orange;padding-right:5px}#better-analytics_settings .pro li{list-style:disc;margin-left:25px}#better-analytics_sidebar .postbox h4+div{line-height:1.4em}#ba_track_blocked{display:inline}#chart_loading{font-size:40px;width:40px;height:40px;color:lightgrey;position:absolute;-webkit-animation:rotation 1s infinite linear;animation:rotation 1s infinite linear;transition:opacity .5s;opacity:0}table.plugins #better-analytics p{white-space:normal}table.plugins #better-analytics p.green{color:green}table.plugins #better-analytics p.green a{color:darkgreen}table.plugins #better-analytics p.green a:hover{color:#009600}table.plugins #better-analytics p.orange{color:orange}table.plugins #better-analytics p.orange a{color:darkorange}table.plugins #better-analytics p.orange a:hover{color:lightcoral}.goals tbody,.goals tbody th.check-column{padding:8px 0 0 2px}.goals .inactive .check-column,.goals tfoot th.check-column,.goals thead th.check-column{padding-left:6px}.goals .active .check-column{border-left:4px solid #00d2a0}.goals .active td,.goals .active th{background-color:#f7fefc}.goals .column-value{min-width:55px}.goals td{padding-bottom:0}.optional{padding-left:5px;font-weight:normal;font-size:75%;position:relative;top:-3px;color:chocolate}.extra_info td{padding-top:0;padding-bottom:8px}.goals .row-title{font-weight:normal}.goals .active .row-title{font-weight:600}@media screen and (max-width:782px){.goals .column-slot,.goals .column-created,.goals .column-updated,.goals .slot,.goals .created,.goals .updated{display:none}.goals .column-name a{font-size:18px!important;line-height:1.2em}}.funnel ol{counter-reset:item;list-style-type:none;margin-left:0}.funnel li:before{content:counter(item) " ";counter-increment:item;font-size:16px;font-weight:bold}.funnel .delete{position:relative;top:2px;color:lightgrey}.funnel .delete:hover{color:red;cursor:pointer}.funnel li:first-child .delete{display:none}.VISIT_TIME_ON_SITE input,.VISIT_NUM_PAGES input{width:75px}.VISIT_TIME_ON_SITE td>div,.VISIT_NUM_PAGES td>div,.EVENT td>div{display:table}.VISIT_TIME_ON_SITE td>div>div,.VISIT_NUM_PAGES td>div>div,.EVENT td>div>div{display:table-row}.VISIT_TIME_ON_SITE td>div>div>span,.VISIT_NUM_PAGES td>div>div>span,.EVENT td>div>div>span{display:table-cell}.dynamic_options{display:none}.EVENT div>span:first-of-type{text-align:right;padding-right:5px}
1
+ .ba_error{background-color:#333;width:40%;position:absolute;top:200px;left:30%;border:1px black solid;box-shadow:0 0 0 10px rgba(100,100,100,.7);border-radius:3px;color:white;padding:10px;opacity:.9;z-index:10}.ba_error .dismiss{float:right;margin-top:40px}#contextual-help-link-wrap{z-index:10}#better-analytics_sidebar_wrapper{position:absolute;right:20px;width:275px;margin-left:10px}#better-analytics_sidebar{position:relative;top:15px}#better-analytics_sidebar .pro{display:none}#better-analytics_sidebar>div{border-color:#ddd #bbb #bbb #ddd;padding:10px}#better-analytics_sidebar h4{margin-top:2em}#better-analytics_sidebar>.postbox>h4{margin-top:0}#better-analytics_sidebar .dashicons-twitter{vertical-align:middle;font-size:16px;height:18px}#better-analytics_settings form{margin-right:285px}@media only screen and (max-width:960px){#better-analytics_settings form{margin-right:215px}#better-analytics_sidebar_wrapper{width:205px}#better-analytics_sidebar .postbox{min-width:185px}}@media screen and (max-width:782px){#better-analytics_sidebar{display:none}#better-analytics_settings form{margin-right:0}}#ba_settings.form-table .dashicons-before{opacity:.6}#ba_settings.form-table th,#ba_test.form-table th{white-space:nowrap;text-align:right}#ba_monitor{padding-right:20px}#ba_monitor td{white-space:nowrap}#ba_monitor td:last-of-type{white-space:normal}@media screen and (max-width:782px){.form-table th{text-align:left!important}.responsiveHide{display:none}}.tooltipster-better_analytics{border-radius:5px;border:2px solid #000;background:#4c4c4c;color:#fff;opacity:.9}.tooltipster-better_analytics .tooltipster-content{font-family:Arial,sans-serif;font-size:12px;line-height:18px;padding:8px 10px;overflow:hidden}.tooltipster-better_analytics .tooltipster-content a{color:#7bf}.tooltipster-better_analytics .tooltipster-content a:hover{color:#9df}.group_api input[type="text"]{width:100%}#ba_test .can_auto_config{background-color:lightgoldenrodyellow}#ba_test .good{color:green;font-size:24px;padding-right:10px}#ba_test .bad{color:red;font-size:24px;padding-right:10px}#ba_test .unknown{color:orange;font-size:24px}#ba_test th+td{vertical-align:top}#ba_test.form-table th,#ba_test.form-table td,#parameters.form-table th,#parameters.form-table td{padding-top:10px;padding-bottom:10px;line-height:1em}#ba_test.form-table th{padding-top:15px}.ba_monitor_form #parameters.form-table th{padding-top:18px}#ba_test .description{color:#777;font-size:12px;line-height:1.5em!important}#ba_test .description ul{list-style:disc;padding-left:30px}.table{display:table;width:95%}.table .row{display:table-row}.table .row.header{font-size:11px;color:#032a46;background:#6cb2e4 linear-gradient(rgba(255,255,255,0.35) 0,rgba(255,255,255,0.35) 50%,rgba(255,255,255,0) 100%)}.table .cell{text-align:center;display:table-cell;border-bottom:1px solid #a5cae4;border-right:1px solid #a5cae4;padding:5px 0;width:12.5%;transition:all 1s;opacity:0;background-color:#176093}.table .cell:first-of-type{border-left:1px solid #a5cae4}.table .row.header .cell{font-weight:bold;border-top:1px solid #6cb2e4;border-bottom:1px solid #65a5d1;border-right:0;border-left:0;background-color:transparent}#Heatmap .row:nth-of-type(2) .cell{border-top:1px solid #a5cae4}#Heatmap .row .cell:nth-of-type(2){border-left:1px solid #a5cae4}#Heatmap .row:first-of-type,#Heatmap .row:first-of-type .cell,#Heatmap .row .cell:first-of-type{border:0;font-weight:bold;background-color:transparent;opacity:1}#Heatmap .row .cell:first-of-type{text-align:right;padding-right:10px;white-space:nowrap}#parameters.form-table th{text-align:right;padding-top:15px}#ba_chart,#ba_realtime_charts{display:none}#ba_realtime_charts>div{display:inline-block;vertical-align:top;line-height:1em}#ba_rt_users{width:30%;text-align:center;padding-top:50px}#ba_rt_users .number{font-weight:bold;font-size:400%;transition:background-color 5s}#ba_rt_users .number.up{background-color:lightgreen;transition:background-color 0s}#ba_rt_users .number.down{background-color:#e77;transition:background-color 0s}#ba_rt_map{width:70%}#ba_rt_medium,#ba_rt_device{width:50%}#ba_realtime_charts #ba_rt_keywords,#ba_realtime_charts #ba_rt_referral_path,#ba_realtime_charts #ba_rt_page_path{display:block;width:100%;padding:15px 0}.google-visualization-table-td{word-wrap:break-word;word-break:break-all;overflow:hidden}#better-analytics_settings .pro{border:2px dashed orange;padding-right:5px}#better-analytics_settings .pro li{list-style:disc;margin-left:25px}#better-analytics_sidebar .postbox h4+div{line-height:1.4em}#ba_track_blocked{display:inline}#chart_loading{font-size:40px;width:40px;height:40px;color:lightgrey;position:absolute;-webkit-animation:rotation 1s infinite linear;animation:rotation 1s infinite linear;transition:opacity .5s;opacity:0}table.plugins #better-analytics p{white-space:normal}table.plugins #better-analytics p.green{color:green}table.plugins #better-analytics p.green a{color:darkgreen}table.plugins #better-analytics p.green a:hover{color:#009600}table.plugins #better-analytics p.orange{color:orange}table.plugins #better-analytics p.orange a{color:darkorange}table.plugins #better-analytics p.orange a:hover{color:lightcoral}.goals tbody,.goals tbody th.check-column{padding:8px 0 0 2px}.goals .check-column{border-left:4px solid transparent}.goals .manage-column.check-column{border-left:3px solid transparent}.goals .active th:first-of-type,.goals .active+.active td:first-of-type{border-left:4px solid #00d2a0}.goals .active td,.goals .active th{background-color:#f7fefc}.goals .column-value{min-width:55px}.goals td{padding-bottom:0}.optional{padding-left:5px;font-weight:normal;font-size:75%;position:relative;top:-3px;color:chocolate}.extra_info td{padding-top:0;padding-bottom:8px}.goals .row-title{font-weight:normal}.goals .active .row-title{font-weight:600}@media screen and (max-width:782px){.goals .column-slot,.goals .column-created,.goals .column-updated,.goals .slot,.goals .created,.goals .updated{display:none}.goals .column-name a{font-size:18px!important}}.funnel ol{counter-reset:item;list-style-type:none;margin-left:0}.funnel li:before{content:counter(item) " ";counter-increment:item;font-size:16px;font-weight:bold}.funnel .delete,.experiment_create .delete{position:relative;top:2px;color:lightgrey}.funnel .delete:hover,.experiment_create .delete:hover{color:red;cursor:pointer}.funnel li:first-child .delete,.experiment_create li:first-child .delete{display:none}.VISIT_TIME_ON_SITE input,.VISIT_NUM_PAGES input{width:75px}.VISIT_TIME_ON_SITE td>div,.VISIT_NUM_PAGES td>div,.EVENT td>div{display:table}.VISIT_TIME_ON_SITE td>div>div,.VISIT_NUM_PAGES td>div>div,.EVENT td>div>div{display:table-row}.VISIT_TIME_ON_SITE td>div>div>span,.VISIT_NUM_PAGES td>div>div>span,.EVENT td>div>div>span{display:table-cell}.dynamic_options{display:none}.EVENT div>span:first-of-type{text-align:right;padding-right:5px}.experiment_create ol{margin:0}.experiment_create ol textarea{vertical-align:top}.experiment_create .CSS textarea.large-text{width:90%}
assets/digitalpoint/js/admin.js CHANGED
@@ -3,9 +3,9 @@ var BetterAnalyticsAdmin={};jQuery.easing.easeOutExpo=function(a,g,e,h,b){return
3
  width:"80%"}),a(".chosen-select").not("#ba_pick_profile").chosen({search_contains:!0,width:"100%"}),a("#ba_pick_profile.chosen-select").chosen({search_contains:!0,width:"70%"}));a("#ba_realtime").on("change",function(){this.checked?(a("#ba_history select").prop("disabled",!0),a("#ba_history").css("color","grey")):(a("#ba_history select").prop("disabled",!1),a("#ba_history").css("color","inherit"))});a("#ba_api_use_own").length&&(a("#ba_api_use_own").on("change",function(){BetterAnalyticsAdmin._Admin.toggle_credentials()}),
4
  BetterAnalyticsAdmin._Admin.toggle_credentials());a("#ba_pick_profile").on("change",function(){a(this).val()&&a("#ba_property_id").val(a(this).val())});a("#dashboard-widgets #better-analytics select").length&&(a("#dashboard-widgets #better-analytics select,#dashboard-widgets #better-analytics input").on("change",function(){BetterAnalyticsAdmin._Admin.chart_draw()}),BetterAnalyticsAdmin._Admin.chart_draw());a("#Heatmap").length&&(BetterAnalyticsAdmin._Admin.heatmap_draw(),a("#Heatmap + form #parameters input,#Heatmap + form #parameters select").on("change",
5
  function(){BetterAnalyticsAdmin._Admin.get_new_heatmap_data()}));a("#area_chart").length&&(BetterAnalyticsAdmin._Admin.get_new_area_chart_data(),a("#area_chart + form #parameters input,#area_chart + form #parameters select").on("change",function(){BetterAnalyticsAdmin._Admin.get_new_area_chart_data()}));a(".ba_monitor_form").length&&(BetterAnalyticsAdmin._Admin.get_new_monitor_data(),a(".ba_monitor_form input").on("change",function(){BetterAnalyticsAdmin._Admin.get_new_monitor_data()}));if(a(".goals").length&&
6
- history.pushState){var b=g.location.search.indexOf("&id=");0<b&&(b=g.location.origin+g.location.pathname+g.location.search.substring(0,b),history.pushState({url:b},e.title,b))}a(".goal_create").length&&(BetterAnalyticsAdmin._Admin.bind_funnel_delete(),a("#new_step").on("click",BetterAnalyticsAdmin._Admin.bind_funnel_add),a("#ba_type").on("change",BetterAnalyticsAdmin._Admin.goal_type_change),BetterAnalyticsAdmin._Admin.goal_type_change())})},init_tabs:function(){var b=g.location.hash.slice(5);b||
7
- (b=a(".nav-tab:first").prop("id").slice(0,-4));BetterAnalyticsAdmin._Admin.select_tab(b);a("#better-analytics_tabs a").each(function(){a(this).on("click",BetterAnalyticsAdmin._Admin.select_tab)})},select_tab:function(b){b="object"===typeof b?a(b.currentTarget.hash.slice(4)+"-tab"):a("#"+b+"-tab");try{a("#ba_current_tab").val(a(b).prop("id").slice(0,-4))}catch(e){a("#ba_current_tab").val("general")}a(".nav-tab").removeClass("nav-tab-active");b.addClass("nav-tab-active");a(".tab_content").css("display",
8
- "none");a(".group_"+a("#ba_current_tab").val()).not(".api_hideable").fadeIn();BetterAnalyticsAdmin._Admin.toggle_credentials();a(".group_"+a("#ba_current_tab").val()+" .pro").length?a("#better-analytics_sidebar .pro").fadeIn():a("#better-analytics_sidebar .pro").fadeOut()},bind_funnel_delete:function(){a(".funnel .delete").each(function(){a(this).off("click").on("click",function(){a(this).closest("li").fadeOut(400,function(){a(this).remove()})})})},bind_funnel_add:function(){a(".funnel li.funnel_step:first").clone(!0).hide().appendTo(".funnel ol").fadeIn(400).find("input").attr("value",
9
  "").last().parent().remove()},goal_type_change:function(){a(".dynamic_options").fadeOut(400);a("."+a("#ba_type").val()).fadeIn(400)},min:999999999,max:0,range:0,toggle_credentials:function(){a("#ba_api_use_own").prop("checked")&&"api"==a("#ba_current_tab").val()?a(".api_hideable").fadeIn():a(".api_hideable").fadeOut()},heatmap_draw:function(){BetterAnalyticsAdmin._Admin.min=999999999;BetterAnalyticsAdmin._Admin.max=0;a(".cell[data-val]").each(function(b,e){var c=a(e).data("val");BetterAnalyticsAdmin._Admin.min>
10
  c&&(BetterAnalyticsAdmin._Admin.min=c);BetterAnalyticsAdmin._Admin.max<c&&(BetterAnalyticsAdmin._Admin.max=c)});BetterAnalyticsAdmin._Admin.range=BetterAnalyticsAdmin._Admin.max-BetterAnalyticsAdmin._Admin.min;a(".cell[data-val]").each(function(b,e){var c=a(e).data("val");a(e).css("opacity",0==BetterAnalyticsAdmin._Admin.range?1:(c-BetterAnalyticsAdmin._Admin.min)/BetterAnalyticsAdmin._Admin.range)})},get_new_heatmap_data:function(){a(".ba_error").remove();a("#chart_loading").css("opacity",1);a.ajax(ajaxurl,
11
  {method:"POST",data:{action:"better-analytics_heatmaps",metric:a("#ba_metric").val(),segment:a("#ba_segment").val(),weeks:a("#ba_weeks").val(),end:a("#ba_end").val(),page_path:a("#ba_page_path").val()},complete:function(){a("#chart_loading").css("opacity",0)}}).done(function(b,e){void 0===b.error?(a.each(b.heatmap_data,function(b,e){a.each(e,function(d,e){a("#slot"+b+"-"+d).data("val",e)})}),BetterAnalyticsAdmin._Admin.heatmap_draw()):BetterAnalyticsAdmin._Admin.hasResponseError(b,e)})},get_new_area_chart_data:function(){a(".ba_error").remove();
@@ -22,4 +22,4 @@ c){0<a&&"(not set)"!=c[0]&&(b.realtime_data.referral_path[a]=['<a href="http://'
22
  d=new google.visualization.Table(e.getElementById("ba_rt_page_path")),d.draw(c,f))}else if("p"==b.type)c=google.visualization.arrayToDataTable(b.chart_data),d=new google.visualization.NumberFormat({fractionDigits:0}),d.format(c,1),f={title:b.title,is3D:!0,animation:{startup:!0},width:a("#ba_chart").width(),height:.7*a("#ba_chart").width()},d=new google.visualization.PieChart(e.getElementById("ba_chart")),d.draw(c,f);else if("l"==b.type){var h=[];a.each(b.chart_data,function(a,b){0<a?(dateString=String(b[0]),
23
  h[a]=[new Date(dateString.slice(0,4),dateString.slice(4,6)-1,dateString.slice(6,8)),Number(b[1])]):h[a]=[b[0],b[1]]});c=google.visualization.arrayToDataTable(h);d=new google.visualization.NumberFormat({fractionDigits:0});d.format(c,1);f={animation:{startup:!0},width:a("#ba_chart").width(),height:.7*a("#ba_chart").width(),legend:{position:"bottom"}};d=new google.visualization.LineChart(e.getElementById("ba_chart"));d.draw(c,f)}else"g"==b.type&&(c=google.visualization.arrayToDataTable(b.chart_data),
24
  d=new google.visualization.NumberFormat({fractionDigits:0}),d.format(c,1),f={title:b.title,animation:{startup:!0},width:a("#ba_chart").width(),height:.7*a("#ba_chart").width()},d=new google.visualization.GeoChart(e.getElementById("ba_chart")),d.draw(c,f));else BetterAnalyticsAdmin._Admin.hasResponseError(b,g)})},hasResponseError:function(b,e){a('<div class="ba_error">'+b.error+'<input type="submit" class="dismiss button button-primary" value="Okay"></div>').appendTo("body");a(".ba_error .dismiss").on("click",
25
- function(){a(this).closest(".ba_error").remove()});console.log(b.error)}};BetterAnalyticsAdmin._Admin=new BetterAnalyticsAdmin.Admin}(jQuery,this,document);
3
  width:"80%"}),a(".chosen-select").not("#ba_pick_profile").chosen({search_contains:!0,width:"100%"}),a("#ba_pick_profile.chosen-select").chosen({search_contains:!0,width:"70%"}));a("#ba_realtime").on("change",function(){this.checked?(a("#ba_history select").prop("disabled",!0),a("#ba_history").css("color","grey")):(a("#ba_history select").prop("disabled",!1),a("#ba_history").css("color","inherit"))});a("#ba_api_use_own").length&&(a("#ba_api_use_own").on("change",function(){BetterAnalyticsAdmin._Admin.toggle_credentials()}),
4
  BetterAnalyticsAdmin._Admin.toggle_credentials());a("#ba_pick_profile").on("change",function(){a(this).val()&&a("#ba_property_id").val(a(this).val())});a("#dashboard-widgets #better-analytics select").length&&(a("#dashboard-widgets #better-analytics select,#dashboard-widgets #better-analytics input").on("change",function(){BetterAnalyticsAdmin._Admin.chart_draw()}),BetterAnalyticsAdmin._Admin.chart_draw());a("#Heatmap").length&&(BetterAnalyticsAdmin._Admin.heatmap_draw(),a("#Heatmap + form #parameters input,#Heatmap + form #parameters select").on("change",
5
  function(){BetterAnalyticsAdmin._Admin.get_new_heatmap_data()}));a("#area_chart").length&&(BetterAnalyticsAdmin._Admin.get_new_area_chart_data(),a("#area_chart + form #parameters input,#area_chart + form #parameters select").on("change",function(){BetterAnalyticsAdmin._Admin.get_new_area_chart_data()}));a(".ba_monitor_form").length&&(BetterAnalyticsAdmin._Admin.get_new_monitor_data(),a(".ba_monitor_form input").on("change",function(){BetterAnalyticsAdmin._Admin.get_new_monitor_data()}));if(a(".goals").length&&
6
+ history.pushState){var b=g.location.search.indexOf("&id=");0<b&&(b=g.location.origin+g.location.pathname+g.location.search.substring(0,b),history.pushState({url:b},e.title,b))}a(".goal_create").length&&(BetterAnalyticsAdmin._Admin.bind_funnel_delete(),a("#new_step").on("click",BetterAnalyticsAdmin._Admin.bind_funnel_add));a(".goal_create,.experiment_create").length&&(a("#ba_type").on("change",BetterAnalyticsAdmin._Admin.goal_type_change),BetterAnalyticsAdmin._Admin.goal_type_change())})},init_tabs:function(){var b=
7
+ g.location.hash.slice(5);b||(b=a(".nav-tab:first").prop("id").slice(0,-4));BetterAnalyticsAdmin._Admin.select_tab(b);a("#better-analytics_tabs a").each(function(){a(this).on("click",BetterAnalyticsAdmin._Admin.select_tab)})},select_tab:function(b){b="object"===typeof b?a(b.currentTarget.hash.slice(4)+"-tab"):a("#"+b+"-tab");try{a("#ba_current_tab").val(a(b).prop("id").slice(0,-4))}catch(e){a("#ba_current_tab").val("general")}a(".nav-tab").removeClass("nav-tab-active");b.addClass("nav-tab-active");
8
+ a(".tab_content").css("display","none");a(".group_"+a("#ba_current_tab").val()).not(".api_hideable").fadeIn();BetterAnalyticsAdmin._Admin.toggle_credentials();a(".group_"+a("#ba_current_tab").val()+" .pro").length?a("#better-analytics_sidebar .pro").fadeIn():a("#better-analytics_sidebar .pro").fadeOut()},bind_funnel_delete:function(){a(".funnel .delete").each(function(){a(this).off("click").on("click",function(){a(this).closest("li").fadeOut(400,function(){a(this).remove()})})})},bind_funnel_add:function(){a(".funnel li.funnel_step:first").clone(!0).hide().appendTo(".funnel ol").fadeIn(400).find("input").attr("value",
9
  "").last().parent().remove()},goal_type_change:function(){a(".dynamic_options").fadeOut(400);a("."+a("#ba_type").val()).fadeIn(400)},min:999999999,max:0,range:0,toggle_credentials:function(){a("#ba_api_use_own").prop("checked")&&"api"==a("#ba_current_tab").val()?a(".api_hideable").fadeIn():a(".api_hideable").fadeOut()},heatmap_draw:function(){BetterAnalyticsAdmin._Admin.min=999999999;BetterAnalyticsAdmin._Admin.max=0;a(".cell[data-val]").each(function(b,e){var c=a(e).data("val");BetterAnalyticsAdmin._Admin.min>
10
  c&&(BetterAnalyticsAdmin._Admin.min=c);BetterAnalyticsAdmin._Admin.max<c&&(BetterAnalyticsAdmin._Admin.max=c)});BetterAnalyticsAdmin._Admin.range=BetterAnalyticsAdmin._Admin.max-BetterAnalyticsAdmin._Admin.min;a(".cell[data-val]").each(function(b,e){var c=a(e).data("val");a(e).css("opacity",0==BetterAnalyticsAdmin._Admin.range?1:(c-BetterAnalyticsAdmin._Admin.min)/BetterAnalyticsAdmin._Admin.range)})},get_new_heatmap_data:function(){a(".ba_error").remove();a("#chart_loading").css("opacity",1);a.ajax(ajaxurl,
11
  {method:"POST",data:{action:"better-analytics_heatmaps",metric:a("#ba_metric").val(),segment:a("#ba_segment").val(),weeks:a("#ba_weeks").val(),end:a("#ba_end").val(),page_path:a("#ba_page_path").val()},complete:function(){a("#chart_loading").css("opacity",0)}}).done(function(b,e){void 0===b.error?(a.each(b.heatmap_data,function(b,e){a.each(e,function(d,e){a("#slot"+b+"-"+d).data("val",e)})}),BetterAnalyticsAdmin._Admin.heatmap_draw()):BetterAnalyticsAdmin._Admin.hasResponseError(b,e)})},get_new_area_chart_data:function(){a(".ba_error").remove();
22
  d=new google.visualization.Table(e.getElementById("ba_rt_page_path")),d.draw(c,f))}else if("p"==b.type)c=google.visualization.arrayToDataTable(b.chart_data),d=new google.visualization.NumberFormat({fractionDigits:0}),d.format(c,1),f={title:b.title,is3D:!0,animation:{startup:!0},width:a("#ba_chart").width(),height:.7*a("#ba_chart").width()},d=new google.visualization.PieChart(e.getElementById("ba_chart")),d.draw(c,f);else if("l"==b.type){var h=[];a.each(b.chart_data,function(a,b){0<a?(dateString=String(b[0]),
23
  h[a]=[new Date(dateString.slice(0,4),dateString.slice(4,6)-1,dateString.slice(6,8)),Number(b[1])]):h[a]=[b[0],b[1]]});c=google.visualization.arrayToDataTable(h);d=new google.visualization.NumberFormat({fractionDigits:0});d.format(c,1);f={animation:{startup:!0},width:a("#ba_chart").width(),height:.7*a("#ba_chart").width(),legend:{position:"bottom"}};d=new google.visualization.LineChart(e.getElementById("ba_chart"));d.draw(c,f)}else"g"==b.type&&(c=google.visualization.arrayToDataTable(b.chart_data),
24
  d=new google.visualization.NumberFormat({fractionDigits:0}),d.format(c,1),f={title:b.title,animation:{startup:!0},width:a("#ba_chart").width(),height:.7*a("#ba_chart").width()},d=new google.visualization.GeoChart(e.getElementById("ba_chart")),d.draw(c,f));else BetterAnalyticsAdmin._Admin.hasResponseError(b,g)})},hasResponseError:function(b,e){a('<div class="ba_error">'+b.error+'<input type="submit" class="dismiss button button-primary" value="Okay"></div>').appendTo("body");a(".ba_error .dismiss").on("click",
25
+ function(){a(this).closest(".ba_error").remove()});console.log(b.error)}};BetterAnalyticsAdmin._Admin=new BetterAnalyticsAdmin.Admin}(jQuery,this,document);
better-analytics.php CHANGED
@@ -7,7 +7,7 @@
7
  Plugin Name: Better Analytics
8
  Plugin URI: https://marketplace.digitalpoint.com/better-analytics.3354/item
9
  Description: Adds Google Universal Analytics code to your WordPress site. Options to track most everything (social button interactions, advertising clicks, emails sent/opened, YouTube video engagement, custom dimension tracking of authors/categories, etc.) Integrates with API for reports/charts on dashboard, heat maps and real-time traffic tracking.
10
- Version: 1.0.9
11
  Author: Digital Point
12
  Author URI: https://www.digitalpoint.com/
13
  License: GPLv2
@@ -23,7 +23,7 @@ if (!function_exists('add_action'))
23
  exit;
24
  }
25
 
26
- define('BETTER_ANALYTICS_VERSION', '1.0.9');
27
  define('BETTER_ANALYTICS_MINIMUM_WP_VERSION', '3.8'); // Dashicons: https://codex.wordpress.org/Function_Reference/add_menu_page
28
  define('BETTER_ANALYTICS_PRODUCT_URL', 'https://marketplace.digitalpoint.com/better-analytics.3354/item');
29
  define('BETTER_ANALYTICS_PRO_PRODUCT_URL', 'https://marketplace.digitalpoint.com/better-analytics-pro.3355/item');
7
  Plugin Name: Better Analytics
8
  Plugin URI: https://marketplace.digitalpoint.com/better-analytics.3354/item
9
  Description: Adds Google Universal Analytics code to your WordPress site. Options to track most everything (social button interactions, advertising clicks, emails sent/opened, YouTube video engagement, custom dimension tracking of authors/categories, etc.) Integrates with API for reports/charts on dashboard, heat maps and real-time traffic tracking.
10
+ Version: 1.0.10
11
  Author: Digital Point
12
  Author URI: https://www.digitalpoint.com/
13
  License: GPLv2
23
  exit;
24
  }
25
 
26
+ define('BETTER_ANALYTICS_VERSION', '1.0.10');
27
  define('BETTER_ANALYTICS_MINIMUM_WP_VERSION', '3.8'); // Dashicons: https://codex.wordpress.org/Function_Reference/add_menu_page
28
  define('BETTER_ANALYTICS_PRODUCT_URL', 'https://marketplace.digitalpoint.com/better-analytics.3354/item');
29
  define('BETTER_ANALYTICS_PRO_PRODUCT_URL', 'https://marketplace.digitalpoint.com/better-analytics-pro.3355/item');
js/ba.js CHANGED
@@ -1,11 +1,12 @@
1
  var BetterAnalytics={};
2
  !function(a,b,d,l){BetterAnalytics.BA=function(){this.__construct()};BetterAnalytics.BA.prototype={__construct:function(){this.s=a("#ba_s").data("o");this.s.g&1073741824?this.init():a(d).ready(function(){BetterAnalytics._BA.init()})},s:null,videos:{},init:function(){this.init_start();var c="";this.s.g&2147483648&&(b.ga_debug={trace:!0},c="_debug");(function(a,e,h,f,b,c,d){a.GoogleAnalyticsObject=b;a[b]=a[b]||function(){(a[b].q=a[b].q||[]).push(arguments)};a[b].l=1*new Date;c=e.createElement(h);d=
3
- e.getElementsByTagName(h)[0];c.async=1;c.src=f;d.parentNode.insertBefore(c,d)})(b,d,"script","//www.google-analytics.com/analytics"+c+".js","ga");ga("create",this.s.tid,this.s.co);this.s.g&32&&ga("require","displayfeatures");this.s.g&4&&ga("require","linkid","linkid.js");this.s.g&64&&ga("set","forceSSL",!0);this.s.g&16&&ga("set","anonymizeIp",!0);"object"==typeof this.s.d&&a.each(this.s.d,function(a,b){ga("set","dimension"+b[0],b[1])});if("string"==typeof this.s.js)try{eval(this.s.js)}catch(k){console.error(k.stack)}this.init_end();
4
- ga("send","pageview");this.s.g&128&&setTimeout("ga('send','event','User','Engagement','Time on page more than 15 seconds')",15E3);this.s.g&2048&&a(d).ajaxComplete(function(a,b,c){a=d.createElement("a");a.href=c.url;ga("send","event","AJAX Request","Trigger",a.pathname)});this.s.g&512&&a(d).ready(function(){a("a").each(function(){if(this.href.slice(0,b.location.origin.length)!=b.location.origin)a(this).on("click",function(){ga("send","event","Link","Click",jQuery(this).prop("href"))})})});"string"==
5
- typeof this.s.dl&&a(d).ready(function(){var b=new RegExp("("+BetterAnalytics._BA.s.dl+")$");a("a").each(function(){if(this.href.match(b))a(this).on("click",function(){ga("send","event","Link","Download",jQuery(this).prop("href"))})})});this.s.g&65536&&a(d).ready(function(){a(".error404").length&&ga("send","event","Error","Page Not Found",b.location.origin+b.location.pathname+" (Referrer: "+d.referrer+")")});this.s.g&256&&a(d).ready(function(){if(a('iframe[src*="youtube.com/embed"]').length){a('iframe[src*="youtube.com/embed"]').each(function(c){var f=
6
- a(this).prop("src");-1===f.indexOf("origin=")&&a(this).prop("src",f+(-1===f.indexOf("?")?"?":"&")+"enablejsapi=1&origin="+b.location.origin);a(this).prop("id")?c=a(this).prop("id"):(c="ba_yt_"+c,a(this).prop("id",c))});var c=d.createElement("script");c.src="https://www.youtube.com/iframe_api";var e=d.getElementsByTagName("script")[0];e.parentNode.insertBefore(c,e)}});this.s.a&16&&a(b).load(function(){setTimeout(BetterAnalytics._BA.dp_bind,3E3)});this.s.s&2&&a(b).load(function(){setTimeout(function(){try{"object"==
7
- typeof FB&&a.each({"edge.create":"Like","edge.remove":"Unlike","message.send":"Send","comment.create":"Comment","comment.remove":"Uncomment"},function(a,c){FB.Event.subscribe(a,function(a){ga("send","social","Facebook",c,a)})})}catch(c){}},1E3)});this.s.s&4&&a(b).load(function(){setTimeout(function(){try{"object"==typeof twttr&&a.each({tweet:"Tweet",follow:"Follow",retweet:"Retweet",favorite:"Favorite",click:"Click"},function(a,c){twttr.events.bind(a,function(a){if(a){var b;a.target&&"IFRAME"==a.target.nodeName&&
8
- (b=BetterAnalytics._BA.extract_param(a.target.src,"url"));ga("send","social","Twitter",c,b)}})})}catch(c){}},1E3)});this.s.s&16&&a(b).load(function(){setTimeout(function(){try{a.each({'a[data-pin-log="button_follow"]':"Follow",'a[data-pin-log="embed_pin"]':"Pin",'a[data-pin-log="button_pinit_bookmarklet"]':"Pin"},function(c,b){a("body").on("click",c,function(a){a=d.href;"Follow"==b?a=jQuery(this).attr("href"):"Repin"==b&&(a=jQuery(this).parent().attr("href"));ga("send","social","Pinterest",b,a)})})}catch(c){}},
9
- 1E3)});this.s.s&32&&a(b).load(function(){setTimeout(function(){a(".IN-widget").on("click",function(){ga("send","social","LinkedIn","Share",b.location.href)})},1E3)})},init_start:function(){},init_end:function(){},dp_bind:function(){a(".dp_ad_inner").parent().on("click",function(){ga("send","event","Advertising","Click","Digital Point")})},yt_init:function(c){a('iframe[src*="youtube.com/embed"]').each(function(c){c=a(this).prop("id");BetterAnalytics._BA.videos[c]=new YT.Player(c,{events:{onStateChange:BetterAnalytics._BA.yt_state_change,
10
- onError:BetterAnalytics._BA.yt_error}})})},yt_state_change:function(a){0<=a.data&&jQuery.each(YT.PlayerState,function(d,g){"number"==typeof g&&g==a.data&&ga("send","event","YouTube Video",d.charAt(0).toUpperCase()+d.substr(1).toLowerCase(),b.location.origin+b.location.pathname+" | "+a.target.getVideoData().title+" ("+a.target.getVideoUrl()+")")})},yt_error:function(a){},extract_param:function(a,b){if(a){a=a.split("#")[0];var d=a.split("?");if(1!=d.length){d=decodeURI(d[1]);paramName+="=";for(var d=
11
- d.split("&"),e=0;b=d[e];++e)if(0===b.indexOf(paramName))return decodeURIComponent(b.split("=")[1])}}}}}(jQuery,this,document);originalYouTubeIFrame=onYouTubeIframeAPIReady;function onYouTubeIframeAPIReady(a){BetterAnalytics._BA.yt_init(a);originalYouTubeIFrame!=onYouTubeIframeAPIReady&&originalYouTubeIFrame(a)};
 
1
  var BetterAnalytics={};
2
  !function(a,b,d,l){BetterAnalytics.BA=function(){this.__construct()};BetterAnalytics.BA.prototype={__construct:function(){this.s=a("#ba_s").data("o");this.s.g&1073741824?this.init():a(d).ready(function(){BetterAnalytics._BA.init()})},s:null,videos:{},init:function(){this.init_start();var c="";this.s.g&2147483648&&(b.ga_debug={trace:!0},c="_debug");(function(a,e,h,f,b,c,d){a.GoogleAnalyticsObject=b;a[b]=a[b]||function(){(a[b].q=a[b].q||[]).push(arguments)};a[b].l=1*new Date;c=e.createElement(h);d=
3
+ e.getElementsByTagName(h)[0];c.async=1;c.src=f;d.parentNode.insertBefore(c,d)})(b,d,"script","//www.google-analytics.com/analytics"+c+".js","ga");ga("create",this.s.tid,this.s.co);this.s.g&32&&ga("require","displayfeatures");this.s.g&4&&ga("require","linkid","linkid.js");this.s.g&64&&ga("set","forceSSL",!0);this.s.g&16&&ga("set","anonymizeIp",!0);"object"==typeof this.s.d&&a.each(this.s.d,function(a,b){ga("set","dimension"+b[0],b[1])});"object"==typeof this.s.e&&(ga("set","expId",this.s.e.i),ga("set",
4
+ "expVar",this.s.e.v));if("string"==typeof this.s.js)try{eval(this.s.js)}catch(k){console.error(k.stack)}this.init_end();ga("send","pageview");this.s.g&128&&setTimeout("ga('send','event','User','Engagement','Time on page more than 15 seconds')",15E3);this.s.g&2048&&a(d).ajaxComplete(function(a,b,c){a=d.createElement("a");a.href=c.url;ga("send","event","AJAX Request","Trigger",a.pathname)});this.s.g&512&&a(d).ready(function(){a("a").each(function(){if(this.href.slice(0,b.location.origin.length)!=b.location.origin)a(this).on("click",
5
+ function(){ga("send","event","Link","Click",jQuery(this).prop("href"))})})});"string"==typeof this.s.dl&&a(d).ready(function(){var b=new RegExp("("+BetterAnalytics._BA.s.dl+")$");a("a").each(function(){if(this.href.match(b))a(this).on("click",function(){ga("send","event","Link","Download",jQuery(this).prop("href"))})})});this.s.g&65536&&a(d).ready(function(){a(".error404").length&&ga("send","event","Error","Page Not Found",b.location.origin+b.location.pathname+" (Referrer: "+d.referrer+")")});this.s.g&
6
+ 256&&a(d).ready(function(){if(a('iframe[src*="youtube.com/embed"]').length){a('iframe[src*="youtube.com/embed"]').each(function(c){var f=a(this).prop("src");-1===f.indexOf("origin=")&&a(this).prop("src",f+(-1===f.indexOf("?")?"?":"&")+"enablejsapi=1&origin="+b.location.origin);a(this).prop("id")?c=a(this).prop("id"):(c="ba_yt_"+c,a(this).prop("id",c))});var c=d.createElement("script");c.src="https://www.youtube.com/iframe_api";var e=d.getElementsByTagName("script")[0];e.parentNode.insertBefore(c,
7
+ e)}});this.s.a&16&&a(b).load(function(){setTimeout(BetterAnalytics._BA.dp_bind,3E3)});this.s.s&2&&a(b).load(function(){setTimeout(function(){try{"object"==typeof FB&&a.each({"edge.create":"Like","edge.remove":"Unlike","message.send":"Send","comment.create":"Comment","comment.remove":"Uncomment"},function(a,c){FB.Event.subscribe(a,function(a){ga("send","social","Facebook",c,a)})})}catch(c){}},1E3)});this.s.s&4&&a(b).load(function(){setTimeout(function(){try{"object"==typeof twttr&&a.each({tweet:"Tweet",
8
+ follow:"Follow",retweet:"Retweet",favorite:"Favorite",click:"Click"},function(a,c){twttr.events.bind(a,function(a){if(a){var b;a.target&&"IFRAME"==a.target.nodeName&&(b=BetterAnalytics._BA.extract_param(a.target.src,"url"));ga("send","social","Twitter",c,b)}})})}catch(c){}},1E3)});this.s.s&16&&a(b).load(function(){setTimeout(function(){try{a.each({'a[data-pin-log="button_follow"]':"Follow",'a[data-pin-log="embed_pin"]':"Pin",'a[data-pin-log="button_pinit_bookmarklet"]':"Pin"},function(c,b){a("body").on("click",
9
+ c,function(a){a=d.href;"Follow"==b?a=jQuery(this).attr("href"):"Repin"==b&&(a=jQuery(this).parent().attr("href"));ga("send","social","Pinterest",b,a)})})}catch(c){}},1E3)});this.s.s&32&&a(b).load(function(){setTimeout(function(){a(".IN-widget").on("click",function(){ga("send","social","LinkedIn","Share",b.location.href)})},1E3)})},init_start:function(){},init_end:function(){},dp_bind:function(){a(".dp_ad_inner").parent().on("click",function(){ga("send","event","Advertising","Click","Digital Point")})},
10
+ yt_init:function(c){a('iframe[src*="youtube.com/embed"]').each(function(c){c=a(this).prop("id");BetterAnalytics._BA.videos[c]=new YT.Player(c,{events:{onStateChange:BetterAnalytics._BA.yt_state_change,onError:BetterAnalytics._BA.yt_error}})})},yt_state_change:function(a){0<=a.data&&jQuery.each(YT.PlayerState,function(d,g){"number"==typeof g&&g==a.data&&ga("send","event","YouTube Video",d.charAt(0).toUpperCase()+d.substr(1).toLowerCase(),b.location.origin+b.location.pathname+" | "+a.target.getVideoData().title+
11
+ " ("+a.target.getVideoUrl()+")")})},yt_error:function(a){},extract_param:function(a,b){if(a){a=a.split("#")[0];var d=a.split("?");if(1!=d.length){d=decodeURI(d[1]);paramName+="=";for(var d=d.split("&"),e=0;b=d[e];++e)if(0===b.indexOf(paramName))return decodeURIComponent(b.split("=")[1])}}}}}(jQuery,this,document);originalYouTubeIFrame=onYouTubeIframeAPIReady;
12
+ function onYouTubeIframeAPIReady(a){BetterAnalytics._BA.yt_init(a);originalYouTubeIFrame!=onYouTubeIframeAPIReady&&originalYouTubeIFrame(a)};
js/universal.php CHANGED
@@ -189,9 +189,18 @@ if (!empty($betterAnalyticsOptions['dimension']['user']) && @$currentUser->ID >
189
  );
190
  }
191
 
 
 
 
 
 
 
 
 
 
192
  if (!array_intersect((array)$currentUser->roles, (array)@$betterAnalyticsOptions['roles_no_track']))
193
  {
194
  echo "<!-- This site uses the Better Analytics plugin. " . BETTER_ANALYTICS_PRODUCT_URL . " -->
195
  <meta id='ba_s' data-o=\"" . htmlentities(json_encode($jsonOptions)) . "\" />
196
- <script async=\"async\" type='text/javascript' src='" . plugins_url('better-analytics/js/loader.php') . "?ver=" . BETTER_ANALYTICS_VERSION . ".js' ></script>";
197
  }
189
  );
190
  }
191
 
192
+ if (false)
193
+ {
194
+ $jsonOptions['e'] = array(
195
+ 'i' => $experimentId,
196
+ 'v' => $experimentVariation
197
+ );
198
+ }
199
+
200
+
201
  if (!array_intersect((array)$currentUser->roles, (array)@$betterAnalyticsOptions['roles_no_track']))
202
  {
203
  echo "<!-- This site uses the Better Analytics plugin. " . BETTER_ANALYTICS_PRODUCT_URL . " -->
204
  <meta id='ba_s' data-o=\"" . htmlentities(json_encode($jsonOptions)) . "\" />
205
+ <script type='text/javascript' src='" . plugins_url('better-analytics/js/loader.php') . "?ver=" . BETTER_ANALYTICS_VERSION . ".js' ></script>";
206
  }
languages/better-analytics.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Better Analytics package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Better Analytics 1.0.8\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/better-analytics\n"
7
- "POT-Creation-Date: 2015-07-24 16:30:44+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -54,6 +54,8 @@ msgid "Events"
54
  msgstr ""
55
 
56
  #: library/DigitalPointBetterAnalytics/Base/Admin.php:100
 
 
57
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:479
58
  msgid "Goals"
59
  msgstr ""
@@ -68,7 +70,7 @@ msgstr ""
68
  msgid "Test Setup"
69
  msgstr ""
70
 
71
- #. #-#-#-#-# plugin.pot (Better Analytics 1.0.8) #-#-#-#-#
72
  #. Plugin Name of the plugin/theme
73
  #: library/DigitalPointBetterAnalytics/Base/Admin.php:106
74
  #: library/DigitalPointBetterAnalytics/Base/Admin.php:199
@@ -225,17 +227,17 @@ msgstr ""
225
  msgid "Verify Domain"
226
  msgstr ""
227
 
228
- #: library/DigitalPointBetterAnalytics/Base/Public.php:148
229
  msgid ""
230
  "%1$sBetter Analytics %4$s requires WordPress %5$s or higher.%2$s%3$sPlease "
231
  "%6$supgrade WordPress%7$s to a current version."
232
  msgstr ""
233
 
234
- #: library/DigitalPointBetterAnalytics/Base/Public.php:302
235
  msgid "Page Analytics"
236
  msgstr ""
237
 
238
- #: library/DigitalPointBetterAnalytics/Base/Public.php:489
239
  msgid "Every Minute"
240
  msgstr ""
241
 
@@ -322,7 +324,7 @@ msgstr ""
322
 
323
  #: library/DigitalPointBetterAnalytics/ControllerAdmin/Analytics.php:385
324
  #: library/DigitalPointBetterAnalytics/ControllerAdmin/Analytics.php:443
325
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:77
326
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:73
327
  msgid "Type"
328
  msgstr ""
@@ -394,6 +396,7 @@ msgid "Country"
394
  msgstr ""
395
 
396
  #: library/DigitalPointBetterAnalytics/ControllerAdmin/Analytics.php:640
 
397
  #: library/DigitalPointBetterAnalytics/Model/Reporting.php:44
398
  msgid "Page Views"
399
  msgstr ""
@@ -419,14 +422,14 @@ msgstr ""
419
 
420
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:106
421
  #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:102
422
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:70
423
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:157
424
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:66
425
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:153
426
  msgid "Name"
427
  msgstr ""
428
 
429
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:107
 
430
  msgid "Status"
431
  msgstr ""
432
 
@@ -463,7 +466,6 @@ msgstr[1] ""
463
 
464
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:151
465
  #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:147
466
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:101
467
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:97
468
  msgid "Active"
469
  msgid_plural "Active"
@@ -490,27 +492,25 @@ msgid "Deactivate"
490
  msgstr ""
491
 
492
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:239
493
- #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:277
494
  msgid "Select %s"
495
  msgstr ""
496
 
497
  #. translators: PHP date format - see: http:php.net/manual/function.date.php
498
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:262
499
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:268
500
- #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:302
501
- #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:308
502
  msgid "Y/m/d g:i a"
503
  msgstr ""
504
 
505
  #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:103
506
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:42
507
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:38
508
  msgid "Slot"
509
  msgstr ""
510
 
511
  #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:104
512
  #: library/DigitalPointBetterAnalytics/Model/Goals.php:62
513
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:107
514
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:103
515
  msgid "Value"
516
  msgstr ""
@@ -520,9 +520,11 @@ msgstr ""
520
  msgid "%1$u hours, %2$u minutes, %3$u seconds"
521
  msgstr ""
522
 
523
- #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:291
524
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:50
525
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:61
 
 
526
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:46
527
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:57
528
  msgid "Goal ID %1$u / Goal Set %2$u"
@@ -554,6 +556,56 @@ msgstr ""
554
  msgid "Ended"
555
  msgstr ""
556
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
557
  #: library/DigitalPointBetterAnalytics/Model/Goals.php:8
558
  msgid "Destination URL"
559
  msgstr ""
@@ -591,8 +643,6 @@ msgid "Less than"
591
  msgstr ""
592
 
593
  #: library/DigitalPointBetterAnalytics/Model/Goals.php:49
594
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:194
595
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:214
596
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:190
597
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:210
598
  msgid "Greater than"
@@ -625,10 +675,6 @@ msgstr ""
625
  msgid "Session"
626
  msgstr ""
627
 
628
- #: library/DigitalPointBetterAnalytics/Model/Reporting.php:15
629
- msgid "Bounces"
630
- msgstr ""
631
-
632
  #: library/DigitalPointBetterAnalytics/Model/Reporting.php:16
633
  msgid "Bounce Rate"
634
  msgstr ""
@@ -855,10 +901,6 @@ msgstr ""
855
  msgid "Advertisement Clicked"
856
  msgstr ""
857
 
858
- #: library/DigitalPointBetterAnalytics/Model/Reporting.php:80
859
- msgid "Ecommerce"
860
- msgstr ""
861
-
862
  #: library/DigitalPointBetterAnalytics/Model/Reporting.php:81
863
  msgid "Transactions"
864
  msgstr ""
@@ -885,11 +927,6 @@ msgstr ""
885
  msgid "DoubleClick Campaign Manager"
886
  msgstr ""
887
 
888
- #: library/DigitalPointBetterAnalytics/Model/Reporting.php:97
889
- #: library/DigitalPointBetterAnalytics/ViewAdmin/config.php:637
890
- msgid "AdSense"
891
- msgstr ""
892
-
893
  #: library/DigitalPointBetterAnalytics/Model/Reporting.php:98
894
  msgid "Revenue"
895
  msgstr ""
@@ -1043,12 +1080,6 @@ msgstr ""
1043
  msgid "Days Since Last Visit"
1044
  msgstr ""
1045
 
1046
- #: library/DigitalPointBetterAnalytics/Model/Reporting.php:179
1047
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:181
1048
- #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:177
1049
- msgid "Session Duration"
1050
- msgstr ""
1051
-
1052
  #: library/DigitalPointBetterAnalytics/Model/Reporting.php:182
1053
  msgid "Campaign"
1054
  msgstr ""
@@ -1593,7 +1624,7 @@ msgstr ""
1593
  msgid "Taboola"
1594
  msgstr ""
1595
 
1596
- #. #-#-#-#-# plugin.pot (Better Analytics 1.0.8) #-#-#-#-#
1597
  #. Author of the plugin/theme
1598
  #: library/DigitalPointBetterAnalytics/ViewAdmin/config.php:657
1599
  msgid "Digital Point"
@@ -1952,153 +1983,306 @@ msgstr ""
1952
  msgid "active users"
1953
  msgstr ""
1954
 
1955
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:30
1956
- #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:26
1957
- msgid "Edit Goal"
1958
  msgstr ""
1959
 
1960
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:30
1961
- #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:26
1962
- msgid "Create Goal"
1963
  msgstr ""
1964
 
1965
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:54
1966
- #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:50
1967
- msgid "Pick slot"
1968
  msgstr ""
1969
 
1970
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:81
1971
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:118
1972
- #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:77
1973
- #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:114
1974
- msgid "Pick type"
1975
  msgstr ""
1976
 
1977
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:107
1978
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:139
 
 
 
1979
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:103
1980
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:135
1981
  msgid "Optional"
1982
  msgstr ""
1983
 
1984
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1985
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:110
1986
  msgid "Destination"
1987
  msgstr ""
1988
 
1989
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:129
1990
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:158
1991
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:125
1992
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:154
1993
  msgid "URL"
1994
  msgstr ""
1995
 
1996
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:133
1997
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:129
1998
  msgid "Case sensitive"
1999
  msgstr ""
2000
 
2001
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:138
2002
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:134
2003
  msgid "Funnel"
2004
  msgstr ""
2005
 
2006
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:166
2007
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:162
2008
  msgid "Required"
2009
  msgstr ""
2010
 
2011
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:176
2012
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:172
2013
  msgid "Add another step"
2014
  msgstr ""
2015
 
2016
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:189
2017
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:185
2018
  msgid "Hours"
2019
  msgstr ""
2020
 
2021
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:190
2022
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:186
2023
  msgid "Minutes"
2024
  msgstr ""
2025
 
2026
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:191
2027
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:187
2028
  msgid "Seconds"
2029
  msgstr ""
2030
 
2031
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:210
2032
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:206
2033
  msgid "Pages Per Session"
2034
  msgstr ""
2035
 
2036
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:224
2037
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:220
2038
  msgid "Conditions"
2039
  msgstr ""
2040
 
2041
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:298
2042
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:294
2043
  msgid "Use the Event value as the Goal Value for the conversion"
2044
  msgstr ""
2045
 
2046
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:330
2047
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:326
2048
  msgid "Goal name is required."
2049
  msgstr ""
2050
 
2051
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:366
2052
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:362
2053
  msgid "Destination URL is required."
2054
  msgstr ""
2055
 
2056
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:429
2057
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:425
2058
  msgid "You must specify a Category, Action or Label."
2059
  msgstr ""
2060
 
2061
  #. translators: %1$s = <strong>, %2$s = </strong>
2062
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:456
2063
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:452
2064
  msgid "Goal %1$supdated%2$s."
2065
  msgstr ""
2066
 
2067
  #. translators: %1$s = <strong>, %2$s = </strong>
2068
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:461
2069
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:457
2070
  msgid "Goal %1$screated%2$s."
2071
  msgstr ""
2072
 
2073
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:483
2074
- msgid "Experiments"
2075
- msgstr ""
2076
-
2077
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:484
2078
- #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:480
2079
- msgid "Add New"
2080
- msgstr ""
2081
-
2082
- #. translators: %1$s = <strong>, %2$s = </strong>
2083
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:495
2084
- msgid "Experiment %1$sactivated%2$s."
2085
- msgstr ""
2086
-
2087
- #. translators: %1$s = <strong>, %2$s = </strong>
2088
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:500
2089
- msgid "Selected experiments %1$sactivated%2$s."
2090
- msgstr ""
2091
-
2092
- #. translators: %1$s = <strong>, %2$s = </strong>
2093
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:505
2094
- msgid "Experiment %1$sdeactivated%2$s."
2095
- msgstr ""
2096
-
2097
- #. translators: %1$s = <strong>, %2$s = </strong>
2098
- #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:510
2099
- msgid "Selected experiments %1$sdeactivated%2$s."
2100
- msgstr ""
2101
-
2102
  #. translators: %1$s = <strong>, %2$s = </strong>
2103
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:491
2104
  msgid "Goal %1$sactivated%2$s."
2
  # This file is distributed under the same license as the Better Analytics package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Better Analytics 1.0.9\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/better-analytics\n"
7
+ "POT-Creation-Date: 2015-08-17 18:03:33+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
54
  msgstr ""
55
 
56
  #: library/DigitalPointBetterAnalytics/Base/Admin.php:100
57
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:34
58
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:45
59
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:479
60
  msgid "Goals"
61
  msgstr ""
70
  msgid "Test Setup"
71
  msgstr ""
72
 
73
+ #. #-#-#-#-# plugin.pot (Better Analytics 1.0.9) #-#-#-#-#
74
  #. Plugin Name of the plugin/theme
75
  #: library/DigitalPointBetterAnalytics/Base/Admin.php:106
76
  #: library/DigitalPointBetterAnalytics/Base/Admin.php:199
227
  msgid "Verify Domain"
228
  msgstr ""
229
 
230
+ #: library/DigitalPointBetterAnalytics/Base/Public.php:180
231
  msgid ""
232
  "%1$sBetter Analytics %4$s requires WordPress %5$s or higher.%2$s%3$sPlease "
233
  "%6$supgrade WordPress%7$s to a current version."
234
  msgstr ""
235
 
236
+ #: library/DigitalPointBetterAnalytics/Base/Public.php:334
237
  msgid "Page Analytics"
238
  msgstr ""
239
 
240
+ #: library/DigitalPointBetterAnalytics/Base/Public.php:521
241
  msgid "Every Minute"
242
  msgstr ""
243
 
324
 
325
  #: library/DigitalPointBetterAnalytics/ControllerAdmin/Analytics.php:385
326
  #: library/DigitalPointBetterAnalytics/ControllerAdmin/Analytics.php:443
327
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:211
328
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:73
329
  msgid "Type"
330
  msgstr ""
396
  msgstr ""
397
 
398
  #: library/DigitalPointBetterAnalytics/ControllerAdmin/Analytics.php:640
399
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:21
400
  #: library/DigitalPointBetterAnalytics/Model/Reporting.php:44
401
  msgid "Page Views"
402
  msgstr ""
422
 
423
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:106
424
  #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:102
425
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:110
 
426
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:66
427
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:153
428
  msgid "Name"
429
  msgstr ""
430
 
431
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:107
432
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:96
433
  msgid "Status"
434
  msgstr ""
435
 
466
 
467
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:151
468
  #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:147
 
469
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:97
470
  msgid "Active"
471
  msgid_plural "Active"
492
  msgstr ""
493
 
494
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:239
495
+ #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:260
496
  msgid "Select %s"
497
  msgstr ""
498
 
499
  #. translators: PHP date format - see: http:php.net/manual/function.date.php
500
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:262
501
  #: library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:268
502
+ #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:285
503
+ #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:291
504
  msgid "Y/m/d g:i a"
505
  msgstr ""
506
 
507
  #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:103
 
508
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:38
509
  msgid "Slot"
510
  msgstr ""
511
 
512
  #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:104
513
  #: library/DigitalPointBetterAnalytics/Model/Goals.php:62
 
514
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:103
515
  msgid "Value"
516
  msgstr ""
520
  msgid "%1$u hours, %2$u minutes, %3$u seconds"
521
  msgstr ""
522
 
523
+ #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:255
524
+ msgid "Show more details"
525
+ msgstr ""
526
+
527
+ #: library/DigitalPointBetterAnalytics/Formatting/GoalTable.php:274
528
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:46
529
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:57
530
  msgid "Goal ID %1$u / Goal Set %2$u"
556
  msgid "Ended"
557
  msgstr ""
558
 
559
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:20
560
+ msgid "Site Usage"
561
+ msgstr ""
562
+
563
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:22
564
+ #: library/DigitalPointBetterAnalytics/Model/Reporting.php:15
565
+ msgid "Bounces"
566
+ msgstr ""
567
+
568
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:23
569
+ #: library/DigitalPointBetterAnalytics/Model/Reporting.php:179
570
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:177
571
+ msgid "Session Duration"
572
+ msgstr ""
573
+
574
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:25
575
+ #: library/DigitalPointBetterAnalytics/Model/Reporting.php:97
576
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/config.php:637
577
+ msgid "AdSense"
578
+ msgstr ""
579
+
580
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:26
581
+ msgid "AdSense Ads Clicked"
582
+ msgstr ""
583
+
584
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:27
585
+ msgid "AdSense Impressions"
586
+ msgstr ""
587
+
588
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:28
589
+ msgid "AdSense Revenue"
590
+ msgstr ""
591
+
592
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:30
593
+ #: library/DigitalPointBetterAnalytics/Model/Reporting.php:80
594
+ msgid "Ecommerce"
595
+ msgstr ""
596
+
597
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:31
598
+ msgid "Ecommerce Revenue"
599
+ msgstr ""
600
+
601
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:32
602
+ msgid "Ecommerce Transactions"
603
+ msgstr ""
604
+
605
+ #: library/DigitalPointBetterAnalytics/Model/Experiments.php:50
606
+ msgid "Goal %1$u Completions (%2$s)"
607
+ msgstr ""
608
+
609
  #: library/DigitalPointBetterAnalytics/Model/Goals.php:8
610
  msgid "Destination URL"
611
  msgstr ""
643
  msgstr ""
644
 
645
  #: library/DigitalPointBetterAnalytics/Model/Goals.php:49
 
 
646
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:190
647
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:210
648
  msgid "Greater than"
675
  msgid "Session"
676
  msgstr ""
677
 
 
 
 
 
678
  #: library/DigitalPointBetterAnalytics/Model/Reporting.php:16
679
  msgid "Bounce Rate"
680
  msgstr ""
901
  msgid "Advertisement Clicked"
902
  msgstr ""
903
 
 
 
 
 
904
  #: library/DigitalPointBetterAnalytics/Model/Reporting.php:81
905
  msgid "Transactions"
906
  msgstr ""
927
  msgid "DoubleClick Campaign Manager"
928
  msgstr ""
929
 
 
 
 
 
 
930
  #: library/DigitalPointBetterAnalytics/Model/Reporting.php:98
931
  msgid "Revenue"
932
  msgstr ""
1080
  msgid "Days Since Last Visit"
1081
  msgstr ""
1082
 
 
 
 
 
 
 
1083
  #: library/DigitalPointBetterAnalytics/Model/Reporting.php:182
1084
  msgid "Campaign"
1085
  msgstr ""
1624
  msgid "Taboola"
1625
  msgstr ""
1626
 
1627
+ #. #-#-#-#-# plugin.pot (Better Analytics 1.0.9) #-#-#-#-#
1628
  #. Author of the plugin/theme
1629
  #: library/DigitalPointBetterAnalytics/ViewAdmin/config.php:657
1630
  msgid "Digital Point"
1983
  msgid "active users"
1984
  msgstr ""
1985
 
1986
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:69
1987
+ msgid "View Experiment"
 
1988
  msgstr ""
1989
 
1990
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:69
1991
+ msgid "Edit Experiment"
 
1992
  msgstr ""
1993
 
1994
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:69
1995
+ msgid "Create Experiment"
 
1996
  msgstr ""
1997
 
1998
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:74
1999
+ msgid ""
2000
+ "This experiment was not created by Better Analytics. You can view it for "
2001
+ "informational purposes, but you cannot make changes to it."
 
2002
  msgstr ""
2003
 
2004
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:117
2005
+ msgid "Description"
2006
+ msgstr ""
2007
+
2008
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:117
2009
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:103
2010
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:135
2011
  msgid "Optional"
2012
  msgstr ""
2013
 
2014
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:125
2015
+ msgid "Objective Metric"
2016
+ msgstr ""
2017
+
2018
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:128
2019
+ msgid "Pick optimization type"
2020
+ msgstr ""
2021
+
2022
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:129
2023
+ msgid "Most"
2024
+ msgstr ""
2025
+
2026
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:130
2027
+ msgid "Least"
2028
+ msgstr ""
2029
+
2030
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:133
2031
+ msgid "Pick objective metric"
2032
+ msgstr ""
2033
+
2034
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:156
2035
+ msgid "Minimum Days To Run"
2036
+ msgstr ""
2037
+
2038
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:163
2039
+ msgid "Traffic To Experiment On"
2040
+ msgstr ""
2041
+
2042
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:165
2043
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:199
2044
+ msgid "%"
2045
+ msgstr ""
2046
+
2047
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:170
2048
+ msgid "Traffic Distribution Type"
2049
+ msgstr ""
2050
+
2051
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:171
2052
+ msgid ""
2053
+ "Use this option to assign how traffic is divided between the original and "
2054
+ "variations for life of the experiment. By default, Content Experiments "
2055
+ "follows the behavior of %1$sadjusting traffic dynamically based on variation "
2056
+ "performance%2$s."
2057
+ msgstr ""
2058
+
2059
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:181
2060
+ msgid "Automatically adjust traffic dynamically "
2061
+ msgstr ""
2062
+
2063
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:186
2064
+ msgid "Distribute traffic evenly across all variations"
2065
+ msgstr ""
2066
+
2067
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:195
2068
+ msgid "Confidence Threshold"
2069
+ msgstr ""
2070
+
2071
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:196
2072
+ msgid ""
2073
+ "Set the minimum confidence threshold that must be achieved before Analytics "
2074
+ "can declare a winner. The higher the threshold, the more confident you can "
2075
+ "be in the result. A higher threshold can result in Analytics taking longer "
2076
+ "to declare a winner."
2077
+ msgstr ""
2078
+
2079
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:222
2080
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:77
2081
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:114
2082
+ msgid "Pick type"
2083
+ msgstr ""
2084
+
2085
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:226
2086
+ msgid "Post Title"
2087
+ msgstr ""
2088
+
2089
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:230
2090
+ msgid "Page Title"
2091
+ msgstr ""
2092
+
2093
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:234
2094
+ msgid "CSS"
2095
+ msgstr ""
2096
+
2097
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:238
2098
+ msgid "Theme"
2099
+ msgstr ""
2100
+
2101
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:256
2102
+ msgid "Post"
2103
+ msgstr ""
2104
+
2105
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:261
2106
+ msgid "Pick post"
2107
+ msgstr ""
2108
+
2109
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:276
2110
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:329
2111
+ msgid "Title Variations"
2112
+ msgstr ""
2113
+
2114
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:284
2115
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:293
2116
+ msgid "Enter a post title variation here"
2117
+ msgstr ""
2118
+
2119
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:301
2120
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:354
2121
+ msgid "Add another title variation"
2122
+ msgstr ""
2123
+
2124
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:309
2125
+ msgid "Page"
2126
+ msgstr ""
2127
+
2128
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:314
2129
+ msgid "Pick page"
2130
+ msgstr ""
2131
+
2132
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:337
2133
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:346
2134
+ msgid "Enter a page title variation here"
2135
+ msgstr ""
2136
+
2137
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:361
2138
+ msgid "Custom CSS"
2139
+ msgstr ""
2140
+
2141
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:400
2142
+ msgid "Add another CSS variation"
2143
+ msgstr ""
2144
+
2145
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:407
2146
+ msgid "Theme Variations"
2147
+ msgstr ""
2148
+
2149
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:425
2150
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:427
2151
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:444
2152
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:446
2153
+ msgid "Pick theme"
2154
+ msgstr ""
2155
+
2156
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:463
2157
+ msgid "Add another theme variation"
2158
+ msgstr ""
2159
+
2160
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:621
2161
+ msgid "Experiment name is required."
2162
+ msgstr ""
2163
+
2164
+ #. translators: %1$s = <strong>, %2$s = </strong>
2165
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:664
2166
+ msgid "Experiment %1$supdated%2$s."
2167
+ msgstr ""
2168
+
2169
+ #. translators: %1$s = <strong>, %2$s = </strong>
2170
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:669
2171
+ msgid "Experiment %1$screated%2$s."
2172
+ msgstr ""
2173
+
2174
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:691
2175
+ msgid "Experiments"
2176
+ msgstr ""
2177
+
2178
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:692
2179
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:480
2180
+ msgid "Add New"
2181
+ msgstr ""
2182
+
2183
+ #. translators: %1$s = <strong>, %2$s = </strong>
2184
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:703
2185
+ msgid "Experiment %1$sactivated%2$s."
2186
+ msgstr ""
2187
+
2188
+ #. translators: %1$s = <strong>, %2$s = </strong>
2189
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:708
2190
+ msgid "Selected experiments %1$sactivated%2$s."
2191
+ msgstr ""
2192
+
2193
+ #. translators: %1$s = <strong>, %2$s = </strong>
2194
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:713
2195
+ msgid "Experiment %1$sdeactivated%2$s."
2196
+ msgstr ""
2197
+
2198
+ #. translators: %1$s = <strong>, %2$s = </strong>
2199
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:718
2200
+ msgid "Selected experiments %1$sdeactivated%2$s."
2201
+ msgstr ""
2202
+
2203
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:26
2204
+ msgid "Edit Goal"
2205
+ msgstr ""
2206
+
2207
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:26
2208
+ msgid "Create Goal"
2209
+ msgstr ""
2210
+
2211
+ #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:50
2212
+ msgid "Pick slot"
2213
+ msgstr ""
2214
+
2215
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:110
2216
  msgid "Destination"
2217
  msgstr ""
2218
 
 
 
2219
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:125
2220
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:154
2221
  msgid "URL"
2222
  msgstr ""
2223
 
 
2224
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:129
2225
  msgid "Case sensitive"
2226
  msgstr ""
2227
 
 
2228
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:134
2229
  msgid "Funnel"
2230
  msgstr ""
2231
 
 
2232
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:162
2233
  msgid "Required"
2234
  msgstr ""
2235
 
 
2236
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:172
2237
  msgid "Add another step"
2238
  msgstr ""
2239
 
 
2240
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:185
2241
  msgid "Hours"
2242
  msgstr ""
2243
 
 
2244
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:186
2245
  msgid "Minutes"
2246
  msgstr ""
2247
 
 
2248
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:187
2249
  msgid "Seconds"
2250
  msgstr ""
2251
 
 
2252
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:206
2253
  msgid "Pages Per Session"
2254
  msgstr ""
2255
 
 
2256
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:220
2257
  msgid "Conditions"
2258
  msgstr ""
2259
 
 
2260
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:294
2261
  msgid "Use the Event value as the Goal Value for the conversion"
2262
  msgstr ""
2263
 
 
2264
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:326
2265
  msgid "Goal name is required."
2266
  msgstr ""
2267
 
 
2268
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:362
2269
  msgid "Destination URL is required."
2270
  msgstr ""
2271
 
 
2272
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:425
2273
  msgid "You must specify a Category, Action or Label."
2274
  msgstr ""
2275
 
2276
  #. translators: %1$s = <strong>, %2$s = </strong>
 
2277
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:452
2278
  msgid "Goal %1$supdated%2$s."
2279
  msgstr ""
2280
 
2281
  #. translators: %1$s = <strong>, %2$s = </strong>
 
2282
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:457
2283
  msgid "Goal %1$screated%2$s."
2284
  msgstr ""
2285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2286
  #. translators: %1$s = <strong>, %2$s = </strong>
2287
  #: library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:491
2288
  msgid "Goal %1$sactivated%2$s."
library/DigitalPointBetterAnalytics/Base/Admin.php CHANGED
@@ -75,7 +75,7 @@ class DigitalPointBetterAnalytics_Base_Admin
75
 
76
  public function admin_init()
77
  {
78
- register_setting('better-analytics-group', 'better_analytics');
79
 
80
  // allows us to use a redirect on the better_analytics-auth page
81
  ob_start();
@@ -98,7 +98,7 @@ class DigitalPointBetterAnalytics_Base_Admin
98
  }
99
 
100
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('Goals', 'better-analytics'), esc_html__('Goals', 'better-analytics'), 'manage_options', 'better-analytics_goals', array($this, 'display_page') );
101
- // add_submenu_page( 'better-analytics_heatmaps', esc_html__('A/B Testing', 'better-analytics'), esc_html__('A/B Testing', 'better-analytics'), 'manage_options', 'better-analytics_experiments', array($this, 'display_page') );
102
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('Settings', 'better-analytics'), esc_html__('Settings', 'better-analytics'), 'manage_options', 'options-general.php' . '?page=better-analytics' );
103
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('Test Setup', 'better-analytics'), esc_html__('Test Setup', 'better-analytics'), 'manage_options', 'tools.php' . '?page=better-analytics_test' );
104
 
@@ -436,6 +436,35 @@ class DigitalPointBetterAnalytics_Base_Admin
436
  return $links;
437
  }
438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  public function show_network_settings()
440
  {
441
  $this->view('config_network');
75
 
76
  public function admin_init()
77
  {
78
+ register_setting('better-analytics-group', 'better_analytics', array($this, 'sanitize_settings'));
79
 
80
  // allows us to use a redirect on the better_analytics-auth page
81
  ob_start();
98
  }
99
 
100
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('Goals', 'better-analytics'), esc_html__('Goals', 'better-analytics'), 'manage_options', 'better-analytics_goals', array($this, 'display_page') );
101
+ //add_submenu_page( 'better-analytics_heatmaps', esc_html__('A/B Testing', 'better-analytics'), esc_html__('A/B Testing', 'better-analytics'), 'manage_options', 'better-analytics_experiments', array($this, 'display_page') );
102
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('Settings', 'better-analytics'), esc_html__('Settings', 'better-analytics'), 'manage_options', 'options-general.php' . '?page=better-analytics' );
103
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('Test Setup', 'better-analytics'), esc_html__('Test Setup', 'better-analytics'), 'manage_options', 'tools.php' . '?page=better-analytics_test' );
104
 
436
  return $links;
437
  }
438
 
439
+ public function sanitize_settings($input)
440
+ {
441
+ if (is_array($input))
442
+ {
443
+ foreach($input as $name => &$item)
444
+ {
445
+ if (is_array($item))
446
+ {
447
+ foreach($item as &$subItem)
448
+ {
449
+ if (!is_array($subItem))
450
+ {
451
+ $subItem = strip_tags($subItem);
452
+ }
453
+ }
454
+ }
455
+ else
456
+ {
457
+ if ($name != 'extra_js' || !current_user_can('unfiltered_html'))
458
+ {
459
+ $item = strip_tags($item);
460
+ }
461
+ }
462
+ }
463
+ }
464
+
465
+ return $input;
466
+ }
467
+
468
  public function show_network_settings()
469
  {
470
  $this->view('config_network');
library/DigitalPointBetterAnalytics/Base/Public.php CHANGED
@@ -99,9 +99,41 @@ class DigitalPointBetterAnalytics_Base_Public
99
 
100
  add_action('better_analytics_cron_minutely', array('DigitalPointBetterAnalytics_CronEntry_Jobs', 'minute' ));
101
  add_action('better_analytics_cron_hourly', array('DigitalPointBetterAnalytics_CronEntry_Jobs', 'hour' ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  }
103
 
 
 
 
 
 
 
104
 
 
105
  public function canViewReports()
106
  {
107
  $currentUser = wp_get_current_user();
99
 
100
  add_action('better_analytics_cron_minutely', array('DigitalPointBetterAnalytics_CronEntry_Jobs', 'minute' ));
101
  add_action('better_analytics_cron_hourly', array('DigitalPointBetterAnalytics_CronEntry_Jobs', 'hour' ));
102
+
103
+
104
+ /*
105
+ if ($_SERVER['REMOTE_ADDR'] == 'xxxxx')
106
+ {
107
+
108
+ add_filter('pre_option_template', array($this, 'override_template'));
109
+
110
+ //add_filter('template', array($this, 'override_template'));
111
+
112
+ //add_filter('template_directory', array($this, 'override_template'), 10, 3);
113
+
114
+
115
+ //add_filter ('theme_root', array($this, 'override_theme'));
116
+
117
+ }
118
+ */
119
+
120
+ }
121
+
122
+ /*
123
+ public function override_theme($theme)
124
+ {
125
+ echo $theme;
126
+ return $theme;
127
  }
128
 
129
+ public function override_template()
130
+ {
131
+ echo 'XXX! ';
132
+
133
+ return 'twentyfifteen';
134
+ }
135
 
136
+ */
137
  public function canViewReports()
138
  {
139
  $currentUser = wp_get_current_user();
library/DigitalPointBetterAnalytics/ControllerAdmin/Analytics.php CHANGED
@@ -548,7 +548,7 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
548
 
549
  if ($profile = $reportingClass->getProfileByProfileId($betterAnalyticsOptions['api']['profile']))
550
  {
551
- $experiments = $reportingClass->getExperiments($profile['accountId'], $profile['webPropertyId'], $profile['id']);
552
  }
553
 
554
  $this->_view('experiments', array('experiments' => $experiments));
548
 
549
  if ($profile = $reportingClass->getProfileByProfileId($betterAnalyticsOptions['api']['profile']))
550
  {
551
+ $experiments = DigitalPointBetterAnalytics_Model_Experiments::getAllExperiments($profile['accountId'], $profile['webPropertyId'], $profile['id']);
552
  }
553
 
554
  $this->_view('experiments', array('experiments' => $experiments));
library/DigitalPointBetterAnalytics/Formatting/GoalTable.php CHANGED
@@ -198,7 +198,7 @@ class DigitalPointBetterAnalytics_Formatting_GoalTable extends WP_List_Table
198
  $this->single_row_columns($item);
199
  echo '</tr>';
200
 
201
- echo '<tr class="extra_info' . ($item['active'] ? ' active' : '') . '"><td colspan="5">' . '<div>' . DigitalPointBetterAnalytics_Model_Goals::getTypeNameByCode($item['type']) . ': ' . '<strong style="padding-left: 5px;">';
202
 
203
  switch ($item['type'])
204
  {
@@ -241,35 +241,18 @@ class DigitalPointBetterAnalytics_Formatting_GoalTable extends WP_List_Table
241
 
242
  }
243
 
244
- protected function single_row_columns($item)
245
- {
246
- list( $columns, $hidden ) = $this->get_column_info();
247
-
248
- foreach ( $columns as $column_name => $column_display_name ) {
249
- $class = "class='$column_name column-$column_name'";
250
-
251
- $style = '';
252
- if ( in_array( $column_name, $hidden ) )
253
- $style = ' style="display:none;"';
254
 
255
- $attributes = "$class$style";
 
256
 
257
- if ( 'cb' == $column_name ) {
258
- echo '<th scope="row" class="check-column" rowspan="2">';
259
- echo $this->column_cb( $item );
260
- echo '</th>';
261
- }
262
- elseif ( method_exists( $this, 'column_' . $column_name ) ) {
263
- echo "<td $attributes>";
264
- echo call_user_func( array( $this, 'column_' . $column_name ), $item );
265
- echo "</td>";
266
- }
267
- else {
268
- echo "<td $attributes>";
269
- echo $this->column_default( $item, $column_name );
270
- echo "</td>";
271
- }
272
- }
273
  }
274
 
275
  protected function column_cb($item)
198
  $this->single_row_columns($item);
199
  echo '</tr>';
200
 
201
+ echo '<tr class="extra_info' . ($item['active'] ? ' active' : '') . '"><td></td><td colspan="' . (count($this->get_columns()) - 1) . '">' . '<div>' . DigitalPointBetterAnalytics_Model_Goals::getTypeNameByCode($item['type']) . ': ' . '<strong style="padding-left: 5px;">';
202
 
203
  switch ($item['type'])
204
  {
241
 
242
  }
243
 
244
+ protected function handle_row_actions( $link, $column_name, $primary ) {
245
+ if ( $primary !== $column_name ) {
246
+ return '';
247
+ }
248
+ $actions = array();
 
 
 
 
 
249
 
250
+ return $this->row_actions( $actions );
251
+ }
252
 
253
+ protected function row_actions($actions)
254
+ {
255
+ return '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  }
257
 
258
  protected function column_cb($item)
library/DigitalPointBetterAnalytics/Helper/Reporting/Abstract.php CHANGED
@@ -552,7 +552,7 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
552
  }
553
 
554
 
555
- public function getExperiments($accountId = '~all', $webPropertyId = '~all', $profileId = '~all', $experimentId = null)
556
  {
557
  return $this->_makeApiCall(
558
  sprintf(self::$_accountsEndpoint . self::$_webPropertiesEndpoint . self::$_profilesEndpoint . self::$_experimentsEndpoint . ($experimentId ? '/%s' : ''), $accountId, $webPropertyId, $profileId, $experimentId),
@@ -576,7 +576,7 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
576
  public function deleteExperiment($accountId, $webPropertyId, $profileId, $experimentId)
577
  {
578
  return $this->_makeApiCall(
579
- sprintf(self::$_accountsEndpoint . self::$_webPropertiesEndpoint . self::$_profilesEndpoint . self::$_experimentsEndpoint . ($experimentId ? '/%s' : ''), $accountId, $webPropertyId, $profileId, $experimentId),
580
  null,
581
  'DELETE',
582
  0
@@ -595,7 +595,7 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
595
  );
596
  }
597
 
598
- public function deleteExperimentCache($accountId = '~all', $webPropertyId = '~all', $profileId = '~all', $experimentId = null)
599
  {
600
  $cacheKey = 'ba_exp_' . md5($accountId . '-' . $webPropertyId . '-' . $profileId . '-' . $experimentId);
601
  $this->_cacheDelete($cacheKey);
552
  }
553
 
554
 
555
+ public function getExperiments($accountId, $webPropertyId, $profileId, $experimentId = null)
556
  {
557
  return $this->_makeApiCall(
558
  sprintf(self::$_accountsEndpoint . self::$_webPropertiesEndpoint . self::$_profilesEndpoint . self::$_experimentsEndpoint . ($experimentId ? '/%s' : ''), $accountId, $webPropertyId, $profileId, $experimentId),
576
  public function deleteExperiment($accountId, $webPropertyId, $profileId, $experimentId)
577
  {
578
  return $this->_makeApiCall(
579
+ sprintf(self::$_accountsEndpoint . self::$_webPropertiesEndpoindeleteExperimentCachet . self::$_profilesEndpoint . self::$_experimentsEndpoint . ($experimentId ? '/%s' : ''), $accountId, $webPropertyId, $profileId, $experimentId),
580
  null,
581
  'DELETE',
582
  0
595
  );
596
  }
597
 
598
+ public function deleteExperimentCache($accountId, $webPropertyId, $profileId, $experimentId = null)
599
  {
600
  $cacheKey = 'ba_exp_' . md5($accountId . '-' . $webPropertyId . '-' . $profileId . '-' . $experimentId);
601
  $this->_cacheDelete($cacheKey);
library/DigitalPointBetterAnalytics/Model/Experiments.php CHANGED
@@ -4,14 +4,56 @@ class DigitalPointBetterAnalytics_Model_Experiments
4
  {
5
  public static function getStatuses()
6
  {
7
- $types = array(
8
  'DRAFT' => esc_html__('Draft', 'better-analytics'),
9
  'READY_TO_RUN' => esc_html__('Ready to run', 'better-analytics'),
10
  'RUNNING' => esc_html__('Running', 'better-analytics'),
11
  'ENDED' => esc_html__('Ended', 'better-analytics'),
12
  );
13
 
14
- return $types;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
 
17
  public static function getStatusNameByCode($statusCode)
@@ -20,4 +62,87 @@ class DigitalPointBetterAnalytics_Model_Experiments
20
  return @$_types[$statusCode];
21
  }
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
4
  {
5
  public static function getStatuses()
6
  {
7
+ $output = array(
8
  'DRAFT' => esc_html__('Draft', 'better-analytics'),
9
  'READY_TO_RUN' => esc_html__('Ready to run', 'better-analytics'),
10
  'RUNNING' => esc_html__('Running', 'better-analytics'),
11
  'ENDED' => esc_html__('Ended', 'better-analytics'),
12
  );
13
 
14
+ return $output;
15
+ }
16
+
17
+ public static function getObjectiveMetrics()
18
+ {
19
+ $output = array(
20
+ esc_html__('Site Usage', 'better-analytics') => array(
21
+ 'ga:pageviews' => esc_html__('Page Views', 'better-analytics'),
22
+ 'ga:bounces' => esc_html__('Bounces', 'better-analytics'),
23
+ 'ga:sessionDuration' => esc_html__('Session Duration', 'better-analytics'),
24
+ ),
25
+ esc_html__('AdSense', 'better-analytics') => array(
26
+ 'ga:adsenseAdsClicks' => esc_html__('AdSense Ads Clicked', 'better-analytics'),
27
+ 'ga:adsenseAdsViewed' => esc_html__('AdSense Impressions', 'better-analytics'),
28
+ 'ga:adsenseRevenue' => esc_html__('AdSense Revenue', 'better-analytics'),
29
+ ),
30
+ esc_html__('Ecommerce', 'better-analytics') => array(
31
+ 'ga:transactionRevenue' => esc_html__('Ecommerce Revenue', 'better-analytics'),
32
+ 'ga:transactions' => esc_html__('Ecommerce Transactions', 'better-analytics'),
33
+ ),
34
+ esc_html__('Goals', 'better-analytics') => array(
35
+ )
36
+ );
37
+
38
+ if ($goals = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getGoals())
39
+ {
40
+ $betterAnalyticsOptions = get_option('better_analytics');
41
+ $totals = array();
42
+
43
+ if ($goals = DigitalPointBetterAnalytics_Model_Reporting::filterGoalsByProfile($goals, @$betterAnalyticsOptions['property_id'], @$betterAnalyticsOptions['api']['profile'], $totals))
44
+ {
45
+ $goalsKey = esc_html__('Goals', 'better-analytics');
46
+ foreach ($goals as $goal)
47
+ {
48
+ if (!empty($goal['active']))
49
+ {
50
+ $output[$goalsKey]['ga:goal' . $goal['id'] . 'Completions'] = sprintf(esc_html__('Goal %1$u Completions (%2$s)', 'better-analytics'), $goal['id'], $goal['name']);
51
+ }
52
+ }
53
+ }
54
+ }
55
+
56
+ return $output;
57
  }
58
 
59
  public static function getStatusNameByCode($statusCode)
62
  return @$_types[$statusCode];
63
  }
64
 
65
+ public static function getExperimentByExperimentId($accountId, $webPropertyId, $profileId, $experimentId)
66
+ {
67
+ $experiment = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getExperiments($accountId, $webPropertyId, $profileId, $experimentId);
68
+ self::decodeExperimentData($experiment);
69
+ return $experiment;
70
+ }
71
+
72
+ public static function decodeExperimentData(&$experiment)
73
+ {
74
+ $experiment['extraData'] = @json_decode(@$experiment['description'], true);
75
+ $experiment['fromBetterAnalytics'] = is_array($experiment['extraData']) && !empty($experiment['extraData']['type']);
76
+ }
77
+
78
+ public static function getAllExperiments($accountId, $webPropertyId, $profileId)
79
+ {
80
+ $experiments = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getExperiments($accountId, $webPropertyId, $profileId);
81
+
82
+ self::compileActiveExperiments($experiments);
83
+
84
+ return $experiments;
85
+
86
+ }
87
+
88
+ public static function compileActiveExperiments($experiments)
89
+ {
90
+
91
+ $experimentsCompiled = array();
92
+
93
+ if (!empty($experiments['totalResults']) && is_array($experiments['items']))
94
+ {
95
+ foreach ($experiments['items'] as &$experiment)
96
+ {
97
+ self::decodeExperimentData($experiment);
98
+
99
+ if (!empty($experiment['fromBetterAnalytics']) && $experiment['status'] == 'DRAFT')
100
+ {
101
+ switch ($experiment['extraData']['type'])
102
+ {
103
+ case 'POST_TITLE':
104
+ $postId = $experiment['extraData']['post_title']['post_id'];
105
+
106
+ $experimentsCompiled['post_title'][$postId] = array('id' => $experiment['id']);
107
+
108
+ if ($experiment['variations'][0]['status'] == 'ACTIVE' || true)
109
+ {
110
+ $experimentsCompiled['post_title'][$postId]['variations'][0] = array(
111
+ 'weight' => $experiment['variations'][0]['weight']
112
+ );
113
+ }
114
+
115
+ foreach ($experiment['variations'] as $key => $variation)
116
+ {
117
+ if ($key > 0 && ($variation['status'] == 'ACTIVE' || true))
118
+ {
119
+ $experimentsCompiled['post_title'][$postId]['variations'][$key] = array(
120
+ 'weight' => $variation['weight'],
121
+ 'title' => $experiment['extraData']['post_title']['titles'][$key - 1]
122
+ );
123
+ }
124
+ }
125
+ break;
126
+
127
+ case 'PAGE_TITLE':
128
+ echo "i equals 1";
129
+ break;
130
+ case 'CSS':
131
+ echo "i equals 2";
132
+ break;
133
+ case 'THEME':
134
+ echo "i equals 2";
135
+ break;
136
+
137
+ }
138
+ }
139
+ }
140
+ }
141
+
142
+ print_r ($experimentsCompiled);
143
+
144
+ print_r ($experiments);
145
+
146
+ }
147
+
148
  }
library/DigitalPointBetterAnalytics/Model/Reporting.php CHANGED
@@ -283,6 +283,25 @@ class DigitalPointBetterAnalytics_Model_Reporting
283
  return $output;
284
  }
285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  public static function filterGoalsByProfile($goals, $webPropertyId, $profileId, &$totals)
287
  {
288
  $output = array();
@@ -311,7 +330,7 @@ class DigitalPointBetterAnalytics_Model_Reporting
311
  public static function getGoalByGoalId($goals, $webPropertyId, $profileId, $goalId)
312
  {
313
  $goal = null;
314
- if (@$goals['items'])
315
  {
316
  foreach($goals['items'] as $goal)
317
  {
283
  return $output;
284
  }
285
 
286
+ public static function getSiteAccountId()
287
+ {
288
+ $betterAnalyticsOptions = get_option('better_analytics');
289
+ $profiles = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getProfiles();
290
+
291
+ $accountId = null;
292
+ if (!empty($profiles['items']))
293
+ {
294
+ foreach($profiles['items'] as $profile)
295
+ {
296
+ if ($profile['webPropertyId'] == $betterAnalyticsOptions['property_id'])
297
+ {
298
+ $accountId = $profile['accountId'];
299
+ }
300
+ }
301
+ }
302
+ return $accountId;
303
+ }
304
+
305
  public static function filterGoalsByProfile($goals, $webPropertyId, $profileId, &$totals)
306
  {
307
  $output = array();
330
  public static function getGoalByGoalId($goals, $webPropertyId, $profileId, $goalId)
331
  {
332
  $goal = null;
333
+ if (!empty($goals['items']))
334
  {
335
  foreach($goals['items'] as $goal)
336
  {
library/DigitalPointBetterAnalytics/ViewAdmin/config.php CHANGED
@@ -1051,7 +1051,7 @@
1051
  <div style="display:table">
1052
  <div style="display:table-row">
1053
  <div style="display:table-cell">
1054
- <input type="number" name="better_analytics[sample_rate]" id="ba_sample_rate" min="1" max="100" step="1" value="<?php echo esc_attr( intval(@$betterAnalyticsOptions['sample_rate']) ); ?>" /> %
1055
  </div>
1056
  </div>
1057
 
1051
  <div style="display:table">
1052
  <div style="display:table-row">
1053
  <div style="display:table-cell">
1054
+ <input type="number" name="better_analytics[sample_rate]" id="ba_sample_rate" min="1" max="100" step="1" value="<?php echo esc_attr( intval(@$betterAnalyticsOptions['sample_rate']) >= 1 && intval(@$betterAnalyticsOptions['sample_rate']) <= 100 ? intval(@$betterAnalyticsOptions['sample_rate']) : 100 ); ?>" /> %
1055
  </div>
1056
  </div>
1057
 
library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php CHANGED
@@ -89,4 +89,5 @@ else
89
  <div id="ba_rt_keywords"></div><div id="ba_rt_referral_path"></div>
90
  <div id="ba_rt_page_path"></div>
91
  </div>';
 
92
  }
89
  <div id="ba_rt_keywords"></div><div id="ba_rt_referral_path"></div>
90
  <div id="ba_rt_page_path"></div>
91
  </div>';
92
+
93
  }
library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php CHANGED
@@ -1,8 +1,13 @@
1
  <?php
 
 
2
 
3
  wp_enqueue_script('better_analytics_admin_js', BETTER_ANALYTICS_PLUGIN_URL . 'assets/digitalpoint/js/admin.js', array(), BETTER_ANALYTICS_VERSION );
4
  wp_enqueue_style('better_analytics_admin_css', BETTER_ANALYTICS_PLUGIN_URL . 'assets/digitalpoint/css/admin.css', array(), BETTER_ANALYTICS_VERSION);
5
 
 
 
 
6
  $betterAnalyticsOptions = get_option('better_analytics');
7
 
8
  $nOnceSalt = @$betterAnalyticsOptions['property_id'] . '-' . @$betterAnalyticsOptions['api']['profile'];
@@ -13,452 +18,655 @@ if (@$_REQUEST['action'] == 'create_edit')
13
  {
14
  $experimentId = sanitize_text_field(@$_REQUEST['id']);
15
 
 
16
 
17
- // not refactoered after here
 
 
18
 
 
 
 
 
 
 
 
 
19
 
20
- $goalsAll = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getGoals();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- if ($goalId)
23
  {
24
- $goal = DigitalPointBetterAnalytics_Model_Reporting::getGoalByGoalId($goalsAll, @$betterAnalyticsOptions['property_id'], @$betterAnalyticsOptions['api']['profile'], $goalId);
25
  }
 
 
 
 
26
 
27
  if ($_SERVER['REQUEST_METHOD'] != 'POST')
28
  {
29
- echo '<div class="wrap goal_create">
30
- <h2>' . ($goalId ? esc_html__('Edit Goal', 'better-analytics') : esc_html__('Create Goal', 'better-analytics')) . '</h2>
31
 
32
- <form method="post" action="' . esc_url(menu_page_url('better-analytics_goals', false)) . '">
33
- <input type="hidden" name="page" value="better-analytics_goals"/>
 
 
 
 
 
 
 
 
 
 
 
 
34
  <input type="hidden" name="action" value="create_edit"/>';
35
- wp_nonce_field('create_edit-goal' . $nOnceSalt);
 
 
 
 
 
36
 
37
  ?>
38
 
39
  <table class="form-table">
40
 
 
41
  <tr valign="top">
42
- <th scope="row"><?php esc_html_e('Slot', 'better-analytics');?></th>
43
  <td>
44
- <?php
45
 
46
- if ($goalId)
47
- {
48
- echo '<input type="hidden" name="id" value="' . $goalId . '"/>';
49
- $goalSet = DigitalPointBetterAnalytics_Model_Goals::getGoalSetByGoal($goalId);
50
- printf(esc_html__('Goal ID %1$u / Goal Set %2$u', 'better-analytics'), $goal['id'], $goalSet);
51
- }
52
- else
53
- {
54
- echo '<select name="slot" data-placeholder="' . esc_html__('Pick slot', 'better-analytics') . '" id="ba_slot" class="chosen-select">';
55
-
56
- $goalsAll = DigitalPointBetterAnalytics_Model_Reporting::filterGoalsByProfile($goalsAll, @$betterAnalyticsOptions['property_id'], @$betterAnalyticsOptions['api']['profile'], $totals);
57
-
58
- foreach (range(1, 20) as $number)
59
- {
60
- $goalSet = DigitalPointBetterAnalytics_Model_Goals::getGoalSetByGoal($number);
61
- echo '<option value="' . $number . '"' . (!empty($goalsAll[$number]) ? ' disabled="disabled"' : '') . '>' . htmlentities(sprintf(esc_html__('Goal ID %1$u / Goal Set %2$u', 'better-analytics'), $number, $goalSet)) . '</option>';
62
- }
63
- echo '</select>';
64
- }
65
  ?>
 
66
  </td>
67
  </tr>
68
 
 
 
69
  <tr valign="top">
70
  <th scope="row"><?php esc_html_e('Name', 'better-analytics');?></th>
71
  <td>
72
- <input type="text" name="name" class="regular-text" id="ba_name" value="<?php echo esc_attr( @$goal['name'] ); ?>" required />
73
  </td>
74
  </tr>
75
 
76
  <tr valign="top">
77
- <th scope="row"><?php esc_html_e('Type', 'better-analytics');?></th>
78
  <td>
 
 
 
 
79
 
 
 
 
80
  <?php
81
- echo '<select name="type" data-placeholder="' . esc_html__('Pick type', 'better-analytics') . '" id="ba_type" class="chosen-select">';
 
 
 
82
 
83
- $types = DigitalPointBetterAnalytics_Model_Goals::getTypes();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
- foreach ($types as $key => $type)
86
- {
87
- echo '<option value="' . $key . '"' . ($key == @$goal['type'] ? ' selected="selected"' : '') . '>' . htmlentities($type) . '</option>';
88
- }
89
- echo '</select>';
90
  ?>
 
 
 
91
 
 
 
 
 
92
  </td>
93
  </tr>
94
 
95
  <tr valign="top">
96
- <th scope="row"></th>
97
  <td>
98
- <fieldset>
99
- <label for="ba_active">
100
- <input name="active" type="checkbox" id="ba_active" value="1" <?php checked('1', (@$goal ? @$goal['active'] : '1')); ?>>
101
- <?php esc_html_e('Active', 'better-analytics');?></label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  </fieldset>
 
103
  </td>
104
  </tr>
105
 
 
106
  <tr valign="top">
107
- <th scope="row"><?php esc_html_e('Value', 'better-analytics');?><span class="optional"><?php esc_html_e('Optional', 'better-analytics');?></span></th>
 
 
108
  <td>
109
- <input type="number" name="value" id="ba_value" min="0" step="0.01" value="<?php echo number_format(@$goal['value'], 2); ?>" />
110
  </td>
111
  </tr>
112
 
113
- <tr valign="top" class="dynamic_options URL_DESTINATION">
114
- <th scope="row"><?php esc_html_e('Destination', 'better-analytics');?></th>
 
 
 
 
 
 
 
115
  <td>
116
 
117
  <?php
118
- echo '<select name="destination_match_type" data-placeholder="' . esc_html__('Pick type', 'better-analytics') . '" id="ba_destination_match_type" class="chosen-select">';
119
 
120
- $types = DigitalPointBetterAnalytics_Model_Goals::getMatchTypes();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
  foreach ($types as $key => $type)
123
  {
124
- echo '<option value="' . $key . '"' . ($key == @$goal['urlDestinationDetails']['matchType'] ? ' selected="selected"' : '') . '>' . htmlentities($type) . '</option>';
125
  }
126
  echo '</select>';
127
  ?>
128
 
129
- <input type="text" name="destination_url" class="regular-text" id="ba_destination_url" placeholder="<?php echo esc_attr(esc_html__('URL', 'better-analytics'));?>" value="<?php echo esc_attr( @$goal['urlDestinationDetails']['url'] ); ?>" />
130
-
131
- <label for="ba_case_sensitive">
132
- <input name="case_sensitive" type="checkbox" id="ba_case_sensitive" value="1" <?php checked('1', (@$goal['urlDestinationDetails']['caseSensitive'] ? '1' : '')); ?>>
133
- <?php esc_html_e('Case sensitive', 'better-analytics');?></label>
134
  </td>
135
  </tr>
136
 
137
- <tr valign="top" class="dynamic_options URL_DESTINATION funnel">
138
- <th scope="row"><?php esc_html_e('Funnel', 'better-analytics'); ?><span
139
- class="optional"><?php esc_html_e('Optional', 'better-analytics'); ?></span></th>
140
  <td>
141
- <div>
142
- <ol>
143
- <?php
144
 
145
- // show first line when creating new
146
- if (empty($goal['urlDestinationDetails']['steps']))
147
- {
148
- $goal['urlDestinationDetails']['steps'] = array(true);
149
- }
 
 
 
 
 
 
 
 
 
 
150
 
151
- if (!empty($goal['urlDestinationDetails']['steps']) && is_array($goal['urlDestinationDetails']['steps']))
 
 
 
 
 
152
  {
153
- $i = 0;
154
- foreach ($goal['urlDestinationDetails']['steps'] as $step)
155
  {
156
- echo '<li class="funnel_step">
157
- <span><input type="text" placeholder="' . esc_attr(esc_html__('Name', 'better-analytics')) .'" name="funnel[name][]" value="' . esc_attr(@$step['name']) .'" /></span>
158
- <span><input type="text" placeholder="' . esc_attr(esc_html__('URL', 'better-analytics')) .'" class="regular-text" name="funnel[url][]" value="' . esc_attr(@$step['url']) .'" /></span>';
159
 
160
  echo '<a class="delete"><span class="dashicons dashicons-dismiss"></span></a>';
161
 
162
- if (!$i)
163
- {
164
- echo '<span><label for="ba_first_step_required">
165
- <input name="first_step_required" type="checkbox" id="ba_first_step_required" value="1"' . checked('1', (@$goal['urlDestinationDetails']['firstStepRequired'] ? '1' : ''), false) .'>' .
166
- esc_html__('Required', 'better-analytics') . '</label>';
167
- }
168
-
169
  echo '</li>';
170
- $i++;
171
  }
172
  }
173
- ?>
174
- </ol>
175
- </div>
176
- <a id="new_step" class="button"><?php esc_html_e('Add another step', 'better-analytics') ?></a>
 
 
 
 
 
 
 
 
177
  </td>
178
  </tr>
179
 
180
- <tr valign="top" class="dynamic_options VISIT_TIME_ON_SITE">
181
- <th scope="row"><?php esc_html_e('Session Duration', 'better-analytics');?></th>
 
 
182
  <td>
 
183
  <?php
184
- $durations = explode(":", gmdate('j:H:i:s', @$goal['visitTimeOnSiteDetails']['comparisonValue']));
 
 
 
 
 
 
 
 
 
 
185
  ?>
186
- <div>
187
- <div>
188
- <span></span>
189
- <span><?php esc_html_e('Hours', 'better-analytics') ?></span>
190
- <span><?php esc_html_e('Minutes', 'better-analytics') ?></span>
191
- <span><?php esc_html_e('Seconds', 'better-analytics') ?></span>
192
- </div>
193
- <div>
194
- <span style="padding-right:5px;"><?php esc_html_e('Greater than', 'better-analytics') ?></span>
195
- <span>
196
- <input type="number" name="hours" min="0" id="ba_hours" value="<?php echo esc_attr((absint($durations[0] - 1) * 24) + absint($durations[1])); ?>" />
197
- </span>
198
- <span>
199
- <input type="number" name="minutes" min="0" id="ba_minutes" value="<?php echo esc_attr(absint($durations[2])); ?>" />
200
- </span>
201
- <span>
202
- <input type="number" name="seconds" min="0" id="ba_seconds" value="<?php echo esc_attr(absint($durations[3])); ?>" />
203
- </span>
204
- </div>
205
- </div>
206
  </td>
207
  </tr>
208
 
209
- <tr valign="top" class="dynamic_options VISIT_NUM_PAGES">
210
- <th scope="row"><?php esc_html_e('Pages Per Session', 'better-analytics');?></th>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  <td>
212
- <div>
213
- <div>
214
- <span style="padding-right:5px;"><?php esc_html_e('Greater than', 'better-analytics') ?></span>
215
- <span>
216
- <input type="number" name="pages" min="0" id="ba_pages" value="<?php echo esc_attr(absint(@$goal['visitNumPagesDetails']['comparisonValue'])); ?>" />
217
- </span>
218
- </div>
219
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  </td>
221
  </tr>
222
 
223
- <tr valign="top" class="dynamic_options EVENT">
224
- <th scope="row"><?php esc_html_e('Conditions', 'better-analytics');?></th>
 
225
  <td>
226
- <div>
 
227
  <?php
 
228
 
229
- $matchTypes = DigitalPointBetterAnalytics_Model_Goals::getMatchTypes(true);
230
- $comparisonTypes = DigitalPointBetterAnalytics_Model_Goals::getComparisonTypes();
231
- $eventConditionTypes = DigitalPointBetterAnalytics_Model_Goals::getEventConditionTypes();
232
 
233
- foreach ($eventConditionTypes as $conditionCode => $conditionLabel)
 
 
 
234
  {
235
- if ($conditionCode == 'VALUE')
236
- {
237
- $condition = array(
238
- 'type' => $conditionCode,
239
- 'comparisonType' => true
240
- );
241
- }
242
- else
243
  {
244
- $condition = array(
245
- 'type' => $conditionCode,
246
- 'matchType' => true
247
- );
248
- }
249
 
250
- if (!empty($goal['eventDetails']['eventConditions']) && count($goal['eventDetails']['eventConditions']) > 0)
251
- {
252
- foreach ($goal['eventDetails']['eventConditions'] as $existingCondition)
 
 
253
  {
254
- if (@$existingCondition['type'] == $conditionCode)
255
- {
256
- $condition = $existingCondition;
257
- break;
258
- }
259
  }
 
 
 
 
 
260
  }
 
 
 
 
261
 
262
- echo '<div><span>' . @$eventConditionTypes[$condition['type']] . ':</span><span>';
263
 
264
- echo '<select name="event_' . strtolower($condition['type']) . '" id="ba_event_' . strtolower($condition['type']) . '" class="chosen-select">';
265
 
266
- foreach (!empty($condition['matchType']) ? $matchTypes : $comparisonTypes as $key => $type)
267
  {
268
- $selected = '';
269
- if (!empty($condition['matchType']))
270
- {
271
- if ($key === $condition['matchType'])
272
- {
273
- $selected = ' selected="selected"';
274
- }
275
- }
276
- elseif (!empty($condition['comparisonType']))
277
- {
278
- if ($key === $condition['comparisonType'])
279
- {
280
- $selected = ' selected="selected"';
281
- }
282
- }
283
-
284
- echo '<option value="' . $key . '"' . $selected . '>' . htmlentities($type) . '</option>';
285
  }
286
- echo '</select></span><span>';
287
 
288
- echo ' <input type="text" name="event_' . strtolower($condition['type']) . '_value" id="ba_event_' . strtolower($condition['type']) . '_value" value="' . esc_attr(@$condition['expression'] ? @$condition['expression'] : @$condition['comparisonValue']) . '" /></span></div>';
289
 
 
290
  }
291
 
292
- ?>
293
 
294
- </div>
295
- <fieldset>
296
- <label for="ba_use_event_value">
297
- <input name="use_event_value" type="checkbox" id="ba_use_event_value" value="1" <?php checked('1', (@$goal['eventDetails']['useEventValue'] ? '1' : '')); ?>>
298
- <?php esc_html_e('Use the Event value as the Goal Value for the conversion', 'better-analytics');?></label>
299
- </fieldset>
300
 
301
  </td>
302
  </tr>
 
 
 
 
 
303
  </table>
304
 
305
 
306
  <?php
307
- submit_button();
 
 
 
308
  echo '</form>
309
  </div>';
310
  }
311
  else
312
  {
313
- check_admin_referer('create_edit-goal' . $nOnceSalt);
314
 
315
  $errorMessage = array();
316
 
317
- $goalObject = array(
318
- 'name' => sanitize_text_field(@$_POST['name']),
319
- 'value' => (@$_POST['value'] + 0),
320
- 'type' => sanitize_text_field(@$_POST['type']),
321
- 'active' => (@$_POST['active'] ? true : false),
322
- 'urlDestinationDetails' => array(),
323
- 'visitTimeOnSiteDetails' => array(),
324
- 'visitNumPagesDetails' => array(),
325
- 'eventDetails' => array(),
326
  );
327
 
328
- if (!$goalObject['name'])
329
  {
330
- $errorMessage[] = esc_html__('Goal name is required.', 'better-analytics');
 
 
 
 
331
  }
332
 
333
- // calling out slot on insert
334
- if ($slot = absint(@$_POST['slot']))
335
  {
336
- $goalObject['id'] = $slot;
 
337
  }
338
 
339
- if (@$_POST['type'] == 'URL_DESTINATION')
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  {
341
- $goalObject['urlDestinationDetails'] = array(
342
- 'url' => esc_url(@$_POST['destination_url']),
343
- 'caseSensitive' => (@$_POST['case_sensitive'] ? true : false),
344
- 'matchType' => @$_POST['destination_match_type'],
345
- 'firstStepRequired' => (@$_POST['first_step_required'] ? true : false),
346
- );
347
- if (!empty($_POST['funnel']) && is_array($_POST['funnel']))
348
  {
349
- $goalObject['urlDestinationDetails']['steps'] = array();
 
 
350
 
351
- if (!empty($_POST['funnel']['url'][0]))
352
- {
353
- foreach ($_POST['funnel']['name'] as $step => $name)
354
  {
355
- $goalObject['urlDestinationDetails']['steps'][] = array(
356
- 'number' => ($step + 1),
357
- 'name' => sanitize_text_field($name),
358
- 'url' => esc_url($_POST['funnel']['url'][$step])
359
- );
 
 
 
 
 
 
 
360
  }
361
- }
362
- }
363
 
364
- if (!$goalObject['urlDestinationDetails']['url'])
365
- {
366
- $errorMessage[] = esc_html__('Destination URL is required.', 'better-analytics');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  }
368
 
369
  }
370
- elseif (@$_POST['type'] == 'VISIT_TIME_ON_SITE')
 
371
  {
372
- $goalObject['visitTimeOnSiteDetails'] = array(
373
- 'comparisonType' => 'GREATER_THAN',
374
- 'comparisonValue' => (absint(@$_POST['hours']) * 3600) + (absint(@$_POST['minutes']) * 60) + absint(@$_POST['seconds']),
375
- );
376
  }
377
- elseif (@$_POST['type'] == 'VISIT_NUM_PAGES')
 
 
 
378
  {
379
- $goalObject['visitNumPagesDetails'] = array(
380
- 'comparisonType' => 'GREATER_THAN',
381
- 'comparisonValue' => absint(@$_POST['pages']),
382
- );
383
  }
384
- elseif (@$_POST['type'] == 'EVENT')
385
- {
386
- $goalObject['eventDetails'] = array(
387
- 'useEventValue' => (@$_POST['use_event_value'] ? true : false),
388
- 'eventConditions' => array()
389
- );
390
 
391
- if (!empty($_POST['event_category_value']))
392
- {
393
- $goalObject['eventDetails']['eventConditions'][] = array(
394
- 'type' => 'CATEGORY',
395
- 'matchType' => $_POST['event_category'],
396
- 'expression' => $_POST['event_category_value']
397
- );
398
- }
399
 
400
- if (!empty($_POST['event_action_value']))
401
- {
402
- $goalObject['eventDetails']['eventConditions'][] = array(
403
- 'type' => 'ACTION',
404
- 'matchType' => $_POST['event_action'],
405
- 'expression' => $_POST['event_action_value']
406
- );
407
- }
408
 
409
- if (!empty($_POST['event_label_value']))
410
- {
411
- $goalObject['eventDetails']['eventConditions'][] = array(
412
- 'type' => 'LABEL',
413
- 'matchType' => $_POST['event_label'],
414
- 'expression' => $_POST['event_label_value']
415
- );
416
- }
417
 
418
- if (!empty($_POST['event_value_value']))
419
- {
420
- $goalObject['eventDetails']['eventConditions'][] = array(
421
- 'type' => 'VALUE',
422
- 'comparisonType' => $_POST['event_value'],
423
- 'comparisonValue' => $_POST['event_value_value']
424
- );
425
- }
426
 
427
- if (count($goalObject['eventDetails']['eventConditions']) == 0)
428
- {
429
- $errorMessage[] = esc_html__('You must specify a Category, Action or Label.', 'better-analytics');
430
- }
431
 
432
 
433
- }
434
 
435
  $reportingClass = DigitalPointBetterAnalytics_Helper_Reporting::getInstance();
436
 
437
  if (!$errorMessage && $profile = $reportingClass->getProfileByProfileId(@$betterAnalyticsOptions['api']['profile']))
438
  {
439
- if ($goalId)
440
  {
441
- $goal = $reportingClass->patchGoal($profile['accountId'], $profile['webPropertyId'], $profile['id'], $goalId, $goalObject);
 
 
442
  }
443
  else
444
  {
445
- $goal = $reportingClass->insertGoal($profile['accountId'], $profile['webPropertyId'], $profile['id'], $goalObject);
 
 
 
446
  }
447
 
448
- $reportingClass->deleteGoalCache();
 
 
 
 
449
 
450
- $goals = $reportingClass->getGoals();
451
- $goals = DigitalPointBetterAnalytics_Model_Reporting::filterGoalsByProfile($goals, @$betterAnalyticsOptions['property_id'], @$betterAnalyticsOptions['api']['profile'], $totals);
452
 
453
- if ($goalId)
454
  {
455
  /* translators: %1$s = <strong>, %2$s = </strong> */
456
- $noticeAtTop = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf(esc_html__('Goal %1$supdated%2$s.'), '<strong>', '</strong>') . '</p></div>';
457
  }
458
  else
459
  {
460
  /* translators: %1$s = <strong>, %2$s = </strong> */
461
- $noticeAtTop = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf(esc_html__('Goal %1$screated%2$s.'), '<strong>', '</strong>') . '</p></div>';
462
  }
463
  }
464
  }
1
  <?php
2
+ wp_enqueue_script('tooltipster_js', BETTER_ANALYTICS_PLUGIN_URL . 'assets/tooltipster/js/jquery.tooltipster.min.js', array(), BETTER_ANALYTICS_VERSION );
3
+ wp_enqueue_style('tooltipster_css', BETTER_ANALYTICS_PLUGIN_URL . 'assets/tooltipster/css/tooltipster.css', array(), BETTER_ANALYTICS_VERSION);
4
 
5
  wp_enqueue_script('better_analytics_admin_js', BETTER_ANALYTICS_PLUGIN_URL . 'assets/digitalpoint/js/admin.js', array(), BETTER_ANALYTICS_VERSION );
6
  wp_enqueue_style('better_analytics_admin_css', BETTER_ANALYTICS_PLUGIN_URL . 'assets/digitalpoint/css/admin.css', array(), BETTER_ANALYTICS_VERSION);
7
 
8
+ wp_enqueue_script('chosen_js', BETTER_ANALYTICS_PLUGIN_URL . 'assets/chosen/chosen.jquery.min.js', array(), BETTER_ANALYTICS_VERSION );
9
+ wp_enqueue_style('chosen_css', BETTER_ANALYTICS_PLUGIN_URL . 'assets/chosen/chosen.min.css', array(), BETTER_ANALYTICS_VERSION);
10
+
11
  $betterAnalyticsOptions = get_option('better_analytics');
12
 
13
  $nOnceSalt = @$betterAnalyticsOptions['property_id'] . '-' . @$betterAnalyticsOptions['api']['profile'];
18
  {
19
  $experimentId = sanitize_text_field(@$_REQUEST['id']);
20
 
21
+ $goalsAll = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getGoals();
22
 
23
+ $experiment = array();
24
+ $accountId = null;
25
+ $readOnly = '';
26
 
27
+ if ($experimentId && $accountId = DigitalPointBetterAnalytics_Model_Reporting::getSiteAccountId())
28
+ {
29
+ $experiment = DigitalPointBetterAnalytics_Model_Experiments::getExperimentByExperimentId($accountId, @$betterAnalyticsOptions['property_id'], @$betterAnalyticsOptions['api']['profile'], $experimentId);
30
+ if ($experiment && !$experiment['fromBetterAnalytics'])
31
+ {
32
+ $readOnly = ' readonly="readonly" disabled="disabled"';
33
+ }
34
+ }
35
 
36
+ if (empty($experiment['status']))
37
+ {
38
+ $experiment['status'] = 'DRAFT';
39
+ }
40
+ if (empty($experiment['optimizationType']))
41
+ {
42
+ $experiment['optimizationType'] = 'MAXIMUM';
43
+ }
44
+
45
+ if (empty($experiment['minimumExperimentLengthInDays']))
46
+ {
47
+ $experiment['minimumExperimentLengthInDays'] = 7;
48
+ }
49
+
50
+ if (empty($experiment['trafficCoverage']))
51
+ {
52
+ $experiment['trafficCoverage'] = 1;
53
+ }
54
+ $trafficCoverage = $experiment['trafficCoverage'] * 100;
55
 
56
+ if (empty($experiment['winnerConfidenceLevel']))
57
  {
58
+ $experiment['winnerConfidenceLevel'] = 0.95;
59
  }
60
+ $winnerConfidenceLevel = $experiment['winnerConfidenceLevel'] * 100;
61
+
62
+
63
+ print_r ($experiment);
64
 
65
  if ($_SERVER['REQUEST_METHOD'] != 'POST')
66
  {
 
 
67
 
68
+ echo '<div class="wrap experiment_create">
69
+ <h2>' . ($experimentId ? ($readOnly ? esc_html__('View Experiment', 'better-analytics') : esc_html__('Edit Experiment', 'better-analytics')) : esc_html__('Create Experiment', 'better-analytics')) . '</h2>';
70
+
71
+ if ($readOnly)
72
+ {
73
+ echo '<div class="wrap">
74
+ <div class="error"><p>' . esc_html__('This experiment was not created by Better Analytics. You can view it for informational purposes, but you cannot make changes to it.', 'better-analytics') . '</p></div>
75
+ </div>';
76
+
77
+ }
78
+
79
+
80
+ echo '<form method="post" action="' . esc_url(menu_page_url('better-analytics_experiments', false)) . '">
81
+ <input type="hidden" name="page" value="better-analytics_experiments"/>
82
  <input type="hidden" name="action" value="create_edit"/>';
83
+ if ($experimentId)
84
+ {
85
+ echo '<input type="hidden" name="id" value="' . esc_attr($experimentId) . '"/>';
86
+ }
87
+
88
+ wp_nonce_field('create_edit-experiment' . $nOnceSalt);
89
 
90
  ?>
91
 
92
  <table class="form-table">
93
 
94
+
95
  <tr valign="top">
96
+ <th scope="row"><?php esc_html_e('Status', 'better-analytics');?></th>
97
  <td>
 
98
 
99
+ <?php
100
+ $statues = DigitalPointBetterAnalytics_Model_Experiments::getStatuses();
101
+ echo $statues[$experiment['status']]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  ?>
103
+
104
  </td>
105
  </tr>
106
 
107
+
108
+
109
  <tr valign="top">
110
  <th scope="row"><?php esc_html_e('Name', 'better-analytics');?></th>
111
  <td>
112
+ <input type="text" name="name" class="regular-text" id="ba_name" value="<?php echo esc_attr(@$experiment['name']); ?>" required="required"<?php echo $readOnly; ?> />
113
  </td>
114
  </tr>
115
 
116
  <tr valign="top">
117
+ <th scope="row"><?php esc_html_e('Description', 'better-analytics');?><span class="optional"><?php esc_html_e('Optional', 'better-analytics');?></span></th>
118
  <td>
119
+ <textarea name="description" rows="4" cols="50" id="ba_description" class="large-text"<?php echo $readOnly; ?>><?php echo esc_textarea( @$experiment['extraData']['description'] ); ?></textarea>
120
+ </td>
121
+ </tr>
122
+
123
 
124
+ <tr valign="top">
125
+ <th scope="row"><?php esc_html_e('Objective Metric', 'better-analytics');?></th>
126
+ <td>
127
  <?php
128
+ echo '<select name="optimization_type" data-placeholder="' . esc_html__('Pick optimization type', 'better-analytics') . '" id="ba_optimization_type" style="width:20%"' . $readOnly . '>';
129
+ echo '<option value="MAXIMUM"' . ('MAXIMUM' == @$experiment['optimizationType'] ? ' selected="selected"' : '') . '>' . htmlentities(esc_html__('Most', 'better-analytics')) . '</option>';
130
+ echo '<option value="MINIMUM"' . ('MINIMUM' == @$experiment['optimizationType'] ? ' selected="selected"' : '') . '>' . htmlentities(esc_html__('Least', 'better-analytics')) . '</option>';
131
+ echo '</select>';
132
 
133
+ echo '<select name="objective_metric" data-placeholder="' . esc_html__('Pick objective metric', 'better-analytics') . '" id="ba_objective_metric" style="width:79%"' . $readOnly . '>';
134
+
135
+ $objectiveMetrics = DigitalPointBetterAnalytics_Model_Experiments::getObjectiveMetrics();
136
+
137
+ foreach ($objectiveMetrics as $category => $metrics)
138
+ {
139
+ echo '<optgroup label="' . htmlentities($category) . '">';
140
+
141
+ foreach ($metrics as $metric => $name)
142
+ {
143
+ echo '<option value="' . $metric . '"' . ($metric == @$experiment['objectiveMetric'] ? ' selected="selected"' : '') . '>' . htmlentities($name) . '</option>';
144
+ }
145
+ echo '</optgroup>';
146
+ }
147
+
148
+ echo '</select>';
149
 
 
 
 
 
 
150
  ?>
151
+ </td>
152
+ </tr>
153
+
154
 
155
+ <tr valign="top">
156
+ <th scope="row"><?php esc_html_e('Minimum Days To Run', 'better-analytics');?></th>
157
+ <td>
158
+ <input type="number" name="minimum_days_to_run" id="ba_minimum_days_to_run" min="3" max="90" step="1" value="<?php echo absint(@$experiment['minimumExperimentLengthInDays']); ?>"<?php echo $readOnly; ?> />
159
  </td>
160
  </tr>
161
 
162
  <tr valign="top">
163
+ <th scope="row"><?php esc_html_e('Traffic To Experiment On', 'better-analytics');?></th>
164
  <td>
165
+ <input type="number" name="traffic_coverage" id="ba_traffic_coverage" min="1" max="100" step="1" value="<?php echo $trafficCoverage; ?>"<?php echo $readOnly; ?> /> <?php esc_html_e('%', 'better-analytics');?>
166
+ </td>
167
+ </tr>
168
+
169
+ <tr valign="top">
170
+ <th scope="row"><?php esc_html_e('Traffic Distribution Type', 'better-analytics');?> <span class="dashicons-before dashicons-info tooltip" title="<?php
171
+ echo htmlspecialchars(sprintf(__('Use this option to assign how traffic is divided between the original and variations for life of the experiment. By default, Content Experiments follows the behavior of %1$sadjusting traffic dynamically based on variation performance%2$s.', 'better-analytics'),
172
+ '<a href="https://support.google.com/analytics/answer/2844870" target="_blank">',
173
+ '</a>'
174
+ )
175
+ );
176
+ ?>"></span></th>
177
+ <td>
178
+ <fieldset id="ba_equal_weighting">
179
+ <label>
180
+ <input name="equal_weighting" type="radio" value="0" <?php checked( 0, empty($experiment['equalWeighting']) ? 0 : 1 ); ?><?php echo $readOnly; ?>>
181
+ <?php esc_html_e('Automatically adjust traffic dynamically ', 'better-analytics');?></label>
182
+ <br />
183
+
184
+ <label>
185
+ <input name="equal_weighting" type="radio" value="1" <?php checked( 1, empty($experiment['equalWeighting']) ? 0 : 1 ); ?><?php echo $readOnly; ?>>
186
+ <?php esc_html_e('Distribute traffic evenly across all variations', 'better-analytics');?></label>
187
+
188
  </fieldset>
189
+
190
  </td>
191
  </tr>
192
 
193
+
194
  <tr valign="top">
195
+ <th scope="row"><?php esc_html_e('Confidence Threshold', 'better-analytics');?> <span class="dashicons-before dashicons-info tooltip" title="<?php
196
+ echo htmlspecialchars(__('Set the minimum confidence threshold that must be achieved before Analytics can declare a winner. The higher the threshold, the more confident you can be in the result. A higher threshold can result in Analytics taking longer to declare a winner.', 'better-analytics'));
197
+ ?>"></span></th>
198
  <td>
199
+ <input type="number" name="winner_confidence_level" id="ba_winner_confidence_level" min="25" max="99.5" step="0.1" value="<?php echo $winnerConfidenceLevel; ?>"<?php echo $readOnly; ?> /> <?php esc_html_e('%', 'better-analytics');?>
200
  </td>
201
  </tr>
202
 
203
+
204
+ <?php
205
+ if (!$readOnly)
206
+ {
207
+ ?>
208
+
209
+
210
+ <tr valign="top">
211
+ <th scope="row"><?php esc_html_e('Type', 'better-analytics');?></th>
212
  <td>
213
 
214
  <?php
 
215
 
216
+ $allPosts = get_posts(array(
217
+ 'posts_per_page' => 100000
218
+ ));
219
+
220
+ $allPages = get_pages();
221
+
222
+ echo '<select name="type" data-placeholder="' . esc_html__('Pick type', 'better-analytics') . '" id="ba_type">';
223
+
224
+ $types = array(
225
+ 'POST_TITLE' => array(
226
+ 'title' => esc_html__('Post Title', 'better-analytics'),
227
+ 'disabled' => count($allPosts) == 0
228
+ ),
229
+ 'PAGE_TITLE' => array(
230
+ 'title' => esc_html__('Page Title', 'better-analytics'),
231
+ 'disabled' => count($allPages) == 0
232
+ ),
233
+ 'CSS' => array(
234
+ 'title' => esc_html__('CSS', 'better-analytics'),
235
+ 'disabled' => false
236
+ ),
237
+ 'THEME' => array(
238
+ 'title' => esc_html__('Theme', 'better-analytics'),
239
+ 'disabled' => false
240
+ ),
241
+ );
242
+
243
+ $types = apply_filters('better_analytics_experiment_types', $types);
244
 
245
  foreach ($types as $key => $type)
246
  {
247
+ echo '<option value="' . $key . '"' . ($key == @$experiment['extraData']['type'] ? ' selected="selected"' : '') . ($type['disabled'] ? ' disabled="disabled"' : '') . '>' . htmlentities($type['title']) . '</option>';
248
  }
249
  echo '</select>';
250
  ?>
251
 
 
 
 
 
 
252
  </td>
253
  </tr>
254
 
255
+ <tr valign="top" class="dynamic_options POST_TITLE">
256
+ <th scope="row"><?php esc_html_e('Post', 'better-analytics');?></th>
 
257
  <td>
 
 
 
258
 
259
+ <?php
260
+
261
+ echo '<select name="extra_data[post_title][post_id]" data-placeholder="' . esc_html__('Pick post', 'better-analytics') . '" id="ba_post_id" class="chosen-select">';
262
+
263
+ foreach ($allPosts as $post)
264
+ {
265
+ echo '<option value="' . absint($post->ID) . '"' . ($post->ID == @$experiment['extraData']['post_title']['post_id'] ? ' selected="selected"' : '') . '>' . htmlentities($post->post_title) . '</option>';
266
+ }
267
+
268
+ unset($allPosts);
269
+
270
+ echo '</select>';
271
+ ?>
272
+ </td>
273
+ </tr>
274
 
275
+ <tr valign="top" class="dynamic_options POST_TITLE">
276
+ <th scope="row"><?php esc_html_e('Title Variations', 'better-analytics');?></th>
277
+ <td>
278
+ <ol>
279
+ <?php
280
+ if (is_array(@$experiment['extraData']['post_title']['titles']))
281
  {
282
+ foreach ($experiment['extraData']['post_title']['titles'] as $key => $variation)
 
283
  {
284
+ echo '<li><input type="text" name="extra_data[post_title][titles][]" class="regular-text" value="' . esc_attr($variation) .'" placeholder="' . esc_attr( esc_html__('Enter a post title variation here', 'better-analytics') ) . '" />';
 
 
285
 
286
  echo '<a class="delete"><span class="dashicons dashicons-dismiss"></span></a>';
287
 
 
 
 
 
 
 
 
288
  echo '</li>';
 
289
  }
290
  }
291
+ else
292
+ {
293
+ echo '<li><input type="text" name="extra_data[post_title][titles][]" class="regular-text" value="" placeholder="' . esc_attr( esc_html__('Enter a post title variation here', 'better-analytics') ) . '" />';
294
+
295
+ echo '<a class="delete"><span class="dashicons dashicons-dismiss"></span></a>';
296
+
297
+ echo '</li>';
298
+ }
299
+ ?>
300
+ </ol>
301
+ <a id="new_post_title_variation" class="button variation_button"><?php esc_html_e('Add another title variation', 'better-analytics') ?></a>
302
+
303
  </td>
304
  </tr>
305
 
306
+
307
+
308
+ <tr valign="top" class="dynamic_options PAGE_TITLE">
309
+ <th scope="row"><?php esc_html_e('Page', 'better-analytics');?></th>
310
  <td>
311
+
312
  <?php
313
+
314
+ echo '<select name="extra_data[page_title][post_id]" data-placeholder="' . esc_html__('Pick page', 'better-analytics') . '" id="ba_page_id" class="chosen-select">';
315
+
316
+ foreach ($allPages as $page)
317
+ {
318
+ echo '<option value="' . absint($page->ID) . '"' . ($page->ID == @$experiment['extraData']['page_title']['post_id'] ? ' selected="selected"' : '') . '>' . htmlentities($page->post_title) . '</option>';
319
+ }
320
+
321
+ unset($allPages);
322
+
323
+ echo '</select>';
324
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  </td>
326
  </tr>
327
 
328
+ <tr valign="top" class="dynamic_options PAGE_TITLE">
329
+ <th scope="row"><?php esc_html_e('Title Variations', 'better-analytics');?></th>
330
+ <td>
331
+ <ol>
332
+ <?php
333
+ if (is_array(@$experiment['extraData']['page_title']['titles']))
334
+ {
335
+ foreach ($experiment['extraData']['page_title']['titles'] as $key => $variation)
336
+ {
337
+ echo '<li><input type="text" name="extra_data[page_title][titles][]" class="regular-text" value="' . esc_attr($variation) .'" placeholder="' . esc_attr( esc_html__('Enter a page title variation here', 'better-analytics') ) . '" />';
338
+
339
+ echo '<a class="delete"><span class="dashicons dashicons-dismiss"></span></a>';
340
+
341
+ echo '</li>';
342
+ }
343
+ }
344
+ else
345
+ {
346
+ echo '<li><input type="text" name="extra_data[page_title][titles][]" class="regular-text" value="" placeholder="' . esc_attr( esc_html__('Enter a page title variation here', 'better-analytics') ) . '" />';
347
+
348
+ echo '<a class="delete"><span class="dashicons dashicons-dismiss"></span></a>';
349
+
350
+ echo '</li>';
351
+ }
352
+ ?>
353
+ </ol>
354
+ <a id="new_page_title_variation" class="button variation_button"><?php esc_html_e('Add another title variation', 'better-analytics') ?></a>
355
+
356
+ </td>
357
+ </tr>
358
+
359
+
360
+ <tr valign="top" class="dynamic_options CSS">
361
+ <th scope="row"><?php esc_html_e('Custom CSS', 'better-analytics');?></th>
362
  <td>
363
+ <ol>
364
+ <?php
365
+ if (is_array(@$experiment['extraData']['css']['code']))
366
+ {
367
+ foreach ($experiment['extraData']['css']['code'] as $key => $variation)
368
+ {
369
+ echo '<li>
370
+ <textarea name="extra_data[css][code][]" rows="8" cols="50" class="large-text code" placeholder=".some_class {
371
+ color: #AABBCC;
372
+ }
373
+
374
+ .something_else {
375
+ padding: 5px 20px;
376
+ color: green;
377
+ }">' . esc_textarea(@$variation) . '</textarea>
378
+ <a class="delete"><span class="dashicons dashicons-dismiss"></span></a>
379
+
380
+ </li>';
381
+ }
382
+ }
383
+ else
384
+ {
385
+ echo '<li>
386
+ <textarea name="extra_data[css][code][]" rows="8" cols="50" class="large-text code" placeholder=".some_class {
387
+ color: #AABBCC;
388
+ }
389
+
390
+ .something_else {
391
+ padding: 5px 20px;
392
+ color: green;
393
+ }"></textarea>
394
+ <a class="delete"><span class="dashicons dashicons-dismiss"></span></a>
395
+
396
+ </li>';
397
+ }
398
+ ?>
399
+ </ol>
400
+ <a id="new_css_variation" class="button variation_button"><?php esc_html_e('Add another CSS variation', 'better-analytics') ?></a>
401
+
402
  </td>
403
  </tr>
404
 
405
+
406
+ <tr valign="top" class="dynamic_options THEME">
407
+ <th scope="row"><?php esc_html_e('Theme Variations', 'better-analytics');?></th>
408
  <td>
409
+ <ol>
410
+
411
  <?php
412
+ $allThemes = wp_get_themes();
413
 
414
+ $durations = explode(":", gmdate('j:H:i:s', @$goal['visitTimeOnSiteDetails']['comparisonValue']));
 
 
415
 
416
+ $currentTheme = wp_get_theme();
417
+ $currentThemeTextDomain = $currentTheme->get('TextDomain');
418
+
419
+ if (is_array(@$experiment['extraData']['themes']['themes']))
420
  {
421
+ foreach ($experiment['extraData']['themes']['themes'] as $key => $variation)
 
 
 
 
 
 
 
422
  {
423
+ echo '<li>';
 
 
 
 
424
 
425
+ echo '<select name="extra_data[theme][themes][]" data-placeholder="' . esc_html__('Pick theme', 'better-analytics') . '">';
426
+
427
+ echo '<option value="" disabled="disabled" selected="selected" style="display:none;">' . esc_html__('Pick theme', 'better-analytics') . '</option>';
428
+
429
+ foreach ($allThemes as $textDomain => $theme)
430
  {
431
+ echo '<option value="' . esc_attr($textDomain) . '"' . ($currentThemeTextDomain == $textDomain ? ' disabled="disabled"' : '') . ($textDomain == $variation ? ' selected="selected"' : '') . '>' . htmlentities($theme->get('Name')) . '</option>';
 
 
 
 
432
  }
433
+ echo '</select>';
434
+
435
+ echo '<a class="delete"><span class="dashicons dashicons-dismiss"></span></a>';
436
+
437
+ echo '</li>';
438
  }
439
+ }
440
+ else
441
+ {
442
+ echo '<li>';
443
 
444
+ echo '<select name="extra_data[theme][themes][]" data-placeholder="' . esc_html__('Pick theme', 'better-analytics') . '">';
445
 
446
+ echo '<option value="" disabled="disabled" selected="selected" style="display:none;">' . esc_html__('Pick theme', 'better-analytics') . '</option>';
447
 
448
+ foreach ($allThemes as $textDomain => $theme)
449
  {
450
+ echo '<option value="' . esc_attr($textDomain) . '"' . ($currentThemeTextDomain == $textDomain ? ' disabled="disabled"' : '') . '>' . htmlentities($theme->get('Name')) . '</option>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  }
452
+ echo '</select>';
453
 
454
+ echo '<a class="delete"><span class="dashicons dashicons-dismiss"></span></a>';
455
 
456
+ echo '</li>';
457
  }
458
 
459
+ unset($allThemes);
460
 
461
+ ?>
462
+ </ol>
463
+ <a id="new_theme_variation" class="button variation_button"><?php esc_html_e('Add another theme variation', 'better-analytics') ?></a>
 
 
 
464
 
465
  </td>
466
  </tr>
467
+
468
+ <?php
469
+ do_action('better_analytics_experiment_types_html', $experiment);
470
+ }
471
+ ?>
472
  </table>
473
 
474
 
475
  <?php
476
+ if (!$readOnly)
477
+ {
478
+ submit_button();
479
+ }
480
  echo '</form>
481
  </div>';
482
  }
483
  else
484
  {
485
+ check_admin_referer('create_edit-experiment' . $nOnceSalt);
486
 
487
  $errorMessage = array();
488
 
489
+ $experimentObject = array(
490
+ 'servingFramework' => 'API',
491
+ 'editableInGaUi' => false,
 
 
 
 
 
 
492
  );
493
 
494
+ if (@$experiment['status'] != 'ENDED')
495
  {
496
+ $experimentObject['minimumExperimentLengthInDays'] = absint(@$_POST['minimum_days_to_run']);
497
+ $experimentObject['equalWeighting'] = (@$_POST['equal_weighting'] ? true : false);
498
+ $experimentObject['name'] = sanitize_text_field(@$_POST['name']);
499
+ $experimentObject['trafficCoverage'] = absint(@$_POST['traffic_coverage']) / 100;
500
+ $experimentObject['winnerConfidenceLevel'] = absint(@$_POST['winner_confidence_level']) / 100;
501
  }
502
 
503
+ if (@$experiment['status'] != 'RUNNING' && @$experiment['status'] != 'ENDED')
 
504
  {
505
+ $experimentObject['optimizationType'] = sanitize_text_field(@$_POST['optimization_type']);
506
+ $experimentObject['objectiveMetric'] = sanitize_text_field(@$_POST['objective_metric']);
507
  }
508
 
509
+ $extraData = array(
510
+ 'description' => sanitize_text_field(@$_POST['description']),
511
+ 'type' => sanitize_text_field(@$_POST['type'])
512
+ );
513
+
514
+
515
+ $extraDataInput = @$_POST['extra_data'];
516
+
517
+ $variations = array(array(
518
+ 'name' => 'original',
519
+ 'status' => 'ACTIVE'
520
+ ));
521
+
522
+ if (is_array($extraDataInput))
523
  {
524
+ switch (@$_POST['type'])
 
 
 
 
 
 
525
  {
526
+ case 'POST_TITLE':
527
+
528
+ $extraData['post_title']['post_id'] = absint(@$extraDataInput['post_title']['post_id']);
529
 
530
+ if (is_array(@$extraDataInput['post_title']['titles']))
 
 
531
  {
532
+ foreach($extraDataInput['post_title']['titles'] as $title)
533
+ {
534
+ if ($title = sanitize_text_field($title))
535
+ {
536
+ $extraData['post_title']['titles'][] = $title;
537
+ $variations[] = array(
538
+ 'name' => $title,
539
+ 'status' => 'ACTIVE',
540
+ // 'url' => 'none'
541
+ );
542
+ }
543
+ }
544
  }
 
 
545
 
546
+ break;
547
+
548
+ case 'PAGE_TITLE':
549
+
550
+ $extraData['page_title']['post_id'] = absint(@$extraDataInput['page_title']['post_id']);
551
+
552
+ if (is_array(@$extraDataInput['page_title']['titles']))
553
+ {
554
+ foreach($extraDataInput['page_title']['titles'] as $title)
555
+ {
556
+ if ($title = sanitize_text_field($title))
557
+ {
558
+ $extraData['page_title']['titles'][] = $title;
559
+ $variations[] = array(
560
+ 'name' => $title,
561
+ 'status' => 'ACTIVE',
562
+ // 'url' => 'none'
563
+ );
564
+ }
565
+ }
566
+ }
567
+ break;
568
+
569
+ case 'CSS':
570
+ if (is_array(@$extraDataInput['css']['code']))
571
+ {
572
+ foreach($extraDataInput['css']['code'] as $code)
573
+ {
574
+ if ($code = wp_strip_all_tags($code))
575
+ {
576
+ $extraData['css']['code'][] = $code;
577
+ $variations[] = array(
578
+ 'name' => 'CSS variation',
579
+ 'status' => 'ACTIVE',
580
+ // 'url' => 'none'
581
+ );
582
+ }
583
+ }
584
+ }
585
+ break;
586
+
587
+ case 'THEME':
588
+ if (is_array(@$extraDataInput['theme']['themes']))
589
+ {
590
+ foreach($extraDataInput['theme']['themes'] as $theme)
591
+ {
592
+ if ($theme = sanitize_text_field($theme))
593
+ {
594
+ $extraData['theme']['themes'][] = $theme;
595
+ $variations[] = array(
596
+ 'name' => $theme,
597
+ 'status' => 'ACTIVE',
598
+ // 'url' => 'none'
599
+ );
600
+ }
601
+ }
602
+ }
603
+ break;
604
+
605
+ default:
606
+
607
+ list($extraData, $variations) = apply_filters('better_analytics_experiment_save', $extraData, $variations, $extraDataInput);
608
  }
609
 
610
  }
611
+
612
+ if (count($variations) > 0)
613
  {
614
+ $experimentObject['variations'] = $variations;
 
 
 
615
  }
616
+
617
+ $experimentObject['description'] = json_encode($extraData);
618
+
619
+ if (!$experimentObject['name'] && !$experiment['name'])
620
  {
621
+ $errorMessage[] = esc_html__('Experiment name is required.', 'better-analytics');
 
 
 
622
  }
 
 
 
 
 
 
623
 
 
 
 
 
 
 
 
 
624
 
625
+ echo $experimentId;
 
 
 
 
 
 
 
626
 
 
 
 
 
 
 
 
 
627
 
628
+ print_r ($extraData);
629
+
630
+ print_r ($experimentObject);
 
 
 
 
 
631
 
 
 
 
 
632
 
633
 
 
634
 
635
  $reportingClass = DigitalPointBetterAnalytics_Helper_Reporting::getInstance();
636
 
637
  if (!$errorMessage && $profile = $reportingClass->getProfileByProfileId(@$betterAnalyticsOptions['api']['profile']))
638
  {
639
+ if ($experimentId)
640
  {
641
+ echo 'patching!';
642
+
643
+ $experiment = $reportingClass->patchExperiment($profile['accountId'], $profile['webPropertyId'], $profile['id'], $experimentId, $experimentObject);
644
  }
645
  else
646
  {
647
+ echo 'inserting!';
648
+
649
+
650
+ $experiment = $reportingClass->insertExperiment($profile['accountId'], $profile['webPropertyId'], $profile['id'], $experimentObject);
651
  }
652
 
653
+ $reportingClass->deleteExperimentCache($profile['accountId'], $profile['webPropertyId'], $profile['id']);
654
+ if (!empty($experiment['id']))
655
+ {
656
+ $reportingClass->deleteExperimentCache($profile['accountId'], $profile['webPropertyId'], $profile['id'], $experiment['id']);
657
+ }
658
 
659
+ $experiments = DigitalPointBetterAnalytics_Model_Experiments::getAllExperiments($profile['accountId'], $profile['webPropertyId'], $profile['id']);
 
660
 
661
+ if ($experimentId)
662
  {
663
  /* translators: %1$s = <strong>, %2$s = </strong> */
664
+ $noticeAtTop = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf(esc_html__('Experiment %1$supdated%2$s.'), '<strong>', '</strong>') . '</p></div>';
665
  }
666
  else
667
  {
668
  /* translators: %1$s = <strong>, %2$s = </strong> */
669
+ $noticeAtTop = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf(esc_html__('Experiment %1$screated%2$s.'), '<strong>', '</strong>') . '</p></div>';
670
  }
671
  }
672
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: digitalpoint
3
  Tags: analytics, google analytics, universal analytics, statistics, tracking, code, dashboard, analytics dashboard, google analytics dashboard, google analytics plugin, google analytics widget, reports, charts, multisite, api, stats, web stats, visits, javascript, pageviews, marketing, widget, realtime, real time, youtube, outbrain, taboola, adsense, twitter, pinterest, linkedin, facebook, google, digitalpoint
4
  Donate link: https://marketplace.digitalpoint.com/better-analytics.3354/item#utm_source=readme&utm_medium=wordpress&utm_campaign=plugin
5
  Requires at least: 3.8
6
- Tested up to: 4.2.3
7
- Stable tag: 1.0.9
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -183,11 +183,19 @@ Thank you to all the individuals who have contributed translations for Better Go
183
  22. Advanced settings allow you to fine tune how the system works with Google Analytics.
184
 
185
  == Changelog ==
 
 
 
 
 
 
 
 
186
  = 1.0.9 =
187
- * Google Analytics Stats Widget has two new options that allows you to show stats on a per page basis if you want as well as making the widget private (only viewable to certain roles)
188
- * Disallow PHP auto_append_file directive within the JavaScript loader
189
- * Added a 1 Day option for the Google Analytics dashboard widget
190
- * Works with WordPress 4.2.3
191
 
192
  = 1.0.8 =
193
  * Made a few minor cosmetic changes to Google Analytics Goal list view (including responsive)
3
  Tags: analytics, google analytics, universal analytics, statistics, tracking, code, dashboard, analytics dashboard, google analytics dashboard, google analytics plugin, google analytics widget, reports, charts, multisite, api, stats, web stats, visits, javascript, pageviews, marketing, widget, realtime, real time, youtube, outbrain, taboola, adsense, twitter, pinterest, linkedin, facebook, google, digitalpoint
4
  Donate link: https://marketplace.digitalpoint.com/better-analytics.3354/item#utm_source=readme&utm_medium=wordpress&utm_campaign=plugin
5
  Requires at least: 3.8
6
+ Tested up to: 4.3.0
7
+ Stable tag: 1.0.10
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
183
  22. Advanced settings allow you to fine tune how the system works with Google Analytics.
184
 
185
  == Changelog ==
186
+ = 1.0.10 =
187
+ * Change: Removed async attribute from script tag for better compatibility with certain themes
188
+ * Enhancement: Set Google Analytics sample rate to 100 if something internal to WordPress removes that setting somehow
189
+ * Enhancement: Updated Google Analytics Goal management to take advantage of new responsive table methods in WordPress 4.3
190
+ * Enhancement: Google Analytics Experiments allow adding custom third-party experiment types via hooks and actions
191
+ * Security: Added input sanitization callback to settings
192
+ * Flagged for WordPress 4.3.0 compatibility
193
+
194
  = 1.0.9 =
195
+ * Feature: Google Analytics Stats Widget has two new options that allows you to show stats on a per page basis if you want as well as making the widget private (only viewable to certain roles)
196
+ * Enhancement: Disallow PHP auto_append_file directive within the JavaScript loader
197
+ * Enhancement: Added a 1 Day option for the Google Analytics dashboard widget
198
+ * Flagged for WordPress 4.2.3 compatibility
199
 
200
  = 1.0.8 =
201
  * Made a few minor cosmetic changes to Google Analytics Goal list view (including responsive)