This commit is contained in:
2026-06-10 04:47:17 +03:00
parent 1c7817da8d
commit 10ca771311
3 changed files with 38 additions and 1 deletions
+1 -1
View File
@@ -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
+8
View File
@@ -33,6 +33,14 @@ const nextConfig: NextConfig = {
},
],
},
async rewrites() {
return [
{
source: '/api/st',
destination: 'https://panel.ayris.tech/api/analytics/collect',
},
];
},
};
export default nextConfig;
+29
View File
@@ -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, '');
});
})();