Skip to content

Commit 8f460b5

Browse files
committed
feat(analytics): add GA4 404 error tracking
1 parent 8e06f79 commit 8f460b5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/pages/404.astro

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ import { SITE_TITLE } from '../consts';
2828
window.location.replace('/en/blog/' + slug + '/');
2929
return;
3030
}
31+
32+
// GA4 404 에러 추적
33+
if (typeof gtag === 'function') {
34+
gtag('event', '404_error', {
35+
page_path: path,
36+
page_referrer: document.referrer || '(direct)'
37+
});
38+
}
3139
})();
3240
</script>
3341
<style>

0 commit comments

Comments
 (0)