Better Google Analytics - Version 1.2.0

Version Description

  • Better checking for null settings
  • Updated Google Analytics Reporting API library to utilize V4
  • New Google Analytics dimensions available for Traffic Source charts: Referral Path, Full Referrer, Source / Medium, Has Social Source Referral
  • New Google Analytics dimensions available for AdWords charts: Ad Group, Ad Slot, Ad Distribution Network, Ad Match Type, Ad Keyword Match Type, Ad Matched Query, Ad Placement Domain, Ad Placement URL, Ad Format, Ad Targeting Type, Ad Targeting Option, Ad Display URL, Ad Destination URL, AdWords Campaign ID, AdWords Ad Group ID, AdWords Creative ID, Ad Query Word Count
  • New Google Analytics dimensions available for Platform charts: Browser Version, Browser Size, Data Source
  • New Google Analytics dimensions available for Geo / Network charts: Metro, Network Domain, Network Location
  • New Google Analytics dimensions available for Page Tracking charts: Path Path, Landing Page Path, Exit Page Path
  • New Google Analytics dimensions available for Lifetime Value and Cohorts charts: Acquisition Campaign, Acquisition Medium, Acquisition Source / Medium, Acquisition Traffic Channel, Cohort
  • Updated Chosen JavaScript library
  • Fixed issue where Pro version sometimes wouldn't know what version number of itself was installed
  • Updated for WordPress 4.7
  • Added support for Google Analytics AMP (Accelerated Mobile Pages) tracking
Download this release

Release Info

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

Code changes from version 1.1.4 to 1.2.0

assets/chosen/bower.json CHANGED
@@ -1,20 +1,6 @@
1
  {
2
  "name": "chosen",
3
- "description": "Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.",
4
- "version": "1.4.2",
5
- "main": [
6
- "chosen.jquery.min.js",
7
- "chosen.css",
8
- "chosen-sprite@2x.png",
9
- "chosen-sprite.png"
10
- ],
11
- "license": [
12
- {
13
- "type": "MIT",
14
- "url": "https://github.com/harvesthq/chosen/blob/master/LICENSE.md"
15
- }
16
- ],
17
- "ignore": [],
18
  "keywords": [
19
  "select",
20
  "multiselect",
@@ -23,6 +9,8 @@
23
  "input",
24
  "ui"
25
  ],
 
 
26
  "authors": [
27
  {
28
  "name": "Patrick Filler",
@@ -41,13 +29,16 @@
41
  "url": "https://github.com/koenpunt"
42
  }
43
  ],
44
- "homepage": "http://harvesthq.github.io/chosen/",
 
 
 
 
 
 
 
45
  "repository": {
46
  "type": "git",
47
- "url": "https://github.com/harvesthq/chosen"
48
- },
49
- "dependencies": {
50
- "jquery": ">=1.4.4"
51
- },
52
- "devDependencies": []
53
  }
1
  {
2
  "name": "chosen",
3
+ "description": "Chosen is a JavaScript plugin that makes select boxes user-friendly. It is currently available in both jQuery and Prototype flavors.",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  "keywords": [
5
  "select",
6
  "multiselect",
9
  "input",
10
  "ui"
11
  ],
12
+ "homepage": "https://harvesthq.github.io/chosen/",
13
+ "license": "https://github.com/harvesthq/chosen/blob/master/LICENSE.md",
14
  "authors": [
15
  {
16
  "name": "Patrick Filler",
29
  "url": "https://github.com/koenpunt"
30
  }
31
  ],
32
+ "dependencies": {},
33
+ "main": [
34
+ "chosen.jquery.js",
35
+ "chosen.css",
36
+ "chosen-sprite@2x.png",
37
+ "chosen-sprite.png"
38
+ ],
39
+ "ignore": [],
40
  "repository": {
41
  "type": "git",
42
+ "url": "https://github.com/harvesthq/chosen.git"
43
+ }
 
 
 
 
44
  }
