Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ Use Astro conventions:

---

## Astro Rules

- Use Astro stable APIs only
- Do not use experimental features
- Avoid latest syntax unless verified

---

## Rules

Prefer:
Expand Down
27 changes: 27 additions & 0 deletions src/components/GoogleTag.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
// Frontmatter 영역에서 프로덕션 환경인지 확인
const isProd = import.meta.env.PROD;
---

{
isProd && (
<>
{/* Google tag (gtag.js) */}
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-YS8S4VBN55"
/>

<script
set:html={`
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-YS8S4VBN55');
`}
/>
</>
)
}
2 changes: 2 additions & 0 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import '../styles/global.css';
import ThemeToggle from '../components/ThemeToggle.astro';
import Link from '../components/Link.astro';
import GoogleTag from '../components/GoogleTag.astro';

interface Props {
title?: string;
Expand Down Expand Up @@ -72,6 +73,7 @@ const brandHref = isEnglish ? '/en/' : '/';
document.documentElement.classList.remove('dark');
}
</script>
<GoogleTag />
</head>
<body class="m-0 min-w-[320px]">
<header
Expand Down
Loading