Skip to content

Commit f343f56

Browse files
committed
add google analytics
1 parent 747c102 commit f343f56

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/components/BaseHead.astro

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@ const { title, description, permalink } = Astro.props;
1313
const socialUrl = Astro.site.href + "assets/social.png";
1414
---
1515

16+
{
17+
import.meta.env.PROD && (
18+
<!-- Google tag (gtag.js) -->
19+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XB03VSSF7M"></script>
20+
<script>
21+
window.dataLayer = window.dataLayer || [];
22+
function gtag() {
23+
dataLayer.push(arguments);
24+
}
25+
gtag("js", new Date());
26+
27+
gtag("config", "G-XB03VSSF7M");
28+
</script>
29+
)
30+
}
31+
1632
<!-- Global Metadata -->
1733
<meta charset="utf-8" />
1834
<meta name="viewport" content="width=device-width" />

0 commit comments

Comments
 (0)