assets/chosen/chosen.jquery.min.js CHANGED
@@ -1,2 +1,2 @@
1
- /* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
- (function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c)));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return a.search_match||a.group_match?a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(){var c,d;c=a(this),d=c.data("chosen"),"destroy"===b&&d instanceof Chosen?d.destroy():d instanceof Chosen||c.data("chosen",new Chosen(this,b))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.bind("touchend.chosen",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(b)+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),b.addClass("result-selected"),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}).call(this);
1
+ /* Chosen v1.7.0 | (c) 2011-2017 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
+ (function(){var a,b,c,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}},g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};d=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},a.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},a}(),d.select_to_array=function(a){var b,c,e,f,g;for(c=new d,g=a.childNodes,e=0,f=g.length;f>e;e++)b=g[e],c.add_node(b);return c.parsed},b=function(){function a(b,c){this.form_field=b,this.options=null!=c?c:{},this.label_click_handler=f(this.label_click_handler,this),a.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return a.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null!=this.options.hide_results_on_select?this.options.hide_results_on_select:!0},a.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||a.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||a.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||a.default_no_result_text},a.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},a.prototype.input_blur=function(a){var b=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return b.blur_test()},100))},a.prototype.label_click_handler=function(a){return this.is_multiple?this.container_mousedown(a):this.activate_field()},a.prototype.results_option_build=function(a){var b,c,d,e,f,g,h;for(b="",e=0,h=this.results_data,f=0,g=h.length;g>f&&(c=h[f],d="",d=c.group?this.result_add_group(c):this.result_add_option(c),""!==d&&(e++,b+=d),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c))),!(e>=this.max_shown_results));f++);return b},a.prototype.result_add_option=function(a){var b,c;return a.search_match&&this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},a.prototype.result_add_group=function(a){var b,c;return(a.search_match||a.group_match)&&a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},a.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},a.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),e=0,g=this.get_search_text(),a=g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),d=this.get_search_regex(a),b=this.get_highlight_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)c=l[j],c.search_match=!1,f=null,this.include_option_in_results(c)&&(c.group&&(c.group_match=!1,c.active_options=0),null!=c.group_array_index&&this.results_data[c.group_array_index]&&(f=this.results_data[c.group_array_index],0===f.active_options&&f.search_match&&(e+=1),f.active_options+=1),c.search_text=c.group?c.label:c.html,(!c.group||this.group_search)&&(c.search_match=this.search_string_match(c.search_text,d),c.search_match&&!c.group&&(e+=1),c.search_match?(g.length&&(h=c.search_text.search(b),i=c.search_text.substr(0,h+g.length)+"</em>"+c.search_text.substr(h+g.length),c.search_text=i.substr(0,h)+"<em>"+i.substr(h)),null!=f&&(f.group_match=!0)):null!=c.group_array_index&&this.results_data[c.group_array_index].search_match&&(c.search_match=!0)));return this.result_clear_highlight(),1>e&&g.length?(this.update_results_content(""),this.no_results(g)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},a.prototype.get_search_regex=function(a){var b,c;return b=this.search_contains?"":"^",c=this.case_sensitive_search?"":"i",new RegExp(b+a,c)},a.prototype.get_highlight_regex=function(a){var b,c;return b=this.search_contains?"":"\\b",c=this.case_sensitive_search?"":"i",new RegExp(b+a,c)},a.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},a.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},a.prototype.choices_click=function(a){return a.preventDefault(),this.activate_field(),this.results_showing||this.is_disabled?void 0:this.results_show()},a.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 27:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},a.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:a.preventDefault(),this.results_showing&&this.result_select(a);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},a.prototype.clipboard_event_checker=function(a){var b=this;if(!this.is_disabled)return setTimeout(function(){return b.results_search()},50)},a.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},a.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},a.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},a.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},a.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},a.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},a.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n </div>\n <ul class="chosen-results"></ul>\n</div>'},a.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},a.prototype.get_no_results_html=function(a){return'<li class="no-results">\n '+this.results_none_found+" <span>"+a+"</span>\n</li>"},a.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent)?!1:!0},a.default_multiple_text="Select Some Options",a.default_single_text="Select an Option",a.default_no_result_text="No results match",a}(),a=jQuery,a.fn.extend({chosen:function(d){return b.browser_is_supported()?this.each(function(b){var e,f;return e=a(this),f=e.data("chosen"),"destroy"===d?void(f instanceof c&&f.destroy()):void(f instanceof c||e.data("chosen",new c(this,d)))}):this}}),c=function(b){function c(){return e=c.__super__.constructor.apply(this,arguments)}return h(c,b),c.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},c.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},c.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},c.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){a.container_mousedown(b)}),this.container.bind("touchend.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.close_field(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},c.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.unbind("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},c.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_field)},c.prototype.container_mousedown=function(b){var c;if(!this.is_disabled)return!b||"mousedown"!==(c=b.type)&&"touchstart"!==c||this.results_showing||b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},c.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},c.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},c.prototype.blur_test=function(a){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},c.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},c.prototype.activate_field=function(){return this.is_disabled?void 0:(this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus())},c.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},c.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=d.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},c.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},c.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},c.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},c.prototype.update_results_content=function(a){return this.search_results.html(a)},c.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},c.prototype.set_tab_index=function(a){var b;return this.form_field.tabIndex?(b=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=b):void 0},c.prototype.set_label_behavior=function(){return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",this.label_click_handler):void 0},c.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},c.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},c.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},c.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},c.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(b)+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},c.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},c.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},c.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field?this.results_hide():void 0},c.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},c.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),b.addClass("result-selected"),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(!this.is_multiple||this.hide_results_on_select&&!a.metaKey&&!a.ctrlKey)&&(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},c.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(a)},c.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},c.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},c.prototype.get_search_field_value=function(){return this.search_field.val()},c.prototype.get_search_text=function(){return this.escape_html(a.trim(this.get_search_field_value()))},c.prototype.escape_html=function(b){return a("<div/>").text(b).html()},c.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},c.prototype.no_results=function(a){var b;return b=this.get_no_results_html(a),this.search_results.append(b),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},c.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},c.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},c.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},c.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},c.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},c.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i;if(this.is_multiple){for(e={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},f=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"],h=0,i=f.length;i>h;h++)d=f[h],e[d]=this.search_field.css(d);return c=a("<div />").css(e),c.text(this.get_search_field_value()),a("body").append(c),g=c.width()+25,c.remove(),b=this.container.outerWidth(),g=Math.min(b-10,g),this.search_field.width(g)}},c.prototype.trigger_form_field_change=function(a){return this.form_field_jq.trigger("input",a),this.form_field_jq.trigger("change",a)},c}(b)}).call(this);
assets/chosen/chosen.min.css CHANGED
@@ -1,3 +1,3 @@
1
- /* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
 
3
- .chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;zoom:1;*display:inline;-webkit-user-select:none;-moz-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;left:-9999px;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;box-shadow:0 4px 5px rgba(0,0,0,.15)}.chosen-container.chosen-with-drop .chosen-drop{left:0}.chosen-container a{cursor:pointer}.chosen-container .search-choice .group-name,.chosen-container .chosen-single .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .search-choice .group-name:after,.chosen-container .chosen-single .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),color-stop(100%,#f4f4f4));background:-webkit-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-moz-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-o-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:#fff url(chosen-sprite.png) no-repeat 100% -20px;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;left:-9999px}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:-webkit-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-moz-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-o-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto!important;height:1%;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(1%,#eee),color-stop(15%,#fff));background-image:-webkit-linear-gradient(#eee 1%,#fff 15%);background-image:-moz-linear-gradient(#eee 1%,#fff 15%);background-image:-o-linear-gradient(#eee 1%,#fff 15%);background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:transparent!important;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#eee),color-stop(80%,#fff));background-image:-webkit-linear-gradient(#eee 20%,#fff 80%);background-image:-moz-linear-gradient(#eee 20%,#fff 80%);background-image:-o-linear-gradient(#eee 20%,#fff 80%);background-image:linear-gradient(#eee 20%,#fff 80%);box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:0;background:transparent}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single-nosearch .chosen-search,.chosen-rtl .chosen-drop{left:9999px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:0}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:#fff url(chosen-sprite.png) no-repeat -30px -20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-rtl .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-container-single .chosen-search input[type=text],.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
1
+ /* Chosen v1.7.0 | (c) 2011-2017 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
 
3
+ .chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chosen-container *{box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;box-shadow:0 4px 5px rgba(0,0,0,.15);clip:rect(0,0,0,0)}.chosen-container.chosen-with-drop .chosen-drop{clip:auto}.chosen-container a{cursor:pointer}.chosen-container .search-choice .group-name,.chosen-container .chosen-single .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .search-choice .group-name:after,.chosen-container .chosen-single .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;clip:rect(0,0,0,0)}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:transparent!important;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0;width:25px}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;border-bottom-right-radius:0;border-bottom-left-radius:0;background-image:linear-gradient(#eee 20%,#fff 80%);box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:0;background:transparent}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:0}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-rtl .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-container-single .chosen-search input[type=text],.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
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.1.4
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.1.4');
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.2.0
11
  Author: Digital Point
12
  Author URI: https://www.digitalpoint.com/
13
  License: GPLv2
23
  exit;
24
  }
25
 
26
+ define('BETTER_ANALYTICS_VERSION', '1.2.0');
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/universal.php CHANGED
@@ -71,17 +71,17 @@ if (!$baRole = implode(',', (array)@$currentUser->roles))
71
  $baRole = 'guest';
72
  }
73
 
74
- if (@$betterAnalyticsOptions['track_userid'] && @$currentUser->ID > 0)
75
  {
76
  $createOptions['userId'] = intval($currentUser->ID);
77
  }
78
 
79
- if (@$betterAnalyticsOptions['sample_rate'] > 0 && $betterAnalyticsOptions['sample_rate'] < 100)
80
  {
81
  $createOptions['sampleRate'] = intval($betterAnalyticsOptions['sample_rate']);
82
  }
83
 
84
- if (@$betterAnalyticsOptions['events']['user_engagement'])
85
  {
86
  $jsonOptions['et'] = (@$betterAnalyticsOptions['engagement_time'] > 0 && $betterAnalyticsOptions['engagement_time'] <= 600 ? intval($betterAnalyticsOptions['engagement_time']) : 15);
87
  }
@@ -100,27 +100,27 @@ if (!empty($betterAnalyticsOptions['extra_js']))
100
  }
101
 
102
  $jsonOptions['g'] =
103
- (@$betterAnalyticsInternal['v'] ? 1 : 0) +
104
- (@$betterAnalyticsOptions['link_attribution'] ? 4 : 0) +
105
- (@$betterAnalyticsOptions['track_userid'] ? 8 : 0) +
106
- (@$betterAnalyticsOptions['anonymize_ips'] ? 16 : 0) +
107
- (@$betterAnalyticsOptions['demographic_tracking'] ? 32 : 0) +
108
- (@$betterAnalyticsOptions['force_ssl'] ? 64 : 0) +
109
- (@$betterAnalyticsOptions['events']['user_engagement'] ? 128 : 0) +
110
- (@$betterAnalyticsOptions['events']['youtube'] ? 256 : 0) +
111
- (@$betterAnalyticsOptions['events']['link_click'] ? 512 : 0) +
112
- (@$betterAnalyticsOptions['events']['missing_images'] ? 1024 : 0) +
113
- (@$betterAnalyticsOptions['events']['ajax_request'] ? 2048 : 0) +
114
- (@$betterAnalyticsOptions['events']['error_js'] ? 4096 : 0) +
115
- (@$betterAnalyticsOptions['events']['error_ajax'] ? 8192 : 0) +
116
- (@$betterAnalyticsOptions['events']['error_console'] ? 16384 : 0) +
117
- (@$betterAnalyticsOptions['events']['error_youtube'] ? 32768 : 0) +
118
- (@$betterAnalyticsOptions['events']['error_404'] ? 65536 : 0) +
119
- (@$betterAnalyticsOptions['events']['page_scroll'] ? 131072 : 0) +
120
- (@$betterAnalyticsOptions['events']['time_on_page'] ? 262144 : 0) +
121
-
122
- (@$betterAnalyticsOptions['javascript']['run_time'] == 'immediately' ? 1073741824 : 0) +
123
- (@$betterAnalyticsOptions['debugging'] ? 2147483648 : 0)
124
 
125
  ;
126
 
@@ -130,21 +130,21 @@ if (!empty($betterAnalyticsOptions['events']['downloads']) && !empty($betterAnal
130
  }
131
 
132
  $jsonOptions['s'] =
133
- (@$betterAnalyticsInternal['v'] ? 1 : 0) +
134
- (@$betterAnalyticsOptions['social']['facebook'] ? 2 : 0) +
135
- (@$betterAnalyticsOptions['social']['twitter'] ? 4 : 0) +
136
- // (@$betterAnalyticsOptions['social']['google'] ? 8 : 0) +
137
- (@$betterAnalyticsOptions['social']['pinterest'] ? 16 : 0) +
138
- (@$betterAnalyticsOptions['social']['linkedin'] ? 32 : 0)
139
  ;
140
 
141
  $jsonOptions['a'] =
142
- (@$betterAnalyticsInternal['v'] ? 1 : 0) +
143
- (@$betterAnalyticsOptions['ads']['adsense'] ? 2 : 0) +
144
- (@$betterAnalyticsOptions['ads']['outbrain'] ? 4 : 0) +
145
- (@$betterAnalyticsOptions['ads']['taboola'] ? 8 : 0) +
146
- (@$betterAnalyticsOptions['ads']['digitalpoint'] ? 16 : 0) +
147
- (@$betterAnalyticsOptions['ads']['revcontent'] ? 32 : 0)
148
  ;
149
 
150
  if (!empty($betterAnalyticsOptions['dimension']['category']) && $baCategories)
71
  $baRole = 'guest';
72
  }
73
 
74
+ if (!empty($betterAnalyticsOptions['track_userid']) && @$currentUser->ID > 0)
75
  {
76
  $createOptions['userId'] = intval($currentUser->ID);
77
  }
78
 
79
+ if (!empty($betterAnalyticsOptions['sample_rate']) > 0 && $betterAnalyticsOptions['sample_rate'] < 100)
80
  {
81
  $createOptions['sampleRate'] = intval($betterAnalyticsOptions['sample_rate']);
82
  }
83
 
84
+ if (!empty($betterAnalyticsOptions['events']['user_engagement']))
85
  {
86
  $jsonOptions['et'] = (@$betterAnalyticsOptions['engagement_time'] > 0 && $betterAnalyticsOptions['engagement_time'] <= 600 ? intval($betterAnalyticsOptions['engagement_time']) : 15);
87
  }
100
  }
101
 
102
  $jsonOptions['g'] =
103
+ (!empty($betterAnalyticsInternal['v']) ? 1 : 0) +
104
+ (!empty($betterAnalyticsOptions['link_attribution']) ? 4 : 0) +
105
+ (!empty($betterAnalyticsOptions['track_userid']) ? 8 : 0) +
106
+ (!empty($betterAnalyticsOptions['anonymize_ips']) ? 16 : 0) +
107
+ (!empty($betterAnalyticsOptions['demographic_tracking']) ? 32 : 0) +
108
+ (!empty($betterAnalyticsOptions['force_ssl']) ? 64 : 0) +
109
+ (!empty($betterAnalyticsOptions['events']['user_engagement']) ? 128 : 0) +
110
+ (!empty($betterAnalyticsOptions['events']['youtube']) ? 256 : 0) +
111
+ (!empty($betterAnalyticsOptions['events']['link_click']) ? 512 : 0) +
112
+ (!empty($betterAnalyticsOptions['events']['missing_images']) ? 1024 : 0) +
113
+ (!empty($betterAnalyticsOptions['events']['ajax_request']) ? 2048 : 0) +
114
+ (!empty($betterAnalyticsOptions['events']['error_js']) ? 4096 : 0) +
115
+ (!empty($betterAnalyticsOptions['events']['error_ajax']) ? 8192 : 0) +
116
+ (!empty($betterAnalyticsOptions['events']['error_console']) ? 16384 : 0) +
117
+ (!empty($betterAnalyticsOptions['events']['error_youtube']) ? 32768 : 0) +
118
+ (!empty($betterAnalyticsOptions['events']['error_404']) ? 65536 : 0) +
119
+ (!empty($betterAnalyticsOptions['events']['page_scroll']) ? 131072 : 0) +
120
+ (!empty($betterAnalyticsOptions['events']['time_on_page']) ? 262144 : 0) +
121
+
122
+ (!empty($betterAnalyticsOptions['javascript']['run_time']) == 'immediately' ? 1073741824 : 0) +
123
+ (!empty($betterAnalyticsOptions['debugging']) ? 2147483648 : 0)
124
 
125
  ;
126
 
130
  }
131
 
132
  $jsonOptions['s'] =
133
+ (!empty($betterAnalyticsInternal['v']) ? 1 : 0) +
134
+ (!empty($betterAnalyticsOptions['social']['facebook']) ? 2 : 0) +
135
+ (!empty($betterAnalyticsOptions['social']['twitter']) ? 4 : 0) +
136
+ // (!empty($betterAnalyticsOptions['social']['google']) ? 8 : 0) +
137
+ (!empty($betterAnalyticsOptions['social']['pinterest']) ? 16 : 0) +
138
+ (!empty($betterAnalyticsOptions['social']['linkedin']) ? 32 : 0)
139
  ;
140
 
141
  $jsonOptions['a'] =
142
+ (!empty($betterAnalyticsInternal['v']) ? 1 : 0) +
143
+ (!empty($betterAnalyticsOptions['ads']['adsense']) ? 2 : 0) +
144
+ (!empty($betterAnalyticsOptions['ads']['outbrain']) ? 4 : 0) +
145
+ (!empty($betterAnalyticsOptions['ads']['taboola']) ? 8 : 0) +
146
+ (!empty($betterAnalyticsOptions['ads']['digitalpoint']) ? 16 : 0) +
147
+ (!empty($betterAnalyticsOptions['ads']['revcontent']) ? 32 : 0)
148
  ;
149
 
150
  if (!empty($betterAnalyticsOptions['dimension']['category']) && $baCategories)
library/DigitalPointBetterAnalytics/Base/Admin.php CHANGED
@@ -142,15 +142,15 @@ class DigitalPointBetterAnalytics_Base_Admin
142
  krsort($links);
143
  end($links);
144
  $key = key($links);
145
- $links[$key] .= '<p class="' . (DigitalPointBetterAnalytics_Base_Pro::$installed && @$betterAnalyticsInternal['v'] && @$betterAnalyticsInternal['l'] == DigitalPointBetterAnalytics_Base_Pro::$version ? 'green' : 'orange') . '"> ' .
146
- (DigitalPointBetterAnalytics_Base_Pro::$installed ?
147
  (@$betterAnalyticsInternal['v'] ?
148
- (@$betterAnalyticsInternal['l'] != DigitalPointBetterAnalytics_Base_Pro::$version ?
149
  sprintf('<a href="%1$s" target="_blank">%2$s</a><br />%3$s %4$s<br />%5$s %6$s',
150
  esc_url(BETTER_ANALYTICS_PRO_PRODUCT_URL . '#utm_source=admin_plugins&utm_medium=wordpress&utm_campaign=plugin'),
151
  esc_html__('Pro version not up to date.', 'better-analytics'),
152
  esc_html__('Installed:', 'better-analytics'),
153
- DigitalPointBetterAnalytics_Base_Pro::$version,
154
  esc_html__('Latest:', 'better-analytics'),
155
  @$betterAnalyticsInternal['l']
156
  ) :
@@ -201,7 +201,7 @@ class DigitalPointBetterAnalytics_Base_Admin
201
  $betterAnalyticsOptions = get_option('better_analytics');
202
  $currentUser = wp_get_current_user();
203
 
204
- if (@$betterAnalyticsOptions['javascript']['use_in_admin'] && !array_intersect((array)$currentUser->roles, (array)@$betterAnalyticsOptions['roles_no_track']))
205
  {
206
  DigitalPointBetterAnalytics_Base_Public::getInstance()->insert_code();
207
  include(BETTER_ANALYTICS_PLUGIN_DIR . 'js/universal.php');
@@ -310,6 +310,11 @@ class DigitalPointBetterAnalytics_Base_Admin
310
 
311
  public function removable_query_args($args)
312
  {
 
 
 
 
 
313
  if (strpos(@$_SERVER['REQUEST_URI'], 'page=better-analytics') !== false && (@$_REQUEST['action'] == 'start' || @$_REQUEST['action'] == 'stop' || @$_REQUEST['action'] == 'delete' || @$_REQUEST['action'] == 'activate' || @$_REQUEST['action'] == 'deactivate'))
314
  {
315
  $args[] = 'id';
@@ -455,7 +460,7 @@ class DigitalPointBetterAnalytics_Base_Admin
455
  $links['support'] = '<a href="' . esc_url(BETTER_ANALYTICS_SUPPORT_URL ) . '" title="' . esc_attr( esc_html__( 'Visit Support Forum', 'better-analytics' ) ) . '">' . esc_html__( 'Support', 'better-analytics' ) . '</a>';
456
 
457
  $betterAnalyticsInternal = get_transient('ba_int');
458
- if (DigitalPointBetterAnalytics_Base_Pro::$installed && empty($betterAnalyticsInternal['v']))
459
  {
460
  $links['verify_domain'] = '<a href="' . esc_url('https://forums.digitalpoint.com/marketplace/domain-verification#utm_source=admin_plugins&utm_medium=wordpress&utm_campaign=plugin') . '" target="_blank">' . esc_html__( 'Verify Domain', 'better-analytics' ) . '</a>';
461
  }
142
  krsort($links);
143
  end($links);
144
  $key = key($links);
145
+ $links[$key] .= '<p class="' . (DigitalPointBetterAnalytics_Helper_Api::$installed && @$betterAnalyticsInternal['v'] && @$betterAnalyticsInternal['l'] == DigitalPointBetterAnalytics_Helper_Api::$version ? 'green' : 'orange') . '"> ' .
146
+ (DigitalPointBetterAnalytics_Helper_Api::$installed ?
147
  (@$betterAnalyticsInternal['v'] ?
148
+ (@$betterAnalyticsInternal['l'] != DigitalPointBetterAnalytics_Helper_Api::$version ?
149
  sprintf('<a href="%1$s" target="_blank">%2$s</a><br />%3$s %4$s<br />%5$s %6$s',
150
  esc_url(BETTER_ANALYTICS_PRO_PRODUCT_URL . '#utm_source=admin_plugins&utm_medium=wordpress&utm_campaign=plugin'),
151
  esc_html__('Pro version not up to date.', 'better-analytics'),
152
  esc_html__('Installed:', 'better-analytics'),
153
+ DigitalPointBetterAnalytics_Helper_Api::$version,
154
  esc_html__('Latest:', 'better-analytics'),
155
  @$betterAnalyticsInternal['l']
156
  ) :
201
  $betterAnalyticsOptions = get_option('better_analytics');
202
  $currentUser = wp_get_current_user();
203
 
204
+ if (!empty($betterAnalyticsOptions['javascript']['use_in_admin']) && !empty($betterAnalyticsOptions['roles_no_track']) && !array_intersect((array)$currentUser->roles, (array)@$betterAnalyticsOptions['roles_no_track']))
205
  {
206
  DigitalPointBetterAnalytics_Base_Public::getInstance()->insert_code();
207
  include(BETTER_ANALYTICS_PLUGIN_DIR . 'js/universal.php');
310
 
311
  public function removable_query_args($args)
312
  {
313
+ if (empty($_REQUEST['action']))
314
+ {
315
+ $_REQUEST['action'] = 'unsed';
316
+ }
317
+
318
  if (strpos(@$_SERVER['REQUEST_URI'], 'page=better-analytics') !== false && (@$_REQUEST['action'] == 'start' || @$_REQUEST['action'] == 'stop' || @$_REQUEST['action'] == 'delete' || @$_REQUEST['action'] == 'activate' || @$_REQUEST['action'] == 'deactivate'))
319
  {
320
  $args[] = 'id';
460
  $links['support'] = '<a href="' . esc_url(BETTER_ANALYTICS_SUPPORT_URL ) . '" title="' . esc_attr( esc_html__( 'Visit Support Forum', 'better-analytics' ) ) . '">' . esc_html__( 'Support', 'better-analytics' ) . '</a>';
461
 
462
  $betterAnalyticsInternal = get_transient('ba_int');
463
+ if (DigitalPointBetterAnalytics_Helper_Api::$installed && empty($betterAnalyticsInternal['v']))
464
  {
465
  $links['verify_domain'] = '<a href="' . esc_url('https://forums.digitalpoint.com/marketplace/domain-verification#utm_source=admin_plugins&utm_medium=wordpress&utm_campaign=plugin') . '" target="_blank">' . esc_html__( 'Verify Domain', 'better-analytics' ) . '</a>';
466
  }
library/DigitalPointBetterAnalytics/Base/Pro.php CHANGED
@@ -2,11 +2,12 @@
2
 
3
  class DigitalPointBetterAnalytics_Base_Pro
4
  {
5
- public static $installed = false;
6
- public static $version = null;
7
-
8
-
9
  public static function track_blocked()
10
  {
11
  }
 
 
 
 
 
12
  }
2
 
3
  class DigitalPointBetterAnalytics_Base_Pro
4
  {
 
 
 
 
5
  public static function track_blocked()
6
  {
7
  }
8
+
9
+ public static function add_amp_analytics($analytics)
10
+ {
11
+ return $analytics;
12
+ }
13
  }
library/DigitalPointBetterAnalytics/Base/Public.php CHANGED
@@ -99,12 +99,15 @@ class DigitalPointBetterAnalytics_Base_Public
99
  add_action('wp_insert_comment', array($this, 'insert_comment'), 10, 2);
100
 
101
  add_filter('wp_mail', array($this, 'filter_mail' ), 100);
102
- add_filter('the_permalink_rss', array($this, 'fiter_rss_links' ));
103
  add_filter('the_content_feed', array($this, 'filter_rss_content' ));
104
 
105
  add_action('better_analytics_cron_minutely', array('DigitalPointBetterAnalytics_CronEntry_Jobs', 'minute' ));
106
  add_action('better_analytics_cron_hourly', array('DigitalPointBetterAnalytics_CronEntry_Jobs', 'hour' ));
107
 
 
 
 
108
  if (!is_admin())
109
  {
110
  ob_start();
@@ -298,7 +301,7 @@ class DigitalPointBetterAnalytics_Base_Public
298
  if (@$betterAnalyticsOptions['javascript']['location'] == 'header')
299
  {
300
  $currentUser = wp_get_current_user();
301
- if (!array_intersect((array)$currentUser->roles, (array)@$betterAnalyticsOptions['roles_no_track']))
302
  {
303
  $this->insert_code();
304
  }
@@ -320,7 +323,7 @@ class DigitalPointBetterAnalytics_Base_Public
320
 
321
  if (@$betterAnalyticsOptions['javascript']['location'] != 'none')
322
  {
323
- if (!array_intersect((array)$currentUser->roles, (array)@$betterAnalyticsOptions['roles_no_track']))
324
  {
325
  include(BETTER_ANALYTICS_PLUGIN_DIR . 'js/universal.php');
326
  }
@@ -443,7 +446,7 @@ class DigitalPointBetterAnalytics_Base_Public
443
  }
444
  }
445
 
446
- public function fiter_rss_links($link)
447
  {
448
  $betterAnalyticsOptions = get_option('better_analytics');
449
 
99
  add_action('wp_insert_comment', array($this, 'insert_comment'), 10, 2);
100
 
101
  add_filter('wp_mail', array($this, 'filter_mail' ), 100);
102
+ add_filter('the_permalink_rss', array($this, 'filter_rss_links' ));
103
  add_filter('the_content_feed', array($this, 'filter_rss_content' ));
104
 
105
  add_action('better_analytics_cron_minutely', array('DigitalPointBetterAnalytics_CronEntry_Jobs', 'minute' ));
106
  add_action('better_analytics_cron_hourly', array('DigitalPointBetterAnalytics_CronEntry_Jobs', 'hour' ));
107
 
108
+
109
+ add_filter('amp_post_template_analytics', array('DigitalPointBetterAnalytics_Base_Pro', 'add_amp_analytics' ));
110
+
111
  if (!is_admin())
112
  {
113
  ob_start();
301
  if (@$betterAnalyticsOptions['javascript']['location'] == 'header')
302
  {
303
  $currentUser = wp_get_current_user();
304
+ if (empty($betterAnalyticsOptions['roles_no_track']) || !array_intersect((array)$currentUser->roles, (array)@$betterAnalyticsOptions['roles_no_track']))
305
  {
306
  $this->insert_code();
307
  }
323
 
324
  if (@$betterAnalyticsOptions['javascript']['location'] != 'none')
325
  {
326
+ if (empty($betterAnalyticsOptions['roles_no_track']) || !array_intersect((array)$currentUser->roles, (array)@$betterAnalyticsOptions['roles_no_track']))
327
  {
328
  include(BETTER_ANALYTICS_PLUGIN_DIR . 'js/universal.php');
329
  }
446
  }
447
  }
448
 
449
+ public function filter_rss_links($link)
450
  {
451
  $betterAnalyticsOptions = get_option('better_analytics');
452
 
library/DigitalPointBetterAnalytics/ControllerAdmin/Analytics.php CHANGED
@@ -60,7 +60,13 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
60
  $validDimensions = $this->getDimensionsForCharts();
61
  $validMetrics = $this->getMetricsForCharts();
62
 
 
63
  $chartData = array_merge(array(array($validDimensions[$_POST['dimension']], $validMetrics[$_POST['metric']])), DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getChart(1, intval($_POST['days']), $_POST['metric'], $dimension));
 
 
 
 
 
64
  wp_send_json(array(
65
  'chart_data' => $chartData,
66
  'title' => ($dimension == 'ga:date' ? $validMetrics[$_POST['metric']] : $validDimensions[$_POST['dimension']]),
@@ -90,8 +96,6 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
90
  $_POST['page_path'] = false;
91
  }
92
 
93
-
94
-
95
  if (!DigitalPointBetterAnalytics_Helper_Api::check())
96
  {
97
  if (array_search($_POST['metric'], array('ga:users', 'ga:sessions', 'ga:hits', 'ga:organicSearches')) === false)
@@ -178,8 +182,19 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
178
  }
179
 
180
 
181
- $dateStart = date("Y-m-d", max(1104580800, time() - (86400 * ($_POST['time_frame'] + 1))));
182
- $dateEnd = date("Y-m-d", time() - (86400));
 
 
 
 
 
 
 
 
 
 
 
183
 
184
  switch ($_POST['scope'])
185
  {
@@ -194,50 +209,173 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
194
  }
195
  $originalDimension = $_POST['dimension'];
196
 
 
 
197
  if ($_POST['dimension'] == 'searchNotProvided')
198
  {
199
- $extraFilter = ';ga:medium==organic;ga:keyword==(not provided)';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  $_POST['dimension'] = 'keyword';
201
  }
202
  elseif ($_POST['dimension'] == 'oraganicSearchMarketshare')
203
  {
204
- $extraFilter = ';ga:medium==organic';
205
- $_POST['dimension'] = 'source,ga:medium';
 
 
 
 
 
 
 
 
 
 
 
206
 
207
  }
 
 
208
  elseif ($_POST['dimension'] == 'mobileOperatingSystem')
209
  {
210
- $extraFilter = ';ga:isMobile==Yes';
 
 
 
 
 
 
 
211
  $_POST['dimension'] = 'operatingSystem';
212
  }
213
  else
214
  {
215
- $extraFilter = '';
216
  }
217
 
218
  if ($_POST['page_path'])
219
  {
220
- $extraFilter .= ';ga:pagePath==' . $_POST['page_path'];
 
 
 
 
221
  }
222
 
 
 
 
 
 
 
 
 
 
 
 
223
  $cacheKey = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
224
- $dateStart,
225
- $dateEnd,
226
- 'ga:sessions', // metric
227
- 'ga:' . $scope . ',ga:' . $_POST['dimension'], // dimensions
228
- 'ga:' . $scope . ',-ga:sessions', // sort
229
- 'ga:sessions>' . $_POST['minimum'] . $extraFilter // filters
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  );
231
 
232
  if ($originalDimension == 'searchNotProvided')
233
  {
234
  $cacheKey2 = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
235
- $dateStart,
236
- $dateEnd,
237
- 'ga:sessions', // metric
238
- 'ga:' . $scope, // dimensions
239
- 'ga:' . $scope . ',-ga:sessions', // sort
240
- 'ga:sessions>' . $_POST['minimum'] . ';ga:medium==organic'// filters
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  );
242
  }
243
 
@@ -249,48 +387,72 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
249
 
250
  $totalNotProvided = $consolidated = array();
251
 
252
- if (!empty($results['rows']))
253
  {
254
- foreach ($results['rows'] as $row)
255
  {
256
- if ($row[1] == '(not provided)')
257
  {
258
- $totalNotProvided[$row[0]] = $row[2];
259
  }
260
  }
261
- foreach ($resultTotal['rows'] as $row)
 
262
  {
263
- $consolidated[] = array_merge(array($row[0]), array(__('Keywords Provided', 'better-analytics'), $row[1] - @$totalNotProvided[$row[0]]));
264
- $consolidated[] = array_merge(array($row[0]), array(__('Keywords Not Provided', 'better-analytics'), @$totalNotProvided[$row[0]] + 0));
265
- }
266
 
267
- $results['rows'] = $consolidated;
268
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
 
270
 
 
 
 
 
271
 
272
  }
273
  elseif ($originalDimension == 'oraganicSearchMarketshare')
274
  {
275
-
276
- if (!empty($results['rows']))
277
  {
278
- foreach ($results['rows'] as &$row)
279
  {
280
- $row[2] = $row[3];
281
- $row[1] = (strlen($row[1]) > 3 ? ucwords($row[1]) : strtoupper($row[1]));
282
- unset($row[3]);
283
  }
284
  }
285
  }
286
 
287
  $resultsOrdered = $resultsOutput = $allLabels = array();
288
- if (!empty($results['rows']))
289
  {
290
- foreach ($results['rows'] as $row)
291
  {
292
- $allLabels[$row[1]] = null;
293
- $resultsOrdered[$row[0]][$row[1]] = intval($row[2]);
294
  }
295
 
296
  ksort($allLabels, SORT_STRING);
@@ -301,6 +463,7 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
301
  ksort($labels, SORT_STRING);
302
  }
303
 
 
304
  $resultsOutput = array(array_merge(array('Date'), array_keys($allLabels)));
305
  foreach ($resultsOutput[0] as &$item)
306
  {
@@ -340,8 +503,6 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
340
 
341
  }
342
 
343
-
344
-
345
  $this->_view('reports/area_charts', array(
346
  'dimensions' => DigitalPointBetterAnalytics_Model_Reporting::getDimensions(),
347
  ));
@@ -368,13 +529,87 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
368
  wp_send_json(array('error' => __('Invalid number of days.', 'better-analytics')));
369
  }
370
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  $cacheKey = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
372
- $_POST['days'] . 'daysAgo',
373
- 'yesterday',
374
- 'ga:totalEvents', // metric
375
- 'ga:eventCategory,ga:eventAction,ga:eventLabel', // dimensions
376
- '-ga:totalEvents,ga:eventCategory,ga:eventAction,ga:eventLabel', // sort
377
- (!empty($_POST['page_path']) ? 'ga:pagePath==' . $_POST['page_path'] . ';' : '') . 'ga:eventCategory==Error,ga:eventCategory==Image' // filters
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  );
379
 
380
  $results = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getResults($cacheKey);
@@ -385,11 +620,13 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
385
  __('Type', 'better-analytics'),
386
  __('Detail', 'better-analytics')
387
  ));
388
- if (@$results['rows'])
 
 
389
  {
390
- foreach ($results['rows'] as $row)
391
  {
392
- $chartOutput[] = array(absint($row[3]), $row[0], $row[1], $row[2]);
393
  }
394
 
395
  wp_send_json(array(
@@ -397,6 +634,9 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
397
  ));
398
  }
399
 
 
 
 
400
  wp_send_json(array(
401
  'error' => __('No data for the criteria given', 'better-analytics')
402
  ));
@@ -426,13 +666,85 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
426
  wp_send_json(array('error' => __('Invalid number of days.', 'better-analytics')));
427
  }
428
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  $cacheKey = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
430
- $_POST['days'] . 'daysAgo',
431
- 'yesterday',
432
- 'ga:totalEvents', // metric
433
- 'ga:eventCategory,ga:eventAction,ga:eventLabel', // dimensions
434
- '-ga:totalEvents,ga:eventCategory,ga:eventAction,ga:eventLabel', // sort
435
- (!empty($_POST['page_path']) ? 'ga:pagePath==' . $_POST['page_path'] . ';' : '') . 'ga:eventCategory!=Error;ga:eventCategory!=Image' // filters
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  );
437
 
438
  $results = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getResults($cacheKey);
@@ -443,11 +755,11 @@ class DigitalPointBetterAnalytics_ControllerAdmin_Analytics
443
  __('Type', 'better-analytics'),
444
  __('Detail', 'better-analytics')
445
  ));
446
- if (@$results['rows'])
447
  {
448
- foreach ($results['rows'] as $row)
449
  {
450
- $chartOutput[] = array(absint($row[3]), $row[0], $row[1], $row[2]);
451
  }
452
 
453
  wp_send_json(array(
60
  $validDimensions = $this->getDimensionsForCharts();
61
  $validMetrics = $this->getMetricsForCharts();
62
 
63
+
64
  $chartData = array_merge(array(array($validDimensions[$_POST['dimension']], $validMetrics[$_POST['metric']])), DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getChart(1, intval($_POST['days']), $_POST['metric'], $dimension));
65
+
66
+
67
+ // print_r ($chartData);
68
+ // exit;
69
+
70
  wp_send_json(array(
71
  'chart_data' => $chartData,
72
  'title' => ($dimension == 'ga:date' ? $validMetrics[$_POST['metric']] : $validDimensions[$_POST['dimension']]),
96
  $_POST['page_path'] = false;
97
  }
98
 
 
 
99
  if (!DigitalPointBetterAnalytics_Helper_Api::check())
100
  {
101
  if (array_search($_POST['metric'], array('ga:users', 'ga:sessions', 'ga:hits', 'ga:organicSearches')) === false)
182
  }
183
 
184
 
185
+ if ($timeZoneString = get_option('timezone_string'))
186
+ {
187
+ $timeZoneString = 'GMT';
188
+ }
189
+ $timeZone = new DateTimeZone($timeZoneString);
190
+
191
+ $date = new DateTime('now', $timeZone);
192
+ $date->sub(new DateInterval('P' . intval($_POST['time_frame'] + 1) . 'D'));
193
+ $startDate = $date->format('Y-m-d');
194
+
195
+ $date = new DateTime();
196
+ $date->sub(new DateInterval('P1D'));
197
+ $endDate = $date->format('Y-m-d');
198
 
199
  switch ($_POST['scope'])
200
  {
209
  }
210
  $originalDimension = $_POST['dimension'];
211
 
212
+
213
+
214
  if ($_POST['dimension'] == 'searchNotProvided')
215
  {
216
+ $dimensionFilter = array(
217
+ array(
218
+ 'operator' => 'AND',
219
+ 'filters' => array(
220
+ array(
221
+ 'dimensionName' => 'ga:medium',
222
+ 'operator' => 'EXACT',
223
+ 'expressions' => 'organic'
224
+ ),
225
+ array(
226
+ 'dimensionName' => 'ga:keyword',
227
+ 'operator' => 'EXACT',
228
+ 'expressions' => '(not provided)'
229
+ )
230
+ )
231
+ )
232
+ );
233
+
234
  $_POST['dimension'] = 'keyword';
235
  }
236
  elseif ($_POST['dimension'] == 'oraganicSearchMarketshare')
237
  {
238
+ $dimensionFilter = array(
239
+ array(
240
+ 'filters' => array(
241
+ array(
242
+ 'dimensionName' => 'ga:medium',
243
+ 'operator' => 'EXACT',
244
+ 'expressions' => 'organic'
245
+ )
246
+ )
247
+ ),
248
+ );
249
+
250
+ $_POST['dimension'] = 'source';
251
 
252
  }
253
+
254
+ // TODO: is this being used?
255
  elseif ($_POST['dimension'] == 'mobileOperatingSystem')
256
  {
257
+ $dimensionFilter = array(
258
+ array(
259
+ 'dimensionName' => 'ga:isMobile',
260
+ 'operator' => 'EXACT',
261
+ 'expressions' => 'Yes'
262
+ ),
263
+ );
264
+
265
  $_POST['dimension'] = 'operatingSystem';
266
  }
267
  else
268
  {
269
+ $dimensionFilter = array();
270
  }
271
 
272
  if ($_POST['page_path'])
273
  {
274
+ $extraFilter[] = array(
275
+ 'dimensionName' => 'ga:pagePath',
276
+ 'operator' => 'EXACT',
277
+ 'expressions' => $_POST['page_path']
278
+ );
279
  }
280
 
281
+
282
+
283
+ $dimension = array( // dimension
284
+ array(
285
+ 'name' => 'ga:' . $scope
286
+ ),
287
+ array(
288
+ 'name' => 'ga:' . $_POST['dimension']
289
+ ),
290
+ );
291
+
292
  $cacheKey = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
293
+ $startDate,
294
+ $endDate,
295
+
296
+ array( // metric
297
+ array(
298
+ 'expression' => 'ga:sessions'
299
+ )
300
+ ),
301
+ $dimension,
302
+ array( // sort
303
+ array(
304
+ 'fieldName' => 'ga:' . $scope
305
+ ),
306
+ array(
307
+ 'fieldName' => 'ga:sessions',
308
+ 'sortOrder' => 'DESCENDING'
309
+ )
310
+ ),
311
+ $dimensionFilter,
312
+
313
+
314
+ array( // metric filters
315
+ array(
316
+ 'filters' => array(
317
+ array(
318
+ 'metricName' => 'ga:sessions',
319
+ 'operator' => 'GREATER_THAN',
320
+ 'comparisonValue' => (string)intval($_POST['minimum'])
321
+ ),
322
+ )
323
+ )
324
+ )
325
+
326
+
327
+
328
  );
329
 
330
  if ($originalDimension == 'searchNotProvided')
331
  {
332
  $cacheKey2 = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
333
+ $startDate,
334
+ $endDate,
335
+ array( // metric
336
+ array(
337
+ 'expression' => 'ga:sessions'
338
+ )
339
+ ),
340
+ array( // dimension
341
+ array(
342
+ 'name' => 'ga:' . $scope
343
+ ),
344
+ ),
345
+
346
+ array( // sort
347
+ array(
348
+ 'fieldName' => 'ga:' . $scope
349
+ ),
350
+ array(
351
+ 'fieldName' => 'ga:sessions',
352
+ 'sortOrder' => 'DESCENDING'
353
+ )
354
+ ),
355
+ array(
356
+ array(
357
+ 'filters' => array(
358
+ array(
359
+ 'dimensionName' => 'ga:medium',
360
+ 'operator' => 'EXACT',
361
+ 'expressions' => 'organic'
362
+ )
363
+ )
364
+ )
365
+ ),
366
+
367
+ array( // metric filters
368
+ array(
369
+ 'filters' => array(
370
+ // array_merge(
371
+ array(
372
+ 'metricName' => 'ga:sessions',
373
+ 'operator' => 'GREATER_THAN',
374
+ 'comparisonValue' => (string)intval($_POST['minimum'])
375
+ )
376
+ )
377
+ )
378
+ )
379
  );
380
  }
381
 
387
 
388
  $totalNotProvided = $consolidated = array();
389
 
390
+ if (!empty($results['reports'][0]['data']['rows']))
391
  {
392
+ foreach ($results['reports'][0]['data']['rows'] as $row)
393
  {
394
+ if ($row['dimensions'][1] == '(not provided)')
395
  {
396
+ $totalNotProvided[$row['dimensions'][0]] = $row['metrics'][0]['values'][0];
397
  }
398
  }
399
+
400
+ foreach ($resultTotal['reports'][0]['data']['rows'] as $row)
401
  {
 
 
 
402
 
403
+ $consolidated[] = array(
404
+ 'dimensions' => array(
405
+ $row['dimensions'][0],
406
+ __('Keywords Provided', 'better-analytics')
407
+ ),
408
+ 'metrics' => array(
409
+ array(
410
+ 'values' => array(
411
+ $row['metrics'][0]['values'][0] - @$totalNotProvided[$row['dimensions'][0]]
412
+ )
413
+ )
414
+ )
415
+ );
416
+
417
+ $consolidated[] = array(
418
+ 'dimensions' => array(
419
+ $row['dimensions'][0],
420
+ __('Keywords Not Provided', 'better-analytics')
421
+ ),
422
+ 'metrics' => array(
423
+ array(
424
+ 'values' => array(
425
+ @$totalNotProvided[$row['dimensions'][0]] + 0
426
+ )
427
+ )
428
+ )
429
+ );
430
 
431
 
432
+ }
433
+
434
+ $results['reports'][0]['data']['rows'] = $consolidated;
435
+ }
436
 
437
  }
438
  elseif ($originalDimension == 'oraganicSearchMarketshare')
439
  {
440
+ if (!empty($results['reports'][0]['data']['rows']))
 
441
  {
442
+ foreach ($results['reports'][0]['data']['rows'] as &$row)
443
  {
444
+ $row['dimensions'][1] = (strlen($row['dimensions'][1]) > 3 ? ucwords($row['dimensions'][1]) : strtoupper($row['dimensions'][1]));
 
 
445
  }
446
  }
447
  }
448
 
449
  $resultsOrdered = $resultsOutput = $allLabels = array();
450
+ if (!empty($results['reports'][0]['data']['rows']))
451
  {
452
+ foreach ($results['reports'][0]['data']['rows'] as $row)
453
  {
454
+ $allLabels[$row['dimensions'][1]] = null;
455
+ $resultsOrdered[$row['dimensions'][0]][$row['dimensions'][1]] = intval($row['metrics'][0]['values'][0]);
456
  }
457
 
458
  ksort($allLabels, SORT_STRING);
463
  ksort($labels, SORT_STRING);
464
  }
465
 
466
+
467
  $resultsOutput = array(array_merge(array('Date'), array_keys($allLabels)));
468
  foreach ($resultsOutput[0] as &$item)
469
  {
503
 
504
  }
505
 
 
 
506
  $this->_view('reports/area_charts', array(
507
  'dimensions' => DigitalPointBetterAnalytics_Model_Reporting::getDimensions(),
508
  ));
529
  wp_send_json(array('error' => __('Invalid number of days.', 'better-analytics')));
530
  }
531
 
532
+ if ($timeZoneString = get_option('timezone_string'))
533
+ {
534
+ $timeZoneString = 'GMT';
535
+ }
536
+ $timeZone = new DateTimeZone($timeZoneString);
537
+
538
+ $date = new DateTime('now', $timeZone);
539
+ $date->sub(new DateInterval('P' . intval($_POST['days'] + 1) . 'D'));
540
+ $startDate = $date->format('Y-m-d');
541
+
542
+ $date = new DateTime();
543
+ $date->sub(new DateInterval('P1D'));
544
+ $endDate = $date->format('Y-m-d');
545
+
546
+ $dimensionFilter = array(
547
+ array(
548
+ 'operator' => 'OR',
549
+ 'filters' => array(
550
+ array(
551
+ 'dimensionName' => 'ga:eventCategory',
552
+ 'operator' => 'EXACT',
553
+ 'expressions' => 'Error'
554
+ ),
555
+ array(
556
+ 'dimensionName' => 'ga:eventCategory',
557
+ 'operator' => 'EXACT',
558
+ 'expressions' => 'Image'
559
+ )
560
+ )
561
+ )
562
+ );
563
+
564
+ if (!empty($_POST['page_path']))
565
+ {
566
+ $dimensionFilter[] = array (
567
+ 'operator' => 'AND',
568
+ 'filters' => array(
569
+ array(
570
+ 'dimensionName' => 'ga:pagePath',
571
+ 'operator' => 'EXACT',
572
+ 'expressions' => $_POST['page_path']
573
+ )
574
+ )
575
+ );
576
+ }
577
+
578
  $cacheKey = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
579
+ $startDate,
580
+ $endDate,
581
+ array( // metric
582
+ array(
583
+ 'expression' => 'ga:totalEvents'
584
+ )
585
+ ),
586
+ array( // dimension
587
+ array(
588
+ 'name' => 'ga:eventCategory'
589
+ ),
590
+ array(
591
+ 'name' => 'ga:eventAction'
592
+ ),
593
+ array(
594
+ 'name' => 'ga:eventLabel'
595
+ )
596
+ ),
597
+ array( // sort
598
+ array(
599
+ 'fieldName' => 'ga:totalEvents',
600
+ 'sortOrder' => 'DESCENDING'
601
+ ),
602
+ array(
603
+ 'fieldName' => 'ga:eventCategory',
604
+ ),
605
+ array(
606
+ 'fieldName' => 'ga:eventAction',
607
+ ),
608
+ array(
609
+ 'fieldName' => 'ga:eventLabel',
610
+ )
611
+ ),
612
+ $dimensionFilter // dimension filters
613
  );
614
 
615
  $results = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getResults($cacheKey);
620
  __('Type', 'better-analytics'),
621
  __('Detail', 'better-analytics')
622
  ));
623
+
624
+
625
+ if (!empty($results['reports'][0]['data']['rows']))
626
  {
627
+ foreach ($results['reports'][0]['data']['rows'] as $row)
628
  {
629
+ $chartOutput[] = array(absint($row['metrics'][0]['values'][0]), $row['dimensions'][0], $row['dimensions'][1], $row['dimensions'][2]);
630
  }
631
 
632
  wp_send_json(array(
634
  ));
635
  }
636
 
637
+
638
+
639
+
640
  wp_send_json(array(
641
  'error' => __('No data for the criteria given', 'better-analytics')
642
  ));
666
  wp_send_json(array('error' => __('Invalid number of days.', 'better-analytics')));
667
  }
668
 
669
+
670
+ if ($timeZoneString = get_option('timezone_string'))
671
+ {
672
+ $timeZoneString = 'GMT';
673
+ }
674
+ $timeZone = new DateTimeZone($timeZoneString);
675
+
676
+ $date = new DateTime('now', $timeZone);
677
+ $date->sub(new DateInterval('P' . intval($_POST['days'] + 1) . 'D'));
678
+ $startDate = $date->format('Y-m-d');
679
+
680
+ $date = new DateTime();
681
+ $date->sub(new DateInterval('P1D'));
682
+ $endDate = $date->format('Y-m-d');
683
+
684
+ $dimensionFilter = array(
685
+ array(
686
+ 'operator' => 'AND',
687
+ 'filters' => array(
688
+ array(
689
+ 'dimensionName' => 'ga:eventCategory',
690
+ 'not' => true,
691
+ 'operator' => 'EXACT',
692
+ 'expressions' => 'Error'
693
+ ),
694
+ array(
695
+ 'dimensionName' => 'ga:eventCategory',
696
+ 'not' => true,
697
+ 'operator' => 'EXACT',
698
+ 'expressions' => 'Image'
699
+ )
700
+ )
701
+ )
702
+ );
703
+
704
+ if (!empty($_POST['page_path']))
705
+ {
706
+ $dimensionFilter[0]['filters'][] = array(
707
+ 'dimensionName' => 'ga:pagePath',
708
+ 'operator' => 'EXACT',
709
+ 'expressions' => $_POST['page_path']
710
+ );
711
+ }
712
+
713
  $cacheKey = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
714
+ $startDate,
715
+ $endDate,
716
+ array( // metric
717
+ array(
718
+ 'expression' => 'ga:totalEvents'
719
+ )
720
+ ),
721
+ array( // dimension
722
+ array(
723
+ 'name' => 'ga:eventCategory'
724
+ ),
725
+ array(
726
+ 'name' => 'ga:eventAction'
727
+ ),
728
+ array(
729
+ 'name' => 'ga:eventLabel'
730
+ )
731
+ ),
732
+ array( // sort
733
+ array(
734
+ 'fieldName' => 'ga:totalEvents',
735
+ 'sortOrder' => 'DESCENDING'
736
+ ),
737
+ array(
738
+ 'fieldName' => 'ga:eventCategory',
739
+ ),
740
+ array(
741
+ 'fieldName' => 'ga:eventAction',
742
+ ),
743
+ array(
744
+ 'fieldName' => 'ga:eventLabel',
745
+ )
746
+ ),
747
+ $dimensionFilter // dimension filters
748
  );
749
 
750
  $results = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getResults($cacheKey);
755
  __('Type', 'better-analytics'),
756
  __('Detail', 'better-analytics')
757
  ));
758
+ if (!empty($results['reports'][0]['data']['rows']))
759
  {
760
+ foreach ($results['reports'][0]['data']['rows'] as $row)
761
  {
762
+ $chartOutput[] = array(absint($row['metrics'][0]['values'][0]), $row['dimensions'][0], $row['dimensions'][1], $row['dimensions'][2]);
763
  }
764
 
765
  wp_send_json(array(
library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php CHANGED
@@ -55,7 +55,7 @@ class DigitalPointBetterAnalytics_Formatting_ExperimentTable extends WP_List_Tab
55
  }
56
 
57
  // because this isn't hacky, right? lol
58
- if (in_array(@$_GET['action'], array('start', 'end', 'delete')) !== false)
59
  {
60
  $_SERVER['REQUEST_URI'] = remove_query_arg(array('id', 'action', '_wpnonce'), $_SERVER['REQUEST_URI']);
61
  }
55
  }
56
 
57
  // because this isn't hacky, right? lol
58
+ if (!empty($_GET['action']) && in_array($_GET['action'], array('start', 'end', 'delete')) !== false)
59
  {
60
  $_SERVER['REQUEST_URI'] = remove_query_arg(array('id', 'action', '_wpnonce'), $_SERVER['REQUEST_URI']);
61
  }
library/DigitalPointBetterAnalytics/Formatting/GoalTable.php CHANGED
@@ -32,7 +32,7 @@ class DigitalPointBetterAnalytics_Formatting_GoalTable extends WP_List_Table
32
  }
33
 
34
  // because this isn't hacky, right? lol
35
- if (@$_GET['action'] == 'activate' || @$_GET['action'] == 'deactivate')
36
  {
37
  $_SERVER['REQUEST_URI'] = remove_query_arg(array('id', 'action', '_wpnonce'), $_SERVER['REQUEST_URI']);
38
  }
@@ -250,7 +250,7 @@ class DigitalPointBetterAnalytics_Formatting_GoalTable extends WP_List_Table
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
  }
32
  }
33
 
34
  // because this isn't hacky, right? lol
35
+ if (!empty($_GET['action']) && ($_GET['action'] == 'activate' || $_GET['action'] == 'deactivate'))
36
  {
37
  $_SERVER['REQUEST_URI'] = remove_query_arg(array('id', 'action', '_wpnonce'), $_SERVER['REQUEST_URI']);
38
  }
250
  return $this->row_actions( $actions );
251
  }
252
 
253
+ protected function row_actions($actions, $always_visible = false)
254
  {
255
  return '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
256
  }
library/DigitalPointBetterAnalytics/Helper/Api.php CHANGED
@@ -2,6 +2,10 @@
2
 
3
  class DigitalPointBetterAnalytics_Helper_Api
4
  {
 
 
 
 
5
  public static function check($force = false)
6
  {
7
  $betterAnalyticsInternal = get_transient('ba_int');
2
 
3
  class DigitalPointBetterAnalytics_Helper_Api
4
  {
5
+ public static $installed = false;
6
+
7
+ public static $version = null;
8
+
9
  public static function check($force = false)
10
  {
11
  $betterAnalyticsInternal = get_transient('ba_int');
library/DigitalPointBetterAnalytics/Helper/Reporting.php CHANGED
@@ -128,15 +128,30 @@ class DigitalPointBetterAnalytics_Helper_Reporting extends DigitalPointBetterAna
128
  $this->_urlInfo['params'] = $params;
129
  }
130
 
131
- protected function _execHandlerAction($action = 'POST')
132
  {
133
  if ($action == 'POST')
134
  {
135
- $response = wp_remote_post($this->_urlInfo['url'],
136
- array(
 
 
 
 
 
 
 
 
 
 
137
  'body' => $this->_urlInfo['params']
138
- )
 
 
 
 
139
  );
 
140
  }
141
  elseif($action == 'INSERT')
142
  {
@@ -202,10 +217,9 @@ class DigitalPointBetterAnalytics_Helper_Reporting extends DigitalPointBetterAna
202
 
203
  protected function _cacheSave($cacheKey, $data, $minutes)
204
  {
205
- if (!empty($data['id']) || !empty($data['totalResults']))
206
  {
207
  set_transient($cacheKey, $data, intval($minutes * 60));
208
-
209
  self::$_cachedResults[$cacheKey] = $data;
210
  }
211
  elseif (!empty($data['error']['message']))
128
  $this->_urlInfo['params'] = $params;
129
  }
130
 
131
+ protected function _execHandlerAction($action = 'POST', $json = false)
132
  {
133
  if ($action == 'POST')
134
  {
135
+ if ($json)
136
+ {
137
+ $params = array(
138
+ 'method' => 'POST',
139
+ 'body' => json_encode($this->_urlInfo['params']),
140
+ 'headers' => array('Content-Type' => 'application/json'),
141
+ );
142
+ }
143
+ else
144
+ {
145
+ $params = array(
146
+ 'method' => 'POST',
147
  'body' => $this->_urlInfo['params']
148
+ );
149
+ }
150
+
151
+ $response = wp_remote_request($this->_urlInfo['url'],
152
+ $params
153
  );
154
+
155
  }
156
  elseif($action == 'INSERT')
157
  {
217
 
218
  protected function _cacheSave($cacheKey, $data, $minutes)
219
  {
220
+ if (!empty($data['id']) || !empty($data['totalResults']) || !empty($data['reports'][0]['data']['rowCount']))
221
  {
222
  set_transient($cacheKey, $data, intval($minutes * 60));
 
223
  self::$_cachedResults[$cacheKey] = $data;
224
  }
225
  elseif (!empty($data['error']['message']))
library/DigitalPointBetterAnalytics/Helper/Reporting/Abstract.php CHANGED
@@ -5,7 +5,10 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
5
  protected static $_instance;
6
 
7
  protected static $_oAuthEndpoint = 'https://accounts.google.com/o/oauth2/';
8
- protected static $_dataEndpoint = 'https://www.googleapis.com/analytics/v3/data/ga';
 
 
 
9
  protected static $_realtimeEndpoint = 'https://www.googleapis.com/analytics/v3/data/realtime';
10
 
11
  protected static $_accountsEndpoint = 'https://www.googleapis.com/analytics/v3/management/accounts';
@@ -88,7 +91,7 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
88
 
89
  abstract protected function _setParamsAction($params);
90
 
91
- abstract protected function _execHandlerAction($action = 'POST');
92
 
93
  abstract protected function _cacheLoad($cacheKey);
94
 
@@ -116,7 +119,7 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
116
  'client_secret' => $this->_getOption('apiClientSecret'),
117
  'grant_type' => 'authorization_code'
118
  ));
119
- return json_decode($this->_execHandlerAction());
120
  }
121
 
122
  public function overrideTokens($tokens)
@@ -154,7 +157,7 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
154
  'grant_type' => 'refresh_token',
155
  'refresh_token' => $tokens->refresh_token
156
  ));
157
- $response = json_decode($this->_execHandlerAction());
158
 
159
  if (!empty($response->error) && $response->error == 'unauthorized_client')
160
  {
@@ -651,14 +654,134 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
651
  {
652
  $filters = null;
653
 
 
 
654
  if (strpos($metric, '|'))
655
  {
656
  $split = explode('|', $metric);
657
  $metric = $split[0];
658
  $filters = $split[1];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  }
660
 
661
- $cacheKey = $this->getData(($endDaysAgo + ($weeks * 7) - 1) . 'daysAgo', $endDaysAgo . 'daysAgo', $metric, 'ga:hour,ga:dayOfWeek', 'ga:hour,ga:dayOfWeek', $filters, $segment);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
662
  $data = $this->getResults($cacheKey);
663
 
664
  $preparedData = array();
@@ -668,11 +791,11 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
668
  $preparedData[$i] = array_fill(0, 7, 0);
669
  }
670
 
671
- if (!empty($data['rows']))
672
  {
673
- foreach ($data['rows'] as &$row)
674
  {
675
- $preparedData[intval($row[0])][intval($row[1])] = intval($row[2]);
676
  }
677
  }
678
 
@@ -681,6 +804,172 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
681
 
682
 
683
  public function getChart($endDaysAgo, $days, $metric, $dimension, $segment = null)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684
  {
685
  $filters = null;
686
 
@@ -724,66 +1013,106 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
724
 
725
  return $outputData;
726
  }
 
727
 
728
 
729
 
730
- public function getData($startDate, $endDate, $metrics, $dimensions = null, $sort = null, $filters = null, $segment = null, $samplingLevel = null, $maxResults = 10000, $output = 'json', $userIp = null)
731
  {
732
- $profile = $this->_getOption('apiProfile');
733
- $cacheKey = 'ba_data_' . md5($profile . ' ' . $startDate . ' ' . $endDate . ' ' . $metrics . ' ' . $dimensions . ' ' . $sort . ' ' . $filters . ' ' . $segment . ' ' . $samplingLevel . ' ' . $maxResults . ' ' . $output);
 
 
 
 
 
 
 
 
 
 
 
 
734
 
735
- if (!$data = $this->_cacheLoad($cacheKey))
 
 
 
 
 
 
736
  {
737
  $tokens = $this->checkAccessToken();
738
 
739
- $this->_getHandler(self::$_dataEndpoint);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
740
 
741
  $params = array(
742
- 'ids' => 'ga:' . $profile,
743
- 'start-date' => $startDate,
744
- 'end-date' => $endDate,
 
 
 
 
745
  'metrics' => $metrics,
746
- 'max-results' => $maxResults,
747
- 'output' => $output,
748
- 'access_token' => $tokens->access_token
749
  );
750
 
 
 
 
751
  if (!empty($dimensions))
752
  {
753
  $params['dimensions'] = $dimensions;
754
  }
755
 
756
- if (!empty($sort))
757
  {
758
- $params['sort'] = $sort;
759
  }
760
 
761
- if (!empty($filters))
762
  {
763
- $params['filters'] = $filters;
764
  }
765
 
766
- if (!empty($segment))
767
  {
768
- $params['segment'] = $segment;
769
  }
770
 
771
- if (!empty($samplingLevel))
772
- {
773
- $params['samplingLevel'] = $samplingLevel;
774
- }
775
 
776
- if (!empty($userIp))
777
  {
778
- $params['userIp'] = $userIp;
779
  }
780
- elseif (!empty($_SERVER['REMOTE_ADDR']))
 
781
  {
782
- $params['userIp'] = $_SERVER['REMOTE_ADDR'];
783
  }
784
 
785
- $this->_setParams($params);
786
- $this->_execHandler($cacheKey);
 
 
 
 
 
787
  }
788
 
789
  return $cacheKey;
@@ -823,7 +1152,7 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
823
  }
824
 
825
  $this->_setParams($params);
826
- $this->_execHandler($cacheKey);
827
  //}
828
 
829
  return $cacheKey;
@@ -870,16 +1199,19 @@ abstract class DigitalPointBetterAnalytics_Helper_Reporting_Abstract
870
 
871
  protected function _setParams(array $params)
872
  {
873
- $params['v'] = 1;
874
- $params['ds'] = 'server side';
875
 
876
  $this->_setParamsAction($params);
877
  }
878
 
879
 
880
- protected function _execHandler($cacheKey)
881
  {
882
- $this->_currentHandle = $this->_execHandlerAction('GET');
 
 
 
883
 
884
  $this->_hasError($this->_currentHandle);
885
 
5
  protected static $_instance;
6
 
7
  protected static $_oAuthEndpoint = 'https://accounts.google.com/o/oauth2/';
8
+ // TODO: delete -- protected static $_dataEndpoint = 'https://www.googleapis.com/analytics/v3/data/ga';
9
+
10
+ protected static $_dataEndpoint = 'https://analyticsreporting.googleapis.com/v4/reports:batchGet';
11
+
12
  protected static $_realtimeEndpoint = 'https://www.googleapis.com/analytics/v3/data/realtime';
13
 
14
  protected static $_accountsEndpoint = 'https://www.googleapis.com/analytics/v3/management/accounts';
91
 
92
  abstract protected function _setParamsAction($params);
93
 
94
+ abstract protected function _execHandlerAction($action = 'POST', $json = false);
95
 
96
  abstract protected function _cacheLoad($cacheKey);
97
 
119
  'client_secret' => $this->_getOption('apiClientSecret'),
120
  'grant_type' => 'authorization_code'
121
  ));
122
+ return json_decode($this->_execHandlerAction('POST', false));
123
  }
124
 
125
  public function overrideTokens($tokens)
157
  'grant_type' => 'refresh_token',
158
  'refresh_token' => $tokens->refresh_token
159
  ));
160
+ $response = json_decode($this->_execHandlerAction('POST', false));
161
 
162
  if (!empty($response->error) && $response->error == 'unauthorized_client')
163
  {
654
  {
655
  $filters = null;
656
 
657
+ $filterArray = array();
658
+
659
  if (strpos($metric, '|'))
660
  {
661
  $split = explode('|', $metric);
662
  $metric = $split[0];
663
  $filters = $split[1];
664
+ $filtersRaw = explode(';', $filters);
665
+
666
+ if (!empty($filtersRaw))
667
+ {
668
+ foreach($filtersRaw as $filterRaw)
669
+ {
670
+ $split = explode('==', $filterRaw);
671
+
672
+ $filterArray[] = array(
673
+ 'dimensionName' => $split[0],
674
+ 'operator' => 'EXACT',
675
+ 'expressions' => array($split[1])
676
+ );
677
+ }
678
+ }
679
+ }
680
+
681
+ if ($timeZoneString = get_option('timezone_string'))
682
+ {
683
+ $timeZoneString = 'GMT';
684
+ }
685
+ $timeZone = new DateTimeZone($timeZoneString);
686
+
687
+ $date = new DateTime('now', $timeZone);
688
+ $date->sub(new DateInterval('P' . intval($endDaysAgo + ($weeks * 7) - 1) . 'D'));
689
+ $startDate = $date->format('Y-m-d');
690
+
691
+ $date = new DateTime();
692
+ $date->sub(new DateInterval('P' . intval($endDaysAgo) . 'D'));
693
+ $endDate = $date->format('Y-m-d');
694
+
695
+
696
+ $segments = array();
697
+
698
+ if (!empty($segment)) {
699
+
700
+ if (substr($segment, 0, 6) == 'gaid::')
701
+ {
702
+ $segments[] = array
703
+ (
704
+ 'segmentId' => $segment
705
+ );
706
+ }
707
+ elseif (substr($segment, 0, 9) == 'dynamic::')
708
+ {
709
+ if (preg_match('#dynamic::(.*?)==(.*)#', $segment, $matches))
710
+ {
711
+ $segments[] = array (
712
+ 'dynamicSegment' => array (
713
+ 'name' => $matches[1],
714
+ 'sessionSegment' => array (
715
+ 'segmentFilters' => array (
716
+ array (
717
+ 'simpleSegment' => array (
718
+ 'orFiltersForSegment' => array
719
+ (
720
+ array (
721
+ 'segmentFilterClauses' => array (
722
+ array (
723
+ 'dimensionFilter' => array (
724
+ 'dimensionName' => $matches[1],
725
+ 'operator' => 'EXACT',
726
+ 'expressions' => $matches[2]
727
+ )
728
+ )
729
+ )
730
+ )
731
+ )
732
+ )
733
+ )
734
+ )
735
+ )
736
+ )
737
+ );
738
+ }
739
+ }
740
+ }
741
+
742
+
743
+
744
+
745
+ $dimensions = array(
746
+ array(
747
+ 'name' => 'ga:hour'
748
+ ),
749
+ array(
750
+ 'name' => 'ga:dayOfWeek'
751
+ ),
752
+ );
753
+
754
+ if ($segment)
755
+ {
756
+ $dimensions[] = array('name' => 'ga:segment');
757
  }
758
 
759
+ $cacheKey = $this->getData(
760
+ $startDate,
761
+ $endDate,
762
+ array(
763
+ array(
764
+ 'expression' => $metric
765
+ )
766
+ ),
767
+ $dimensions,
768
+ array(
769
+ array(
770
+ 'fieldName' => 'ga:hour'
771
+ ),
772
+ array(
773
+ 'fieldName' => 'ga:dayOfWeek'
774
+ )
775
+ ),
776
+ array(
777
+ array(
778
+ 'filters' => $filterArray
779
+ )
780
+ ),
781
+ array(),
782
+ $segments
783
+ );
784
+
785
  $data = $this->getResults($cacheKey);
786
 
787
  $preparedData = array();
791
  $preparedData[$i] = array_fill(0, 7, 0);
792
  }
793
 
794
+ if (!empty($data['reports'][0]['data']['rows']))
795
  {
796
+ foreach ($data['reports'][0]['data']['rows'] as &$row)
797
  {
798
+ $preparedData[intval($row['dimensions'][0])][intval($row['dimensions'][1])] = round($row['metrics'][0]['values'][0], 3);
799
  }
800
  }
801
 
804
 
805
 
806
  public function getChart($endDaysAgo, $days, $metric, $dimension, $segment = null)
807
+ {
808
+
809
+ $filters = null;
810
+
811
+ $filterArray = array();
812
+
813
+ if (strpos($metric, '|'))
814
+ {
815
+ $split = explode('|', $metric);
816
+ $metric = $split[0];
817
+ $filters = $split[1];
818
+ $filtersRaw = explode(';', $filters);
819
+
820
+ if (!empty($filtersRaw))
821
+ {
822
+ foreach($filtersRaw as $filterRaw)
823
+ {
824
+ $split = explode('==', $filterRaw);
825
+
826
+ $filterArray[] = array(
827
+ 'dimensionName' => $split[0],
828
+ 'operator' => 'EXACT',
829
+ 'expressions' => array($split[1])
830
+ );
831
+ }
832
+ }
833
+ }
834
+
835
+ if ($timeZoneString = get_option('timezone_string'))
836
+ {
837
+ $timeZoneString = 'GMT';
838
+ }
839
+ $timeZone = new DateTimeZone($timeZoneString);
840
+
841
+ $date = new DateTime('now', $timeZone);
842
+ $date->sub(new DateInterval('P' . intval($endDaysAgo + $days - 1) . 'D'));
843
+ $startDate = $date->format('Y-m-d');
844
+
845
+ $date = new DateTime();
846
+ $date->sub(new DateInterval('P' . intval($endDaysAgo) . 'D'));
847
+ $endDate = $date->format('Y-m-d');
848
+
849
+
850
+ $segments = array();
851
+
852
+ if (!empty($segment)) {
853
+
854
+ if (substr($segment, 0, 6) == 'gaid::')
855
+ {
856
+ $segments[] = array
857
+ (
858
+ 'segmentId' => $segment
859
+ );
860
+ }
861
+ elseif (substr($segment, 0, 9) == 'dynamic::')
862
+ {
863
+ if (preg_match('#dynamic::(.*?)==(.*)#', $segment, $matches))
864
+ {
865
+ $segments[] = array (
866
+ 'dynamicSegment' => array (
867
+ 'name' => $matches[1],
868
+ 'sessionSegment' => array (
869
+ 'segmentFilters' => array (
870
+ array (
871
+ 'simpleSegment' => array (
872
+ 'orFiltersForSegment' => array
873
+ (
874
+ array (
875
+ 'segmentFilterClauses' => array (
876
+ array (
877
+ 'dimensionFilter' => array (
878
+ 'dimensionName' => $matches[1],
879
+ 'operator' => 'EXACT',
880
+ 'expressions' => $matches[2]
881
+ )
882
+ )
883
+ )
884
+ )
885
+ )
886
+ )
887
+ )
888
+ )
889
+ )
890
+ )
891
+ );
892
+ }
893
+ }
894
+ }
895
+
896
+
897
+
898
+
899
+ $dimensions = array(
900
+ array(
901
+ 'name' => $dimension
902
+ ),
903
+ );
904
+
905
+ if ($segment)
906
+ {
907
+ $dimensions[] = array('name' => 'ga:segment');
908
+ }
909
+
910
+ $cacheKey = $this->getData(
911
+ $startDate,
912
+ $endDate,
913
+ array(
914
+ array(
915
+ 'expression' => $metric
916
+ )
917
+ ),
918
+ $dimensions,
919
+ array(
920
+ array(
921
+ 'fieldName' => ($dimension == 'ga:date' ? $dimension : $metric),
922
+ 'sortOrder' => ($dimension == 'ga:date' ? 'ASCENDING' : 'DESCENDING')
923
+ ),
924
+ ),
925
+ array(
926
+ array(
927
+ 'filters' => $filterArray
928
+ )
929
+ ),
930
+ array(),
931
+ $segments
932
+ );
933
+
934
+ $data = $this->getResults($cacheKey);
935
+
936
+ $chartData = $outputData = array();
937
+ if (!empty($data['reports'][0]['data']['rows']))
938
+ {
939
+ foreach($data['reports'][0]['data']['rows'] as $row)
940
+ {
941
+ $split = explode(',', (string)$row['dimensions'][0]);
942
+
943
+ foreach ($split as $name)
944
+ {
945
+ $name = trim($name);
946
+ if (empty($chartData[$name]))
947
+ {
948
+ $chartData[$name] = 0;
949
+ }
950
+ $chartData[$name] += (float)$row['metrics'][0]['values'][0];
951
+ }
952
+ }
953
+ }
954
+
955
+ if ($chartData)
956
+ {
957
+ if ($dimension != 'ga:date')
958
+ {
959
+ arsort($chartData);
960
+ }
961
+
962
+ foreach ($chartData as $name => $value)
963
+ {
964
+ $outputData[] = array((string)$name, $value);
965
+ }
966
+ }
967
+
968
+ return $outputData;
969
+ }
970
+
971
+ /*
972
+ public function getChartOld($endDaysAgo, $days, $metric, $dimension, $segment = null)
973
  {
974
  $filters = null;
975
 
1013
 
1014
  return $outputData;
1015
  }
1016
+ */
1017
 
