!function(e){"use strict";function t(e){let t=new Proxy(new URLSearchParams(window.location.search),{get:(e,t)=>e.get(t)});return t[e]}function n(){return Date.now().toString(36)+Math.floor(1e12+9*Math.random()*1e12).toString(36)}function i(e){var t;return(t=(t=e.indexOf("://")>-1?e.split("/")[2]:e.split("/")[0]).split(":")[0]).replace("www.","")}var o,r,a,s=e("#swipe-pages-page").val(),c=e("#swipe-pages-funnel").val(),u=localStorage.getItem(c+"-view"),p=localStorage.getItem(s+"-view");function f(e,t,i,o,r){localStorage.getItem(t+"-view")||(i=n(),!window.spStopAnalytics&&t&&localStorage.setItem(t+"-view",i)),localStorage.getItem(e+"-view")||(o=n(),window.spStopAnalytics||!e||(localStorage.setItem(e+"-view",o),r=!0))}f(s,c,u,p,!1);var m={pageId:s,variantId:e("#swipe-pages-variant").val(),funnelId:e("#swipe-pages-funnel").val()||"",accountId:e("#swipe-pages-account").val(),subaccountId:e("#swipe-pages-subaccount").val(),domain:window.location.hostname,browser:function e(){var t=window.navigator.userAgent;if(t.match(/chrome|chromium|crios/i))return"Chrome";if(t.match(/firefox|fxios/i))return"Firefox";if(t.match(/safari/i))return"Safari";if(t.match(/opr\//i))return"Opera";if(t.match(/edg/i))return"Edge";else return"Other"}(),referrer:document.referrer?encodeURIComponent(document.referrer):"",screen:window.outerHeight+"x"+window.outerWidth,device:(o=window.navigator.userAgent,r=window.navigator.platform,a=null,-1!==["Macintosh","MacIntel","MacPPC","Mac68K"].indexOf(r)?a="Mac OS":-1!==["iPhone","iPad","iPod"].indexOf(r)?a="iOS":-1!==["Win32","Win64","Windows","WinCE"].indexOf(r)?a="Windows":/Android/.test(o)?a="Android":!a&&/Linux/.test(r)&&(a="Linux"),a),utm_source:t("utm_source"),utm_medium:t("utm_medium"),utm_campaign:t("utm_campaign"),utm_content:t("utm_content"),utm_term:t("utm_term"),clientId:u,sessionId:p,visit_time:Date.now(),timezone:new Date().getTimezoneOffset(),isUniqueVisit:!1},d=window.spAnalyticsConfig&&window.spAnalyticsConfig.apiEndPoint?window.spAnalyticsConfig.apiEndPoint:"https://events.swipepages.com/api/events";window.addEventListener("reInitSpEvents",function(){f(s,c,u,p,!1)}),window.spAnalytics={track:function t(n,i){if(!0===(i=i||{}).conversion){var o=[];if(localStorage.getItem("spConversion")){try{o=JSON.parse(localStorage.getItem("spConversion"))}catch(r){console.log(r)}-1!==o.indexOf(m.pageId)?i.conversion=!1:o.push(m.pageId)}else o.push(m.pageId);window.spStopAnalytics||localStorage.setItem("spConversion",JSON.stringify(o))}var a={};Object.keys(m).forEach(function(e){a[e]=m[e]}),i&&"object"==typeof i&&Object.keys(i).forEach(function(e){a[e]=i[e]}),localStorage.spWebhook&&(a.webhook=localStorage.spWebhook);var s=new Date;a.timestamp=Math.floor(s.getTime()/1e3);var c={event:n,properties:a};i.contact&&(c.user={id:i.contact}),navigator.sendBeacon?navigator.sendBeacon(d,JSON.stringify(c)):e.ajax(d,{method:"POST",dataType:"json",data:c,success:function(e){},error:function(e,t,n){console.log("Analytics error:",n)}})}}}(jQuery);