Skip to content

Commit

Permalink
Added google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-Ross committed Nov 19, 2023
1 parent 5c985f0 commit 45ff00c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
11 changes: 10 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,14 @@ import partytown from "@astrojs/partytown";
// https://astro.build/config
export default defineConfig({
site: 'https://harry.is-a.dev',
integrations: [mdx(), sitemap(), tailwind(), partytown()]
integrations: [
mdx(),
sitemap(),
tailwind(),
partytown({
config: {
forward: ["dataLayer.push"]
}
})
]
});
10 changes: 10 additions & 0 deletions src/components/BaseHead.astro
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,14 @@ const {
<meta property="twitter:description" content={description} />
<meta property="twitter:image" content={new URL(image, Astro.url)} />

<!-- Google tag (gtag.js) -->
<script type="text/partytown" src="https://www.googletagmanager.com/gtag/js?id=G-G9S3RYYR81"></script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-G9S3RYYR81');
</script>

<ViewTransitions />

0 comments on commit 45ff00c

Please sign in to comment.