@stacksjs/analytics 0.70.380 → 0.71.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var W=1;function j(m){if(!m.siteId||!m.apiEndpoint)return"";let x=q(m.siteId),w=q(m.apiEndpoint),P=m.honorDnt?'if(n.doNotTrack==="1")return;':"",v=m.trackHashChanges?"w.addEventListener('hashchange',pv);":"",y=m.trackOutboundLinks?`
|
|
3
3
|
d.addEventListener('click',function(e){
|
|
4
4
|
var a=e.target.closest('a');
|
|
5
5
|
if(a&&a.hostname!==location.hostname){
|
|
6
6
|
t('outbound',{url:a.href});
|
|
7
7
|
}
|
|
8
8
|
});`:"";return`<!-- Stacks Self-Hosted Analytics -->
|
|
9
|
-
<script data-site="${x}" data-api="${
|
|
9
|
+
<script data-site="${x}" data-api="${w}" defer>
|
|
10
10
|
(function(){
|
|
11
11
|
'use strict';
|
|
12
12
|
var d=document,w=window,n=navigator,s=d.currentScript;
|
|
13
13
|
var site=s.dataset.site,api=s.dataset.api;
|
|
14
|
-
${
|
|
14
|
+
${P}
|
|
15
15
|
var q=[],sid=Math.random().toString(36).slice(2);
|
|
16
16
|
function t(e,p){
|
|
17
17
|
var x=new XMLHttpRequest();
|
|
@@ -30,13 +30,13 @@ var B=1;function F(m){if(!m.siteId||!m.apiEndpoint)return"";let x=q(m.siteId),W=
|
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
32
|
function pv(){t('pageview');}
|
|
33
|
-
${
|
|
33
|
+
${v}
|
|
34
34
|
${y}
|
|
35
35
|
if(d.readyState==='complete')pv();
|
|
36
36
|
else w.addEventListener('load',pv);
|
|
37
37
|
w.stacksAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
38
38
|
})();
|
|
39
|
-
</script>`}function
|
|
39
|
+
</script>`}function z(m){if(!m.siteId||!m.apiEndpoint)return[];return[["script",{"data-site":m.siteId,"data-api":m.apiEndpoint,defer:"",innerHTML:R(m)}]]}function R(m){let x=m.honorDnt?'if(n.doNotTrack==="1")return;':"",w=m.trackHashChanges?"w.addEventListener('hashchange',pv);":"",P=m.trackOutboundLinks?"d.addEventListener('click',function(e){var a=e.target.closest('a');if(a&&a.hostname!==location.hostname){t('outbound',{url:a.href});}});":"";return`(function(){
|
|
40
40
|
'use strict';
|
|
41
41
|
var d=document,w=window,n=navigator,s=d.currentScript;
|
|
42
42
|
var site=s.dataset.site,api=s.dataset.api;
|
|
@@ -49,9 +49,9 @@ x.setRequestHeader('Content-Type','application/json');
|
|
|
49
49
|
var safeUrl=location.origin+location.pathname+location.hash;var safeRef=d.referrer?d.referrer.split('?')[0]:'';x.send(JSON.stringify({s:site,sid:sid,e:e,p:p||{},u:safeUrl,r:safeRef,t:d.title,sw:screen.width,sh:screen.height}));
|
|
50
50
|
}
|
|
51
51
|
function pv(){t('pageview');}
|
|
52
|
-
${
|
|
53
|
-
${
|
|
52
|
+
${w}
|
|
53
|
+
${P}
|
|
54
54
|
if(d.readyState==='complete')pv();
|
|
55
55
|
else w.addEventListener('load',pv);
|
|
56
56
|
w.stacksAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
57
|
-
})();`}function q(m){return m.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}export{
|
|
57
|
+
})();`}function q(m){return m.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}export{K as referrerHost,J as recordPageview,H as isPageviewRequest,z as getSelfHostedAnalyticsHead,j as generateSelfHostedScript,W as fathomWip,G as classifyAgent};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/analytics",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.71.1",
|
|
6
6
|
"description": "Stacks Analytics. Privacy-friendly.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -51,6 +51,6 @@
|
|
|
51
51
|
"prepublishOnly": "bun run build"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"better-dx": "^0.2.
|
|
54
|
+
"better-dx": "^0.2.23"
|
|
55
55
|
}
|
|
56
56
|
}
|