analytcs
This commit is contained in:
@@ -124,7 +124,7 @@ export default async function RootLayout({
|
||||
suppressHydrationWarning
|
||||
>
|
||||
<head>
|
||||
<Script defer src="https://panel.ayris.tech/api/analytics/script" data-domain="kitebeachakyaka.com.tr" strategy="afterInteractive" />
|
||||
<Script defer src="/st.js" data-domain="kitebeachakyaka.com.tr" strategy="afterInteractive" />
|
||||
</head>
|
||||
<body className="min-h-full flex flex-col bg-background text-foreground" suppressHydrationWarning>
|
||||
<script
|
||||
|
||||
@@ -33,6 +33,14 @@ const nextConfig: NextConfig = {
|
||||
},
|
||||
],
|
||||
},
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: '/api/st',
|
||||
destination: 'https://panel.ayris.tech/api/analytics/collect',
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
(function() {
|
||||
var d = document.currentScript && document.currentScript.getAttribute('data-domain');
|
||||
if (!d) d = location.hostname;
|
||||
|
||||
function send(path, ref) {
|
||||
var payload = {
|
||||
domain: d,
|
||||
path: path,
|
||||
referrer: ref || document.referrer || ''
|
||||
};
|
||||
var url = '/api/st';
|
||||
if (navigator.sendBeacon) {
|
||||
navigator.sendBeacon(url, JSON.stringify(payload));
|
||||
} else {
|
||||
fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload), keepalive: true });
|
||||
}
|
||||
}
|
||||
|
||||
send(location.pathname, document.referrer);
|
||||
|
||||
var _push = history.pushState;
|
||||
history.pushState = function() {
|
||||
_push.apply(history, arguments);
|
||||
send(location.pathname, '');
|
||||
};
|
||||
window.addEventListener('popstate', function() {
|
||||
send(location.pathname, '');
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user