Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google analytics #27

Merged
merged 1 commit into from
Jan 23, 2024
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
10 changes: 9 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ import { defineConfig } from 'astro/config';
import vercel from "@astrojs/vercel/serverless";

import tailwind from "@astrojs/tailwind";
import partytown from '@astrojs/partytown'

// https://astro.build/config
export default defineConfig({
output: "server",
adapter: vercel(),
integrations: [tailwind()]
integrations: [
tailwind(),
partytown({
config: {
forward: ["dataLayer.push"],
},
})
]
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"@astrojs/node": "^5.3.3",
"@astrojs/partytown": "^2.0.4",
"@astrojs/tailwind": "^4.0.0",
"@astrojs/vercel": "^3.8.1",
"astro": "^2.8.1",
Expand Down
10 changes: 10 additions & 0 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ const { title } = Astro.props;
<meta name="description" content="Mindplex" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/logoFav.svg" />

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

gtag('config', 'G-SN4LWF0Y6J');
</script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;700&display=swap"
rel="stylesheet"
/>
<meta name="generator" content={Astro.generator} />

<title>{title}</title>
</head>
<body>
Expand Down
Loading