diff --git a/pkg/embedded/static/wa.js b/pkg/embedded/static/wa.js index d01665f..54a9797 100644 --- a/pkg/embedded/static/wa.js +++ b/pkg/embedded/static/wa.js @@ -1 +1 @@ -(function(){var a,c=document.currentScript,e=location,t=c.dataset,g=new URL(c.src),d="no-referrer-when-downgrade",u="POST",v=e.protocol,r=t.prismeUrl||g.origin,o=t.domain||e.host,p=t.path||e.pathname,s=!!t.manual||!1,f=t.visitorId,h=document.referrer.replace(e.host,o),m=1;function i(t){return t||(t={}),t.domain||(s?t.domain=e.host:t.domain=o),t.path||(s||m>1?t.path=e.pathname:t.path=p),t.visitorId||(t.visitorId=f),t.url=v.concat("//",t.domain,t.path,e.search),t}function l(e,t){return t["Access-Control-Max-Age"]=3600,t["X-Prisme-Referrer"]=e.url,e.visitorId&&(t["X-Prisme-Visitor-Id"]=e.visitorId.toString(),e.anonymous==!0&&(t["X-Prisme-Visitor-Anon"]="1")),t}function n(e){e=i(e),fetch(r.concat("/api/v1/events/pageviews"),{method:u,headers:l(e,{"X-Prisme-Document-Referrer":h}),keepalive:!0,referrerPolicy:d}),h=e.url,m++}window.prisme={pageview:n,trigger(e,t,n){n=i(n),fetch(r.concat("/api/v1/events/custom/",e),{method:u,headers:l(n,{"Content-Type":"application/json"}),keepalive:!0,referrerPolicy:d,body:JSON.stringify(t)})}},s||(delete window.prisme.pageview,n(),window.history&&(a=window.history.pushState,window.history.pushState=function(){a.apply(window.history,arguments),n()},window.addEventListener("popstate",n)))})() \ No newline at end of file +(function(){var o,i,l,f,u=document.currentScript,e=location,t=u.dataset,v=new URL(u.src),a="no-referrer-when-downgrade",d="POST",g=e.protocol,r=t.prismeUrl||v.origin,c=t.domain||e.host,p=t.path||e.pathname,n=!!t.manual&&t.manual!=="false"||!1;console.log("manual",n),l=t.visitorId,i=document.referrer.replace(e.host,c),o=1;function h(t){return t||(t={}),t.domain||(n?t.domain=e.host:t.domain=c),t.path||(n||o>1?t.path=e.pathname:t.path=p),t.visitorId||(t.visitorId=l),t.url=g.concat("//",t.domain,t.path,e.search),t}function m(e,t){return t["Access-Control-Max-Age"]=3600,t["X-Prisme-Referrer"]=e.url,e.visitorId&&(t["X-Prisme-Visitor-Id"]=e.visitorId.toString()),t}function s(e){e=h(e),fetch(r.concat("/api/v1/events/pageviews"),{method:d,headers:m(e,{"X-Prisme-Document-Referrer":i}),keepalive:!0,referrerPolicy:a}),i=e.url,o++}window.prisme={pageview:s,trigger(e,t,n){n=h(n),fetch(r.concat("/api/v1/events/custom/",e),{method:d,headers:m(n,{"Content-Type":"application/json"}),keepalive:!0,referrerPolicy:a,body:JSON.stringify(t)})}},n||(delete window.prisme.pageview,s(),window.history&&(f=window.history.pushState,window.history.pushState=function(){f.apply(window.history,arguments),s()},window.addEventListener("popstate",s)))})() \ No newline at end of file diff --git a/tracker/web_analytics.js b/tracker/web_analytics.js index e0d7c7c..4c22696 100644 --- a/tracker/web_analytics.js +++ b/tracker/web_analytics.js @@ -17,7 +17,7 @@ // Path of current page. var path = currentScriptDataset.path || loc.pathname; // Enable/disable manual tracking. - var manual = !!currentScriptDataset.manual || false + var manual = (!!currentScriptDataset.manual && currentScriptDataset.manual !== "false") || false // Visitor ID. var visitorId = currentScriptDataset.visitorId; @@ -54,9 +54,6 @@ if (options.visitorId) { headers["X-Prisme-Visitor-Id"] = options.visitorId.toString() - if (options.anonymous == true) { - headers["X-Prisme-Visitor-Anon"] = "1" - } } return headers