1018
 
1019
 
1020
+ public function getData($startDate, $endDate, $metrics, array $dimensions = array(), array $orderBys = array(), array $dimensionFilterClauses = array(), array $metricFilterClauses = array(), array $segments = array(), $samplingLevel = null, $pageSize = 10000, $output = 'json', $quotaUser = null)
1021
  {
1022
+ $viewId = $this->_getOption('apiProfile');
1023
+
1024
+ $cacheKey = 'ba_data_' . md5(json_encode(array(
1025
+ $startDate,
1026
+ $endDate,
1027
+ $metrics,
1028
+ $dimensions,
1029
+ $orderBys,
1030
+ $dimensionFilterClauses,
1031
+ $segments,
1032
+ $samplingLevel,
1033
+ $pageSize,
1034
+ $output
1035
+ )));
1036
 
1037
+ $data = $this->_cacheLoad($cacheKey);
1038
+ // $data = false;
1039
+
1040
+
1041
+
1042
+
1043
+ if (!$data)
1044
  {
1045
  $tokens = $this->checkAccessToken();
1046
 
1047
+ $standardParams = array(
1048
+ 'access_token' => $tokens->access_token,
1049
+ 'alt' => $output,
1050
+ );
1051
+
1052
+ if (!empty($quotaUser))
1053
+ {
1054
+ $standardParams['quotaUser'] = $quotaUser;
1055
+ }
1056
+ elseif (!empty($_SERVER['REMOTE_ADDR']))
1057
+ {
1058
+ $standardParams['quotaUser'] = $_SERVER['REMOTE_ADDR'];
1059
+ }
1060
+
1061
+ $this->_getHandler(self::$_dataEndpoint . '?' . http_build_query($standardParams));
1062
 
1063
  $params = array(
1064
+ 'viewId' => $viewId,
1065
+ 'dateRanges' => array(
1066
+ array(
1067
+ 'startDate' => $startDate,
1068
+ 'endDate' => $endDate,
1069
+ ),
1070
+ ),
1071
  'metrics' => $metrics,
1072
+ 'pageSize' => $pageSize,
 
 
1073
  );
1074
 
1075
+
1076
+
1077
+
1078
  if (!empty($dimensions))
1079
  {
1080
  $params['dimensions'] = $dimensions;
1081
  }
1082
 
1083
+ if (!empty($orderBys))
1084
  {
1085
+ $params['orderBys'] = $orderBys;
1086
  }
1087
 
1088
+ if (!empty($dimensionFilterClauses))
1089
  {
1090
+ $params['dimensionFilterClauses'] = $dimensionFilterClauses;
1091
  }
1092
 
1093
+ if (!empty($metricFilterClauses))
1094
  {
1095
+ $params['metricFilterClauses'] = $metricFilterClauses;
1096
  }
1097
 
 
 
 
 
1098
 
1099
+ if (!empty($segments))
1100
  {
1101
+ $params['segments'] = $segments;
1102
  }
1103
+
1104
+ if (!empty($samplingLevel))
1105
  {
1106
+ $params['samplingLevel'] = $samplingLevel;
1107
  }
1108
 
1109
+ $this->_setParams(
1110
+ array(
1111
+ 'reportRequests' => $params
1112
+ )
1113
+ , true
1114
+ );
1115
+ $this->_execHandler($cacheKey, 'POST');
1116
  }
1117
 
1118
  return $cacheKey;
1152
  }
