(function(l){l.fn.extend(window.WPD.ajaxsearchpro.plugin,{gaPageview:function(a){let c=this.gaGetTrackingID();if("undefined"==typeof ASP.analytics||"pageview"!=ASP.analytics.method)return!1;if(""!=ASP.analytics.string){let d="function"==typeof __gaTracker?__gaTracker:"function"==typeof ga?ga:!1,e="function"==typeof gtag?gtag:!1;window.location.origin||(window.location.origin=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""));let f=this.o.homeurl.replace(window.location.origin,
"");if(!1!==e)!1!==c&&c.forEach(function(g){e("config",g,{page_path:f+ASP.analytics.string.replace("{asp_term}",a)})});else if(!1!==d){let g={page:f+ASP.analytics.string.replace("{asp_term}",a),title:"Ajax Search"};!1!==c?c.forEach(function(b){d("create",b,"auto");d("send","pageview",g)}):d("send","pageview",g)}}},gaEvent:function(a,c){let d=this.gaGetTrackingID();if("undefined"==typeof ASP.analytics||"event"!=ASP.analytics.method)return!1;let e="function"==typeof gtag?gtag:!1,f="function"==typeof window.__gaTracker?
window.__gaTracker:"function"==typeof window.ga?window.ga:!1;if(!1===e&&!1===f)return!1;if("undefined"!=typeof ASP.analytics.event[a]&&1==ASP.analytics.event[a].active){let g={search_id:this.o.id,search_name:this.n("search").data("name"),phrase:this.n("text").val(),option_name:"",option_value:"",result_title:"",result_url:"",results_count:""},b={event_category:ASP.analytics.event[a].category,event_label:ASP.analytics.event[a].label,value:ASP.analytics.event[a].value};c=l.fn.extend(g,c);Object.keys(c).forEach(function(h){let k=
c[h];k=String(k).replace(/[\s\n\r]+/g," ").trim();Object.keys(b).forEach(function(m){b[m]=b[m].replace(new RegExp("{"+h+"}","gmi"),k)})});!1===e?!1!==d?d.forEach(function(h){f("create",h,"auto");f("send","event",b.event_category,ASP.analytics.event[a].action,b.event_label,b.value)}):f("send","event",b.event_category,ASP.analytics.event[a].action,b.event_label,b.value):!1!==d?d.forEach(function(h){b.send_to=h;e("event",ASP.analytics.event[a].action,b)}):e("event",ASP.analytics.event[a].action,b)}},
gaGetTrackingID:function(){if("undefined"==typeof ASP.analytics)return!1;if("undefined"!=typeof ASP.analytics.tracking_id&&""!=ASP.analytics.tracking_id)return[ASP.analytics.tracking_id];if(!1===("function"==typeof window.gtag?window.gtag:!1)&&"undefined"!=typeof window.ga&&"undefined"!=typeof window.ga.getAll){let a=[];window.ga.getAll().forEach(function(c){a.push(c.get("trackingId"))});return 0<a.length?a:!1}return!1}})})(WPD.dom);
