Skip to content

Commit

Permalink
Add analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
combimauri committed Nov 28, 2023
1 parent 18be951 commit b7da882
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 14 deletions.
7 changes: 4 additions & 3 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { defineConfig } from "astro/config";

import tailwind from "@astrojs/tailwind";

import partytown from "@astrojs/partytown";

// https://astro.build/config
export default defineConfig({
integrations: [tailwind()],
});
integrations: [tailwind(), partytown()]
});
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"dependencies": {
"@astrojs/check": "^0.3.1",
"@astrojs/partytown": "^2.0.2",
"@astrojs/tailwind": "^5.0.2",
"astro": "^3.5.5",
"tailwindcss": "^3.3.5",
Expand Down
13 changes: 13 additions & 0 deletions src/components/GoogleAnalytics.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script
type="text/partytown"
async
src="https://www.googletagmanager.com/gtag/js?id=G-B35G6WPCX1"></script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());

gtag("config", "G-B35G6WPCX1");
</script>
24 changes: 13 additions & 11 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ interface Props {
}
const { title } = Astro.props;
import GoogleAnalytics from "../components/GoogleAnalytics.astro";
---

<!doctype html>
Expand Down Expand Up @@ -33,16 +34,17 @@ const { title } = Astro.props;
</head>
<body>
<slot />
</body>
</html>
<GoogleAnalytics < body />

<style is:global>
@font-face {
font-family: "Product Sans";
src: url("../assets/fonts/ProductSans-Regular.ttf") format("truetype");
}
<style is:global>
@font-face {
font-family: "Product Sans";
src: url("../assets/fonts/ProductSans-Regular.ttf") format("truetype");
}

body {
font-family: "Product Sans", sans-serif;
}
</style>
body {
font-family: "Product Sans", sans-serif;
}
</style>
</body>
</html>

0 comments on commit b7da882

Please sign in to comment.