1153
 
1154
  $this->_setParams($params);
1155
+ $this->_execHandler($cacheKey, 'GET');
1156
  //}
1157
 
1158
  return $cacheKey;
1199
 
1200
  protected function _setParams(array $params)
1201
  {
1202
+ //$params['v'] = 1;
1203
+ //$params['ds'] = 'server side';
1204
 
1205
  $this->_setParamsAction($params);
1206
  }
1207
 
1208
 
1209
+ protected function _execHandler($cacheKey, $method = 'GET')
1210
  {
1211
+
1212
+ $json = ($method == 'POST');
1213
+
1214
+ $this->_currentHandle = $this->_execHandlerAction($method, $json);
1215
 
1216
  $this->_hasError($this->_currentHandle);
1217
 
library/DigitalPointBetterAnalytics/Model/Reporting.php CHANGED
@@ -173,22 +173,46 @@ class DigitalPointBetterAnalytics_Model_Reporting
173
  __('User', 'better-analytics') => array(
174
  'userType' => __('User Type', 'better-analytics'),
175
  'sessionCount' => __('Session Count', 'better-analytics'),
176
- 'daysSinceLastSession' => __('Days Since Last Visit', 'better-analytics'),
177
  ),
178
  __('Session', 'better-analytics') => array(
179
  'sessionDurationBucket' => __('Session Duration', 'better-analytics'),
180
  ),
181
  __('Traffic Sources', 'better-analytics') => array(
 
 
182
  'campaign' => __('Campaign', 'better-analytics'),
183
  'source' => __('Source', 'better-analytics'),
184
  'medium' => __('Medium', 'better-analytics'),
 
185
  'keyword' => __('Keyword', 'better-analytics'),
186
  'socialNetwork' => __('Social Network', 'better-analytics'),
 
187
  'searchNotProvided' => __('Search Keywords Provided', 'better-analytics'),
188
  'oraganicSearchMarketshare' => __('Organic Search Marketshare', 'better-analytics'),
189
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  __('Platform', 'better-analytics') => array(
191
  'browser' => __('Browser', 'better-analytics'),
 
192
  'operatingSystem' => __('Operating System', 'better-analytics'),
193
  'operatingSystemVersion' => __('Operating System Version', 'better-analytics'),
194
  'mobileDeviceBranding' => __('Mobile Device Branding', 'better-analytics'),
@@ -197,13 +221,18 @@ class DigitalPointBetterAnalytics_Model_Reporting
197
  'mobileDeviceInfo' => __('Mobile Device Info', 'better-analytics'),
198
  'mobileDeviceMarketingName' => __('Mobile Device Marketing Name', 'better-analytics'),
199
  'deviceCategory' => __('Device Category', 'better-analytics'),
 
 
200
  ),
201
  __('Geo / Network', 'better-analytics') => array(
202
  'continent' => __('Continent', 'better-analytics'),
203
  'subContinent' => __('Sub-Continent', 'better-analytics'),
204
  'country' => __('Country', 'better-analytics'),
205
  'region' => __('Region', 'better-analytics'),
 
206
  'city' => __('City', 'better-analytics'),
 
 
207
  ),
208
  __('System', 'better-analytics') => array(
209
  'flashVersion' => __('Flash Version', 'better-analytics'),
@@ -214,6 +243,10 @@ class DigitalPointBetterAnalytics_Model_Reporting
214
  ),
215
  __('Page Tracking', 'better-analytics') => array(
216
  'hostname' => __('Hostname', 'better-analytics'),
 
 
 
 
217
  ),
218
  __('Internal Search', 'better-analytics') => array(
219
  'searchUsed' => __('Search Used', 'better-analytics'),
@@ -248,6 +281,15 @@ class DigitalPointBetterAnalytics_Model_Reporting
248
  'interestInMarketCategory' => __('Interest In Market', 'better-analytics'),
249
  'interestOtherCategory' => __('Interest Other', 'better-analytics'),
250
  ),
 
 
 
 
 
 
 
 
 
251
  );
252
 
253
  return apply_filters('better_analytics_dimensions', $dimensions);
@@ -304,6 +346,12 @@ class DigitalPointBetterAnalytics_Model_Reporting
304
 
305
  public static function filterGoalsByProfile($goals, $webPropertyId, $profileId, &$totals)
306
  {
 
 
 
 
 
 
307
  $output = array();
308
  if (@$goals['items'])
309
  {
@@ -312,14 +360,14 @@ class DigitalPointBetterAnalytics_Model_Reporting
312
  if ($goal['webPropertyId'] == $webPropertyId && $goal['profileId'] == $profileId)
313
  {
314
  $output[$goal['id']] = $goal;
315
- @$totals['all']++;
316
  if ($goal['active'])
317
  {
318
- @$totals['active']++;
319
  }
320
  else
321
  {
322
- @$totals['inactive']++;
323
  }
324
  }
325
  }
@@ -346,28 +394,36 @@ class DigitalPointBetterAnalytics_Model_Reporting
346
 
347
  public static function getExperimentTotals($experiments)
348
  {
349
- $totals = array();
 
 
 
 
 
 
 
 
350
  if (@$experiments['items'])
351
  {
352
  foreach($experiments['items'] as $experiment)
353
  {
354
- @$totals['all']++;
355
 
356
  if ($experiment['status'] == 'DRAFT')
357
  {
358
- @$totals['draft']++;
359
  }
360
  elseif ($experiment['status'] == 'RUNNING')
361
  {
362
- @$totals['running']++;
363
  }
364
  elseif ($experiment['status'] == 'ENDED')
365
  {
366
- @$totals['ended']++;
367
  }
368
  elseif ($experiment['status'] == 'READY_TO_RUN')
369
  {
370
- @$totals['ready']++;
371
  }
372
  }
373
  }
173
  __('User', 'better-analytics') => array(
174
  'userType' => __('User Type', 'better-analytics'),
175
  'sessionCount' => __('Session Count', 'better-analytics'),
176
+ 'daysSinceLastSession' => __('Days Since Last Session', 'better-analytics'),
177
  ),
178
  __('Session', 'better-analytics') => array(
179
  'sessionDurationBucket' => __('Session Duration', 'better-analytics'),
180
  ),
181
  __('Traffic Sources', 'better-analytics') => array(
182
+ 'referralPath' => __('Referral Path', 'better-analytics'),
183
+ 'fullReferrer' => __('Full Referrer', 'better-analytics'),
184
  'campaign' => __('Campaign', 'better-analytics'),
185
  'source' => __('Source', 'better-analytics'),
186
  'medium' => __('Medium', 'better-analytics'),
187
+ 'sourceMedium' => __('Source / Medium', 'better-analytics'),
188
  'keyword' => __('Keyword', 'better-analytics'),
189
  'socialNetwork' => __('Social Network', 'better-analytics'),
190
+ 'hasSocialSourceReferral' => __('Has Social Source Referral', 'better-analytics'),
191
  'searchNotProvided' => __('Search Keywords Provided', 'better-analytics'),
192
  'oraganicSearchMarketshare' => __('Organic Search Marketshare', 'better-analytics'),
193
  ),
194
+ __('AdWords', 'better-analytics') => array(
195
+ 'adGroup' => __('Ad Group', 'better-analytics'),
196
+ 'adSlot' => __('Ad Slot', 'better-analytics'),
197
+ 'adDistributionNetwork' => __('Ad Distribution Network', 'better-analytics'),
198
+ 'adMatchType' => __('Ad Match Type', 'better-analytics'),
199
+ 'adKeywordMatchType' => __('Ad Keyword Match Type', 'better-analytics'),
200
+ 'adMatchedQuery' => __('Ad Matched Query', 'better-analytics'),
201
+ 'adPlacementDomain' => __('Ad Placement Domain', 'better-analytics'),
202
+ 'adPlacementUrl' => __('Ad Placement URL', 'better-analytics'),
203
+ 'adFormat' => __('Ad Format', 'better-analytics'),
204
+ 'adTargetingType' => __('Ad Targeting Type', 'better-analytics'),
205
+ 'adTargetingOption' => __('Ad Targeting Option', 'better-analytics'),
206
+ 'adDisplayUrl' => __('Ad Display URL', 'better-analytics'),
207
+ 'adDestinationUrl' => __('Ad Destination URL', 'better-analytics'),
208
+ 'adwordsCampaignID' => __('AdWords Campaign ID', 'better-analytics'),
209
+ 'adwordsAdGroupID' => __('AdWords Ad Group ID', 'better-analytics'),
210
+ 'adwordsCreativeID' => __('AdWords Creative ID', 'better-analytics'),
211
+ 'adQueryWordCount' => __('Ad Query Word Count', 'better-analytics'),
212
+ ),
213
  __('Platform', 'better-analytics') => array(
214
  'browser' => __('Browser', 'better-analytics'),
215
+ 'browserVersion' => __('Browser Version', 'better-analytics'),
216
  'operatingSystem' => __('Operating System', 'better-analytics'),
217
  'operatingSystemVersion' => __('Operating System Version', 'better-analytics'),
218
  'mobileDeviceBranding' => __('Mobile Device Branding', 'better-analytics'),
221
  'mobileDeviceInfo' => __('Mobile Device Info', 'better-analytics'),
222
  'mobileDeviceMarketingName' => __('Mobile Device Marketing Name', 'better-analytics'),
223
  'deviceCategory' => __('Device Category', 'better-analytics'),
224
+ 'browserSize' => __('Browser Size', 'better-analytics'),
225
+ 'dataSource' => __('Data Source', 'better-analytics'),
226
  ),
227
  __('Geo / Network', 'better-analytics') => array(
228
  'continent' => __('Continent', 'better-analytics'),
229
  'subContinent' => __('Sub-Continent', 'better-analytics'),
230
  'country' => __('Country', 'better-analytics'),
231
  'region' => __('Region', 'better-analytics'),
232
+ 'metro' => __('Metro', 'better-analytics'),
233
  'city' => __('City', 'better-analytics'),
234
+ 'networkDomain' => __('Network Domain', 'better-analytics'),
235
+ 'networkLocation' => __('Network Location', 'better-analytics'),
236
  ),
237
  __('System', 'better-analytics') => array(
238
  'flashVersion' => __('Flash Version', 'better-analytics'),
243
  ),
244
  __('Page Tracking', 'better-analytics') => array(
245
  'hostname' => __('Hostname', 'better-analytics'),
246
+ 'pagePath' => __('Page Path', 'better-analytics'),
247
+ 'landingPagePath' => __('Landing Page Path', 'better-analytics'),
248
+ 'exitPagePath' => __('Exit Page Path', 'better-analytics'),
249
+
250
  ),
251
  __('Internal Search', 'better-analytics') => array(
252
  'searchUsed' => __('Search Used', 'better-analytics'),
281
  'interestInMarketCategory' => __('Interest In Market', 'better-analytics'),
282
  'interestOtherCategory' => __('Interest Other', 'better-analytics'),
283
  ),
284
+ __('Lifetime Value and Cohorts', 'better-analytics') => array(
285
+ 'acquisitionCampaign' => __('Acquisition Campaign', 'better-analytics'),
286
+ 'acquisitionMedium' => __('Acquisition Medium', 'better-analytics'),
287
+ 'acquisitionSourceMedium' => __('Acquisition Source / Medium', 'better-analytics'),
288
+ 'acquisitionTrafficChannel' => __('Acquisition Traffic Channel', 'better-analytics'),
289
+ 'cohort' => __('Cohort', 'better-analytics'),
290
+ ),
291
+
292
+
293
  );
294
 
295
  return apply_filters('better_analytics_dimensions', $dimensions);
346
 
347
  public static function filterGoalsByProfile($goals, $webPropertyId, $profileId, &$totals)
348
  {
349
+ $totals = array(
350
+ 'all' => 0,
351
+ 'active' => 0,
352
+ 'inactive' => 0
353
+ );
354
+
355
  $output = array();
356
  if (@$goals['items'])
357
  {
360
  if ($goal['webPropertyId'] == $webPropertyId && $goal['profileId'] == $profileId)
361
  {
362
  $output[$goal['id']] = $goal;
363
+ $totals['all']++;
364
  if ($goal['active'])
365
  {
366
+ $totals['active']++;
367
  }
368
  else
369
  {
370
+ $totals['inactive']++;
371
  }
372
  }
373
  }
394
 
395
  public static function getExperimentTotals($experiments)
396
  {
397
+
398
+ $totals = array(
399
+ 'all' => 0,
400
+ 'draft' => 0,
401
+ 'running' => 0,
402
+ 'ended' => 0,
403
+ 'ready' => 0
404
+ );
405
+
406
  if (@$experiments['items'])
407
  {
408
  foreach($experiments['items'] as $experiment)
409
  {
410
+ $totals['all']++;
411
 
412
  if ($experiment['status'] == 'DRAFT')
413
  {
414
+ $totals['draft']++;
415
  }
416
  elseif ($experiment['status'] == 'RUNNING')
417
  {
418
+ $totals['running']++;
419
  }
420
  elseif ($experiment['status'] == 'ENDED')
421
  {
422
+ $totals['ended']++;
423
  }
424
  elseif ($experiment['status'] == 'READY_TO_RUN')
425
  {
426
+ $totals['ready']++;
427
  }
428
  }
429
  }
library/DigitalPointBetterAnalytics/Model/Widget.php CHANGED
@@ -104,18 +104,74 @@ class DigitalPointBetterAnalytics_Model_Widget
104
 
105
  $split = explode('|', $setting['metric']);
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  if (!empty($setting['this_page_only']))
108
  {
109
- @$split[1] .= (empty($split[1]) ? '' : ';') . 'ga:pagePath==' . $uri;
 
 
 
 
 
 
 
 
 
110
  }
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  return DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
113
- absint($setting['days']) . 'daysAgo',
114
- 'yesterday',
115
- $split[0], // metric
116
- '', // dimensions
117
- '', // sort
118
- @$split[1] // filters
 
 
 
 
119
  );
120
  }
121
 
@@ -128,7 +184,7 @@ class DigitalPointBetterAnalytics_Model_Widget
128
 
129
  $results = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getResults($cacheKey);
130
 
131
- $value = intval(@$results['rows'][0][0]);
132
 
133
  set_transient(
134
  'ba_stats_' . md5(@$setting['metric'] . '-' . @$setting['days'] . '-' . (@$setting['this_page_only'] ? $uri : '')),
104
 
105
  $split = explode('|', $setting['metric']);
106
 
107
+ if ($timeZoneString = get_option('timezone_string'))
108
+ {
109
+ $timeZoneString = 'GMT';
110
+ }
111
+ $timeZone = new DateTimeZone($timeZoneString);
112
+
113
+ $date = new DateTime('now', $timeZone);
114
+ $date->sub(new DateInterval('P' . intval($setting['days'] + 1) . 'D'));
115
+ $startDate = $date->format('Y-m-d');
116
+
117
+ $date = new DateTime();
118
+ $date->sub(new DateInterval('P1D'));
119
+ $endDate = $date->format('Y-m-d');
120
+
121
+ $dimensionFilter = array();
122
+
123
  if (!empty($setting['this_page_only']))
124
  {
125
+ $dimensionFilter[] = array (
126
+ 'operator' => 'AND',
127
+ 'filters' => array(
128
+ array(
129
+ 'dimensionName' => 'ga:pagePath',
130
+ 'operator' => 'EXACT',
131
+ 'expressions' => $uri
132
+ )
133
+ )
134
+ );
135
  }
136
 
137
+
138
+ if (!empty($split[1]))
139
+ {
140
+ if (empty($dimensionFilter))
141
+ {
142
+ $dimensionFilter[] = array(
143
+ 'operator' => 'AND',
144
+ 'filters' => array()
145
+ );
146
+ }
147
+
148
+ $filtersRaw = explode(';', $split[1]);
149
+
150
+ foreach($filtersRaw as $filterRaw)
151
+ {
152
+ $splitFilter = explode('==', $filterRaw);
153
+
154
+ $dimensionFilter[0]['filters'][] = array(
155
+ 'dimensionName' => $splitFilter[0],
156
+ 'operator' => 'EXACT',
157
+ 'expressions' => array($splitFilter[1])
158
+ );
159
+ }
160
+ }
161
+
162
+
163
+
164
  return DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
165
+ $startDate,
166
+ $endDate,
167
+ array( // metric
168
+ array(
169
+ 'expression' => $split[0]
170
+ )
171
+ ),
172
+ array(), // dimensions
173
+ array(), // sort
174
+ $dimensionFilter // dimension filters
175
  );
176
  }
177
 
184
 
185
  $results = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getResults($cacheKey);
186
 
187
+ $value = intval(@$results['reports'][0]['data']['rows'][0]['metrics'][0]['values'][0]);
188
 
189
  set_transient(
190
  'ba_stats_' . md5(@$setting['metric'] . '-' . @$setting['days'] . '-' . (@$setting['this_page_only'] ? $uri : '')),
library/DigitalPointBetterAnalytics/ViewAdmin/config.php CHANGED
@@ -116,6 +116,10 @@
116
  <h4><?php esc_html_e('Extra Features In Pro Version', 'better-analytics'); ?></h4>
117
  <div>
118
  <ul>
 
 
 
 
119
  <li>
120
  <?php esc_html_e('More Advertising tracking options', 'better-analytics'); ?>
121
  </li>
@@ -205,7 +209,7 @@
205
  <td>
206
  <fieldset>
207
  <label for="ba_link_attribution">
208
- <input name="better_analytics[link_attribution]" type="checkbox" id="ba_link_attribution" value="1" <?php checked('1', @$betterAnalyticsOptions['link_attribution'] ); ?>>
209
  <?php esc_html_e('Enhanced Link Attribution', 'better-analytics');?></label>
210
  <span class="dashicons-before dashicons-info tooltip" title="<?php
211
  printf(esc_html__('See separate information for multiple links on a page that all have the same destination. For example, if there are two links on the same page that both lead to the Contact Us page, then you see separate click information for each link.%1$sSee when one page element has multiple destinations. For example, a Search button on your page is likely to lead to multiple destinations.%1$sTrack buttons, menus, and actions driven by JavaScript.', 'better-analytics'),
@@ -221,6 +225,34 @@
221
  '</a>'
222
  ));
223
  ?>"></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  </fieldset>
225
 
226
  </td>
@@ -300,7 +332,7 @@
300
  <td>
301
  <fieldset>
302
  <label for="ba_anonymize_ips">
303
- <input name="better_analytics[anonymize_ips]" type="checkbox" id="ba_anonymize_ips" value="1" <?php checked('1', @$betterAnalyticsOptions['anonymize_ips'] ); ?>>
304
  <?php esc_html_e('Anonymize IPs', 'better-analytics');?></label>
305
  <span class="dashicons-before dashicons-info tooltip" title="<?php echo htmlspecialchars(sprintf(__('Detailed information about IP Anonymization in Google Analytics can be found %1$sover here%2$s.', 'better-analytics'),
306
  '<a href="' . esc_url('https://support.google.com/analytics/answer/2763052') . '" target="_blank">',
@@ -615,12 +647,12 @@
615
 
616
  <fieldset>
617
  <label for="ba_social_facebook">
618
- <input name="better_analytics[social][facebook]" type="checkbox" id="ba_social_facebook" value="1" <?php checked('1', @$betterAnalyticsOptions['social']['facebook'] ); ?>>
619
  <?php esc_html_e('Facebook Like', 'better-analytics');?></label>
620
  <br />
621
 
622
  <label for="ba_social_twitter">
623
- <input name="better_analytics[social][twitter]" type="checkbox" id="ba_social_twitter" value="1" <?php checked('1', @$betterAnalyticsOptions['social']['twitter'] ); ?>>
624
  <?php esc_html_e('Twitter', 'better-analytics');?></label>
625
  <br />
626
 
@@ -630,12 +662,12 @@
630
  <br />
631
 
632
  <label for="ba_social_pinterest">
633
- <input name="better_analytics[social][pinterest]" type="checkbox" id="ba_social_pinterest" value="1" <?php checked('1', @$betterAnalyticsOptions['social']['pinterest'] ); ?>>
634
  <?php esc_html_e('Pinterest', 'better-analytics');?></label>
635
  <br />
636
 
637
  <label for="ba_social_linkedin">
638
- <input name="better_analytics[social][linkedin]" type="checkbox" id="ba_social_linkedin" value="1" <?php checked('1', @$betterAnalyticsOptions['social']['linkedin'] ); ?>>
639
  <?php esc_html_e('LinkedIn', 'better-analytics');?></label>
640
 
641
  </fieldset>
@@ -649,27 +681,27 @@
649
 
650
  <fieldset>
651
  <label for="ba_ads_adsense"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
652
- <input name="better_analytics[ads][adsense]" type="checkbox" id="ba_ads_adsense" value="1" <?php checked('1', @$betterAnalyticsOptions['ads']['adsense']); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
653
  <?php esc_html_e('AdSense', 'better-analytics');?></label>
654
  <br />
655
 
656
  <label for="ba_ads_outbrain"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
657
- <input name="better_analytics[ads][outbrain]" type="checkbox" id="ba_ads_outbrain" value="1" <?php checked('1', @$betterAnalyticsOptions['ads']['outbrain'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
658
  <?php esc_html_e('Outbrain', 'better-analytics');?></label>
659
  <br />
660
 
661
  <label for="ba_ads_revcontent"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
662
- <input name="better_analytics[ads][revcontent]" type="checkbox" id="ba_ads_revcontent" value="1" <?php checked('1', @$betterAnalyticsOptions['ads']['revcontent'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
663
  <?php esc_html_e('RevContent', 'better-analytics');?></label>
664
  <br />
665
 
666
  <label for="ba_ads_taboola"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
667
- <input name="better_analytics[ads][taboola]" type="checkbox" id="ba_ads_taboola" value="1" <?php checked('1', @$betterAnalyticsOptions['ads']['taboola'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
668
  <?php esc_html_e('Taboola', 'better-analytics');?></label>
669
  <br />
670
 
671
  <label for="ba_ads_digitalpoint">
672
- <input name="better_analytics[ads][digitalpoint]" type="checkbox" id="ba_ads_digitalpoint" value="1" <?php checked('1', @$betterAnalyticsOptions['ads']['digitalpoint'] ); ?>>
673
  <?php esc_html_e('Digital Point', 'better-analytics');?></label>
674
 
675
 
@@ -686,32 +718,32 @@
686
  <fieldset>
687
 
688
  <label for="ba_events_error_404">
689
- <input name="better_analytics[events][error_404]" type="checkbox" id="ba_events_error_404" value="1" <?php checked('1', @$betterAnalyticsOptions['events']['error_404'] ); ?>>
690
  <?php esc_html_e('Page Not Found (404)', 'better-analytics');?></label>
691
  <br />
692
 
693
  <label for="ba_events_missing_images"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
694
- <input name="better_analytics[events][missing_images]" type="checkbox" id="ba_events_missing_images" value="1" <?php checked('1', @$betterAnalyticsOptions['events']['missing_images'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
695
  <?php esc_html_e('Images Not Loading', 'better-analytics');?>
696
  <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('This relies on the ability of the user\'s browser to load images which will vary between browsers and Internet connections. This event can be a useful tool for finding missing images, but it keep in mind it will log any image that the end user\'s browser did not load (for any reason).', 'better-analytics');?>"></span>
697
  </label>
698
  <br />
699
 
700
  <label for="ba_events_errors_javascript"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
701
- <input name="better_analytics[events][error_js]" type="checkbox" id="ba_events_errors_javascript" value="1" <?php checked('1', @$betterAnalyticsOptions['events']['error_js'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
702
  <?php esc_html_e('JavaScript Errors', 'better-analytics');?></label>
703
  <br />
704
 
705
  <label for="ba_events_errors_ajax"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
706
- <input name="better_analytics[events][error_ajax]" type="checkbox" id="ba_events_errors_ajax" value="1" <?php checked('1', @$betterAnalyticsOptions['events']['error_ajax'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
707
  <?php esc_html_e('AJAX Errors', 'better-analytics');?></label>
708
  <br />
709
  <label for="ba_events_errors_console"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
710
- <input name="better_analytics[events][error_console]" type="checkbox" id="ba_events_errors_console" value="1" <?php checked('1', @$betterAnalyticsOptions['events']['error_console'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
711
  <?php esc_html_e('Browser Console Errors', 'better-analytics');?></label>
712
  <br />
713
  <label for="ba_events_errors_youtube"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
714
- <input name="better_analytics[events][error_youtube]" type="checkbox" id="ba_events_errors_youtube" value="1" <?php checked('1', @$betterAnalyticsOptions['events']['error_youtube'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
715
  <?php esc_html_e('YouTube Errors', 'better-analytics');?>
716
  <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('This allows you to quickly find old videos that the author has removed or disabled embeding for.', 'better-analytics');?>"></span>
717
  </label>
@@ -727,7 +759,7 @@
727
  <fieldset>
728
 
729
  <label for="ba_events_ajax_requests">
730
- <input name="better_analytics[events][ajax_request]" type="checkbox" id="ba_events_ajax_requests" value="1" <?php checked('1', @$betterAnalyticsOptions['events']['ajax_request'] ); ?>>
731
  <?php esc_html_e('AJAX Requests', 'better-analytics');?></label>
732
  </fieldset>
733
 
@@ -739,7 +771,7 @@
739
  <td>
740
  <fieldset>
741
  <label for="ba_ecommerce_woo"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
742
- <input name="better_analytics[ecommerce][woo]" type="checkbox" id="ba_ecommerce_woo" value="1" <?php checked('1', @$betterAnalyticsOptions['ecommerce']['woo'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
743
  <?php
744
  esc_html_e('WooCommerce', 'better-analytics');
745
  if (!in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
@@ -843,7 +875,7 @@
843
  <fieldset>
844
  <label for="ba_api_use_own">
845
  <input name="better_analytics[api][use_own]" type="checkbox" id="ba_api_use_own"
846
- value="1" <?php checked('1', @$betterAnalyticsOptions['api']['use_own']); ?>>
847
  <?php esc_html_e('Use Your Own Project Credentials', 'better-analytics');?></label>
848
  <span class="dashicons-before dashicons-info tooltip"
849
  title="<?php echo htmlspecialchars(sprintf(__('If you have your own Google API Project that you wish to use, you can use your credentials for that web application.', 'better-analytics')));?>"></span>
@@ -854,7 +886,7 @@
854
  </tr>
855
 
856
  <tr valign="top"
857
- class="group_api tab_content api_hideable"<?php echo(!@$betterAnalyticsOptions['api']['use_own'] ? ' style="display:none"' : '')?>>
858
  <td colspan="2">
859
 
860
  <?php echo '<fieldset style="border:1px solid grey;margin:10px;padding:20px;"><legend style="padding:0 5px;font-weight:bold;font-size:120%">' . esc_html__('Configuration', 'better-analytics') . '</legend>' .
@@ -868,7 +900,7 @@
868
 
869
 
870
  <tr valign="top"
871
- class="group_api tab_content api_hideable"<?php echo(!@$betterAnalyticsOptions['api']['use_own'] ? ' style="display:none"' : '')?>>
872
  <th scope="row"><?php esc_html_e('Client ID', 'better-analytics');?></th>
873
  <td>
874
  <input type="text" name="better_analytics[api][client_id]" id="ba_api_client_id"
@@ -878,7 +910,7 @@
878
  </tr>
879
 
880
  <tr valign="top"
881
- class="group_api tab_content api_hideable"<?php echo(!@$betterAnalyticsOptions['api']['use_own'] ? ' style="display:none"' : '')?>>
882
  <th scope="row"><?php esc_html_e('Client Secret', 'better-analytics');?></th>
883
  <td>
884
  <input type="text" name="better_analytics[api][client_secret]" id="ba_api_client_secret"
@@ -900,7 +932,7 @@
900
  global $wp_roles;
901
  foreach ($wp_roles->roles as $role => $val)
902
  {
903
- echo '<option value="' . $role . '"' . (in_array($role, (array)@$betterAnalyticsOptions['roles_no_track']) ? ' selected="selected"' : '') . '>' . $val['name'] . '</option>';
904
  }
905
  ?>
906
  </select>
@@ -924,7 +956,7 @@
924
 
925
  <fieldset style="padding-top:3px;">
926
  <label for="ba_author_view_reports">
927
- <input name="better_analytics[author_view_reports]" type="checkbox" id="ba_author_view_reports" value="1" <?php checked('1', @$betterAnalyticsOptions['author_view_reports'] ); ?>>
928
  <?php esc_html_e('Author Can View Page Analytics', 'better-analytics');?></label>
929
  </fieldset>
930
 
@@ -940,7 +972,7 @@
940
  <td>
941
  <fieldset>
942
  <label for="ba_lock_settings_user_id">
943
- <input name="better_analytics[lock_settings_user_id]" type="checkbox" id="ba_lock_settings_user_id" value="<?php echo @$currentUser->ID; ?>" <?php checked('1', @$betterAnalyticsOptions['lock_settings_user_id'] ); ?>>
944
  <?php esc_html_e('Only Your User Account', 'better-analytics');?></label>
945
  <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('If you want to disable all other admin accounts from having access to the Better Analytics settings, use this option. Keep in mind, that only your account will have access to change any Better Analytics settings.', 'better-analytics');?>"></span>
946
 
@@ -1127,7 +1159,7 @@
1127
  <td>
1128
  <fieldset>
1129
  <label for="ba_debugging">
1130
- <input name="better_analytics[debugging]" type="checkbox" id="ba_debugging" value="1" <?php checked('1', @$betterAnalyticsOptions['debugging'] ); ?>>
1131
  <?php esc_html_e('Enable Google Analytics Debugging', 'better-analytics');?></label>
1132
  <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('This will display Google Analytics debug data in the browser console.', 'better-analytics');?>"></span>
1133
 
@@ -1141,7 +1173,7 @@
1141
  <td>
1142
  <fieldset>
1143
  <label for="ba_hide_api_message">
1144
- <input name="better_analytics[hide_api_message]" type="checkbox" id="ba_hide_api_message" value="1" <?php checked('1', @$betterAnalyticsOptions['hide_api_message'] ); ?>>
1145
  <?php esc_html_e('Hide "API Not Linked" Notice', 'better-analytics');?></label>
1146
  <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('If you choose not to link your Google Analytics account for reporting and management, you can disable the notice about it with this option (the notice will still show on Better Analytics config/reporting pages).', 'better-analytics');?>"></span>
1147
 
116
  <h4><?php esc_html_e('Extra Features In Pro Version', 'better-analytics'); ?></h4>
117
  <div>
118
  <ul>
119
+ <li>
120
+ <?php esc_html_e('AMP (Accelerated Mobile Pages) tracking', 'better-analytics'); ?>
121
+ </li>
122
+
123
  <li>
124
  <?php esc_html_e('More Advertising tracking options', 'better-analytics'); ?>
125
  </li>
209
  <td>
210
  <fieldset>
211
  <label for="ba_link_attribution">
212
+ <input name="better_analytics[link_attribution]" type="checkbox" id="ba_link_attribution" value="1" <?php checked('1', empty($betterAnalyticsOptions['link_attribution']) ? false : $betterAnalyticsOptions['link_attribution'] ); ?>>
213
  <?php esc_html_e('Enhanced Link Attribution', 'better-analytics');?></label>
214
  <span class="dashicons-before dashicons-info tooltip" title="<?php
215
  printf(esc_html__('See separate information for multiple links on a page that all have the same destination. For example, if there are two links on the same page that both lead to the Contact Us page, then you see separate click information for each link.%1$sSee when one page element has multiple destinations. For example, a Search button on your page is likely to lead to multiple destinations.%1$sTrack buttons, menus, and actions driven by JavaScript.', 'better-analytics'),
225
  '</a>'
226
  ));
227
  ?>"></span>
228
+ <br />
229
+
230
+
231
+ <label for="ba_amp"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
232
+ <input name="better_analytics[amp]" type="checkbox" id="ba_amp" value="1" <?php checked('1', empty($betterAnalyticsOptions['amp']) ? false : $betterAnalyticsOptions['amp'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
233
+
234
+ <?php
235
+ esc_html_e('Add To AMP (Accelerated Mobile Pages)', 'better-analytics');
236
+ if (!in_array( 'amp/amp.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
237
+ {
238
+ wp_enqueue_script('plugin-install');
239
+ wp_enqueue_script('thickbox');
240
+ wp_enqueue_style('thickbox');
241
+
242
+ printf('<p class="description">%s <a href="%s" class="thickbox" aria-label="%s" data-title="%s">%s</a></p>',
243
+ esc_html__('AMP not enabled/active.', 'better-analytics'),
244
+ esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=amp' .
245
+ '&TB_iframe=true&width=600&height=550' ) ),
246
+ esc_attr( sprintf( __( 'More information about %s' ), 'AMP' ) ),
247
+ esc_attr( 'AMP'),
248
+ esc_html__( 'View details' )
249
+ );
250
+ }
251
+
252
+ ?>
253
+ </label>
254
+ <span class="dashicons-before dashicons-info tooltip" title="<?php esc_attr_e('Google Analytics for AMP pages does not support all tracking features, so this is a subset of tracking ability.', 'better-analytics'); ?>"></span>
255
+
256
  </fieldset>
257
 
258
  </td>
332
  <td>
333
  <fieldset>
334
  <label for="ba_anonymize_ips">
335
+ <input name="better_analytics[anonymize_ips]" type="checkbox" id="ba_anonymize_ips" value="1" <?php checked('1', empty($betterAnalyticsOptions['anonymize_ips']) ? false : $betterAnalyticsOptions['anonymize_ips'] ); ?>>
336
  <?php esc_html_e('Anonymize IPs', 'better-analytics');?></label>
337
  <span class="dashicons-before dashicons-info tooltip" title="<?php echo htmlspecialchars(sprintf(__('Detailed information about IP Anonymization in Google Analytics can be found %1$sover here%2$s.', 'better-analytics'),
338
  '<a href="' . esc_url('https://support.google.com/analytics/answer/2763052') . '" target="_blank">',
647
 
648
  <fieldset>
649
  <label for="ba_social_facebook">
650
+ <input name="better_analytics[social][facebook]" type="checkbox" id="ba_social_facebook" value="1" <?php checked('1', empty($betterAnalyticsOptions['social']['facebook']) ? false : $betterAnalyticsOptions['social']['facebook'] ); ?>>
651
  <?php esc_html_e('Facebook Like', 'better-analytics');?></label>
652
  <br />
653
 
654
  <label for="ba_social_twitter">
655
+ <input name="better_analytics[social][twitter]" type="checkbox" id="ba_social_twitter" value="1" <?php checked('1', empty($betterAnalyticsOptions['social']['twitter']) ? false : $betterAnalyticsOptions['social']['twitter'] ); ?>>
656
  <?php esc_html_e('Twitter', 'better-analytics');?></label>
657
  <br />
658
 
662
  <br />
663
 
664
  <label for="ba_social_pinterest">
665
+ <input name="better_analytics[social][pinterest]" type="checkbox" id="ba_social_pinterest" value="1" <?php checked('1', empty($betterAnalyticsOptions['social']['pinterest']) ? false : $betterAnalyticsOptions['social']['pinterest'] ); ?>>
666
  <?php esc_html_e('Pinterest', 'better-analytics');?></label>
667
  <br />
668
 
669
  <label for="ba_social_linkedin">
670
+ <input name="better_analytics[social][linkedin]" type="checkbox" id="ba_social_linkedin" value="1" <?php checked('1', empty($betterAnalyticsOptions['social']['linkedin']) ? false : $betterAnalyticsOptions['social']['linkedin'] ); ?>>
671
  <?php esc_html_e('LinkedIn', 'better-analytics');?></label>
672
 
673
  </fieldset>
681
 
682
  <fieldset>
683
  <label for="ba_ads_adsense"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
684
+ <input name="better_analytics[ads][adsense]" type="checkbox" id="ba_ads_adsense" value="1" <?php checked('1', empty($betterAnalyticsOptions['ads']['adsense']) ? false : $betterAnalyticsOptions['ads']['adsense']); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
685
  <?php esc_html_e('AdSense', 'better-analytics');?></label>
686
  <br />
687
 
688
  <label for="ba_ads_outbrain"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
689
+ <input name="better_analytics[ads][outbrain]" type="checkbox" id="ba_ads_outbrain" value="1" <?php checked('1', empty($betterAnalyticsOptions['ads']['outbrain']) ? false : $betterAnalyticsOptions['ads']['outbrain'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
690
  <?php esc_html_e('Outbrain', 'better-analytics');?></label>
691
  <br />
692
 
693
  <label for="ba_ads_revcontent"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
694
+ <input name="better_analytics[ads][revcontent]" type="checkbox" id="ba_ads_revcontent" value="1" <?php checked('1', empty($betterAnalyticsOptions['ads']['revcontent']) ? false : $betterAnalyticsOptions['ads']['revcontent'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
695
  <?php esc_html_e('RevContent', 'better-analytics');?></label>
696
  <br />
697
 
698
  <label for="ba_ads_taboola"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
699
+ <input name="better_analytics[ads][taboola]" type="checkbox" id="ba_ads_taboola" value="1" <?php checked('1', empty($betterAnalyticsOptions['ads']['taboola']) ? false : $betterAnalyticsOptions['ads']['taboola'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
700
  <?php esc_html_e('Taboola', 'better-analytics');?></label>
701
  <br />
702
 
703
  <label for="ba_ads_digitalpoint">
704
+ <input name="better_analytics[ads][digitalpoint]" type="checkbox" id="ba_ads_digitalpoint" value="1" <?php checked('1', empty($betterAnalyticsOptions['ads']['digitalpoint']) ? false : $betterAnalyticsOptions['ads']['digitalpoint'] ); ?>>
705
  <?php esc_html_e('Digital Point', 'better-analytics');?></label>
706
 
707
 
718
  <fieldset>
719
 
720
  <label for="ba_events_error_404">
721
+ <input name="better_analytics[events][error_404]" type="checkbox" id="ba_events_error_404" value="1" <?php checked('1', empty($betterAnalyticsOptions['events']['error_404']) ? false : $betterAnalyticsOptions['events']['error_404'] ); ?>>
722
  <?php esc_html_e('Page Not Found (404)', 'better-analytics');?></label>
723
  <br />
724
 
725
  <label for="ba_events_missing_images"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
726
+ <input name="better_analytics[events][missing_images]" type="checkbox" id="ba_events_missing_images" value="1" <?php checked('1', empty($betterAnalyticsOptions['events']['missing_images']) ? false : $betterAnalyticsOptions['events']['missing_images'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
727
  <?php esc_html_e('Images Not Loading', 'better-analytics');?>
728
  <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('This relies on the ability of the user\'s browser to load images which will vary between browsers and Internet connections. This event can be a useful tool for finding missing images, but it keep in mind it will log any image that the end user\'s browser did not load (for any reason).', 'better-analytics');?>"></span>
729
  </label>
730
  <br />
731
 
732
  <label for="ba_events_errors_javascript"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
733
+ <input name="better_analytics[events][error_js]" type="checkbox" id="ba_events_errors_javascript" value="1" <?php checked('1', empty($betterAnalyticsOptions['events']['error_js']) ? false : $betterAnalyticsOptions['events']['error_js'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
734
  <?php esc_html_e('JavaScript Errors', 'better-analytics');?></label>
735
  <br />
736
 
737
  <label for="ba_events_errors_ajax"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
738
+ <input name="better_analytics[events][error_ajax]" type="checkbox" id="ba_events_errors_ajax" value="1" <?php checked('1', empty($betterAnalyticsOptions['events']['error_ajax']) ? false : $betterAnalyticsOptions['events']['error_ajax'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
739
  <?php esc_html_e('AJAX Errors', 'better-analytics');?></label>
740
  <br />
741
  <label for="ba_events_errors_console"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
742
+ <input name="better_analytics[events][error_console]" type="checkbox" id="ba_events_errors_console" value="1" <?php checked('1', empty($betterAnalyticsOptions['events']['error_console']) ? false : $betterAnalyticsOptions['events']['error_console'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
743
  <?php esc_html_e('Browser Console Errors', 'better-analytics');?></label>
744
  <br />
745
  <label for="ba_events_errors_youtube"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
746
+ <input name="better_analytics[events][error_youtube]" type="checkbox" id="ba_events_errors_youtube" value="1" <?php checked('1', empty($betterAnalyticsOptions['events']['error_youtube']) ? false : $betterAnalyticsOptions['events']['error_youtube'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
747
  <?php esc_html_e('YouTube Errors', 'better-analytics');?>
748
  <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('This allows you to quickly find old videos that the author has removed or disabled embeding for.', 'better-analytics');?>"></span>
749
  </label>
759
  <fieldset>
760
 
761
  <label for="ba_events_ajax_requests">
762
+ <input name="better_analytics[events][ajax_request]" type="checkbox" id="ba_events_ajax_requests" value="1" <?php checked('1', empty($betterAnalyticsOptions['events']['ajax_request']) ? false : $betterAnalyticsOptions['events']['ajax_request'] ); ?>>
763
  <?php esc_html_e('AJAX Requests', 'better-analytics');?></label>
764
  </fieldset>
765
 
771
  <td>
772
  <fieldset>
773
  <label for="ba_ecommerce_woo"<?php echo (!intval(@$betterAnalyticsInternal) ? ' class="pro"' : ''); ?>>
774
+ <input name="better_analytics[ecommerce][woo]" type="checkbox" id="ba_ecommerce_woo" value="1" <?php checked('1', empty($betterAnalyticsOptions['ecommerce']) || empty($betterAnalyticsOptions['ecommerce']['woo']) ? false : $betterAnalyticsOptions['ecommerce']['woo'] ); disabled(0, intval(@$betterAnalyticsInternal)); ?>>
775
  <?php
776
  esc_html_e('WooCommerce', 'better-analytics');
777
  if (!in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
875
  <fieldset>
876
  <label for="ba_api_use_own">
877
  <input name="better_analytics[api][use_own]" type="checkbox" id="ba_api_use_own"
878
+ value="1" <?php checked('1', empty($betterAnalyticsOptions['api']) || empty($betterAnalyticsOptions['api']['use_own']) ? false : $betterAnalyticsOptions['api']['use_own']); ?>>
879
  <?php esc_html_e('Use Your Own Project Credentials', 'better-analytics');?></label>
880
  <span class="dashicons-before dashicons-info tooltip"
881
  title="<?php echo htmlspecialchars(sprintf(__('If you have your own Google API Project that you wish to use, you can use your credentials for that web application.', 'better-analytics')));?>"></span>
886
  </tr>
887
 
888
  <tr valign="top"
889
+ class="group_api tab_content api_hideable"<?php echo(empty($betterAnalyticsOptions['api']) || empty($betterAnalyticsOptions['api']['use_own']) ? ' style="display:none"' : '')?>>
890
  <td colspan="2">
891
 
892
  <?php echo '<fieldset style="border:1px solid grey;margin:10px;padding:20px;"><legend style="padding:0 5px;font-weight:bold;font-size:120%">' . esc_html__('Configuration', 'better-analytics') . '</legend>' .
900
 
901
 
902
  <tr valign="top"
903
+ class="group_api tab_content api_hideable"<?php echo(empty($betterAnalyticsOptions['api']) || empty($betterAnalyticsOptions['api']['use_own']) ? ' style="display:none"' : '')?>>
904
  <th scope="row"><?php esc_html_e('Client ID', 'better-analytics');?></th>
905
  <td>
906
  <input type="text" name="better_analytics[api][client_id]" id="ba_api_client_id"
910
  </tr>
911
 
912
  <tr valign="top"
913
+ class="group_api tab_content api_hideable"<?php echo(empty($betterAnalyticsOptions['api']) || empty($betterAnalyticsOptions['api']['use_own']) ? ' style="display:none"' : '')?>>
914
  <th scope="row"><?php esc_html_e('Client Secret', 'better-analytics');?></th>
915
  <td>
916
  <input type="text" name="better_analytics[api][client_secret]" id="ba_api_client_secret"
932
  global $wp_roles;
933
  foreach ($wp_roles->roles as $role => $val)
934
  {
935
+ echo '<option value="' . $role . '"' . (!empty($betterAnalyticsOptions['roles_no_track']) && in_array($role, (array)@$betterAnalyticsOptions['roles_no_track']) ? ' selected="selected"' : '') . '>' . $val['name'] . '</option>';
936
  }
937
  ?>
938
  </select>
956
 
957
  <fieldset style="padding-top:3px;">
958
  <label for="ba_author_view_reports">
959
+ <input name="better_analytics[author_view_reports]" type="checkbox" id="ba_author_view_reports" value="1" <?php checked('1', empty($betterAnalyticsOptions['author_view_reports']) ? false : $betterAnalyticsOptions['author_view_reports'] ); ?>>
960
  <?php esc_html_e('Author Can View Page Analytics', 'better-analytics');?></label>
961
  </fieldset>
962
 
972
  <td>
973
  <fieldset>
974
  <label for="ba_lock_settings_user_id">
975
+ <input name="better_analytics[lock_settings_user_id]" type="checkbox" id="ba_lock_settings_user_id" value="<?php echo @$currentUser->ID; ?>" <?php checked('1', empty($betterAnalyticsOptions['lock_settings_user_id']) ? false : $betterAnalyticsOptions['lock_settings_user_id'] ); ?>>
976
  <?php esc_html_e('Only Your User Account', 'better-analytics');?></label>
977
  <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('If you want to disable all other admin accounts from having access to the Better Analytics settings, use this option. Keep in mind, that only your account will have access to change any Better Analytics settings.', 'better-analytics');?>"></span>
978
 
1159
  <td>
1160
  <fieldset>
1161
  <label for="ba_debugging">
1162
+ <input name="better_analytics[debugging]" type="checkbox" id="ba_debugging" value="1" <?php checked('1', empty($betterAnalyticsOptions['debugging']) ? false : $betterAnalyticsOptions['debugging'] ); ?>>
1163
  <?php esc_html_e('Enable Google Analytics Debugging', 'better-analytics');?></label>
1164
  <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('This will display Google Analytics debug data in the browser console.', 'better-analytics');?>"></span>
1165
 
1173
  <td>
1174
  <fieldset>
1175
  <label for="ba_hide_api_message">
1176
+ <input name="better_analytics[hide_api_message]" type="checkbox" id="ba_hide_api_message" value="1" <?php checked('1', empty($betterAnalyticsOptions['hide_api_message']) ? false : $betterAnalyticsOptions['hide_api_message'] ); ?>>
1177
  <?php esc_html_e('Hide "API Not Linked" Notice', 'better-analytics');?></label>
1178
  <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('If you choose not to link your Google Analytics account for reporting and management, you can disable the notice about it with this option (the notice will still show on Better Analytics config/reporting pages).', 'better-analytics');?>"></span>
1179
 
library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php CHANGED
@@ -21,7 +21,7 @@ $accountId = null;
21
  $experiment = array();
22
  $readOnly = '';
23
 
24
- $experimentId = sanitize_text_field(@$_REQUEST['id']);
25
 
26
  if ($experimentId && $accountId = DigitalPointBetterAnalytics_Model_Reporting::getSiteAccountId())
27
  {
@@ -327,7 +327,14 @@ if (@$_REQUEST['action'] == 'create_edit')
327
 
328
  foreach ($allPosts as $post)
329
  {
330
- echo '<option value="' . absint($post->ID) . '"' . ($post->ID == @$experiment['extraData']['post_title']['post_id'] ? ' selected="selected"' : '') . '>' . htmlentities($post->post_title) . '</option>';
 
 
 
 
 
 
 
331
  }
332
 
333
  unset($allPosts);
@@ -342,7 +349,7 @@ if (@$_REQUEST['action'] == 'create_edit')
342
  <td>
343
  <ol>
344
  <?php
345
- if (is_array(@$experiment['extraData']['post_title']['titles']))
346
  {
347
  foreach ($experiment['extraData']['post_title']['titles'] as $key => $variation)
348
  {
@@ -391,7 +398,13 @@ if (@$_REQUEST['action'] == 'create_edit')
391
 
392
  foreach ($allPages as $page)
393
  {
394
- echo '<option value="' . absint($page->ID) . '"' . ($page->ID == @$experiment['extraData']['page_title']['post_id'] ? ' selected="selected"' : '') . '>' . htmlentities($page->post_title) . '</option>';
 
 
 
 
 
 
395
  }
396
 
397
  unset($allPages);
@@ -406,7 +419,7 @@ if (@$_REQUEST['action'] == 'create_edit')
406
  <td>
407
  <ol>
408
  <?php
409
- if (is_array(@$experiment['extraData']['page_title']['titles']))
410
  {
411
  foreach ($experiment['extraData']['page_title']['titles'] as $key => $variation)
412
  {
@@ -450,7 +463,7 @@ if (@$_REQUEST['action'] == 'create_edit')
450
  <td>
451
  <ol>
452
  <?php
453
- if (is_array(@$experiment['extraData']['css']['code']))
454
  {
455
  foreach ($experiment['extraData']['css']['code'] as $key => $variation)
456
  {
@@ -502,12 +515,10 @@ if (@$_REQUEST['action'] == 'create_edit')
502
  <?php
503
  $allThemes = wp_get_themes();
504
 
505
- $durations = explode(":", gmdate('j:H:i:s', @$goal['visitTimeOnSiteDetails']['comparisonValue']));
506
-
507
  $currentTheme = wp_get_theme();
508
  $currentThemeTextDomain = $currentTheme->get('TextDomain');
509
 
510
- if (is_array(@$experiment['extraData']['theme']['themes']))
511
  {
512
  foreach ($experiment['extraData']['theme']['themes'] as $key => $variation)
513
  {
21
  $experiment = array();
22
  $readOnly = '';
23
 
24
+ $experimentId = (empty($_REQUEST['id']) ? '' : sanitize_text_field($_REQUEST['id']));
25
 
26
  if ($experimentId && $accountId = DigitalPointBetterAnalytics_Model_Reporting::getSiteAccountId())
27
  {
327
 
328
  foreach ($allPosts as $post)
329
  {
330
+
331
+ $postId = 0;
332
+ if (!empty($experiment['extraData']['post_title']) && !empty($experiment['extraData']['post_title']['post_id']))
333
+ {
334
+ $postId = $experiment['extraData']['page_title']['post_id'];
335
+ }
336
+
337
+ echo '<option value="' . absint($post->ID) . '"' . ($post->ID == $postId ? ' selected="selected"' : '') . '>' . htmlentities($post->post_title) . '</option>';
338
  }
339
 
340
  unset($allPosts);
349
  <td>
350
  <ol>
351
  <?php
352
+ if (!empty($experiment['extraData']['post_title']) && !empty($experiment['extraData']['post_title']['titles']) && is_array($experiment['extraData']['post_title']['titles']))
353
  {
354
  foreach ($experiment['extraData']['post_title']['titles'] as $key => $variation)
355
  {
398
 
399
  foreach ($allPages as $page)
400
  {
401
+ $postId = 0;
402
+ if (!empty($experiment['extraData']['page_title']) && !empty($experiment['extraData']['page_title']['post_id']))
403
+ {
404
+ $postId = $experiment['extraData']['page_title']['post_id'];
405
+ }
406
+
407
+ echo '<option value="' . absint($page->ID) . '"' . ($page->ID == $postId ? ' selected="selected"' : '') . '>' . htmlentities($page->post_title) . '</option>';
408
  }
409
 
410
  unset($allPages);
419
  <td>
420
  <ol>
421
  <?php
422
+ if (!empty($experiment['extraData']['page_title']) && !empty($experiment['extraData']['page_title']['titles']) && is_array($experiment['extraData']['page_title']['titles']))
423
  {
424
  foreach ($experiment['extraData']['page_title']['titles'] as $key => $variation)
425
  {
463
  <td>
464
  <ol>
465
  <?php
466
+ if (!empty($experiment['extraData']['css']) && !empty($experiment['extraData']['css']['code']) && is_array($experiment['extraData']['css']['code']))
467
  {
468
  foreach ($experiment['extraData']['css']['code'] as $key => $variation)
469
  {
515
  <?php
516
  $allThemes = wp_get_themes();
517
 
 
 
518
  $currentTheme = wp_get_theme();
519
  $currentThemeTextDomain = $currentTheme->get('TextDomain');
520
 
521
+ if (!empty($experiment['extraData']['theme']) && !empty($experiment['extraData']['theme']['themes']) && is_array($experiment['extraData']['theme']['themes']))
522
  {
523
  foreach ($experiment['extraData']['theme']['themes'] as $key => $variation)
524
  {
library/DigitalPointBetterAnalytics/ViewAdmin/reports/heatmaps.php CHANGED
@@ -87,7 +87,6 @@
87
  foreach ($group as $key => $name)
88
  {
89
  echo '<option value="' . $key . '"' . selected($key, 'ga:sessions') . '>' . htmlentities($name) . '</option>';
90
-
91
  }
92
 
93
  echo '</optgroup>';
@@ -110,7 +109,6 @@
110
  foreach ($group as $key => $name)
111
  {
112
  echo '<option value="' . $key . '">' . htmlentities($name) . '</option>';
113
-
114
  }
115
 
116
  echo '</optgroup>';
87
  foreach ($group as $key => $name)
88
  {
89
  echo '<option value="' . $key . '"' . selected($key, 'ga:sessions') . '>' . htmlentities($name) . '</option>';
 
90
  }
91
 
92
  echo '</optgroup>';
109
  foreach ($group as $key => $name)
110
  {
111
  echo '<option value="' . $key . '">' . htmlentities($name) . '</option>';
 
112
  }
113
 
114
  echo '</optgroup>';
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, ab testing, ab tests, split testing, google analytics content experiments, content experiments
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.5
7
- Stable tag: 1.1.4
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -201,6 +201,20 @@ Thank you to all the individuals who have contributed translations for Better Go
201
  26. Advanced settings allow you to fine tune how the system works with Google Analytics.
202
 
203
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  = 1.1.4 =
205
  * Updated options container to pass W3C validation
206
  * Updated for WordPress 4.5
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, ab testing, ab tests, split testing, google analytics content experiments, content experiments
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.7.3
7
+ Stable tag: 1.2.0
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
201
  26. Advanced settings allow you to fine tune how the system works with Google Analytics.
202
 
203
  == Changelog ==
204
+ = 1.2.0 =
205
+ * Better checking for null settings
206
+ * Updated Google Analytics Reporting API library to utilize V4
207
+ * New Google Analytics dimensions available for Traffic Source charts: Referral Path, Full Referrer, Source / Medium, Has Social Source Referral
208
+ * New Google Analytics dimensions available for AdWords charts: Ad Group, Ad Slot, Ad Distribution Network, Ad Match Type, Ad Keyword Match Type, Ad Matched Query, Ad Placement Domain, Ad Placement URL, Ad Format, Ad Targeting Type, Ad Targeting Option, Ad Display URL, Ad Destination URL, AdWords Campaign ID, AdWords Ad Group ID, AdWords Creative ID, Ad Query Word Count
209
+ * New Google Analytics dimensions available for Platform charts: Browser Version, Browser Size, Data Source
210
+ * New Google Analytics dimensions available for Geo / Network charts: Metro, Network Domain, Network Location
211
+ * New Google Analytics dimensions available for Page Tracking charts: Path Path, Landing Page Path, Exit Page Path
212
+ * New Google Analytics dimensions available for Lifetime Value and Cohorts charts: Acquisition Campaign, Acquisition Medium, Acquisition Source / Medium, Acquisition Traffic Channel, Cohort
213
+ * Updated Chosen JavaScript library
214
+ * Fixed issue where Pro version sometimes wouldn't know what version number of itself was installed
215
+ * Updated for WordPress 4.7
216
+ * Added support for Google Analytics AMP (Accelerated Mobile Pages) tracking
217
+
218
  = 1.1.4 =
219
  * Updated options container to pass W3C validation
220
  * Updated for WordPress 4.5