Skip to content

Commit

Permalink
add google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
bonfry committed Aug 29, 2024
1 parent 2fd964f commit 4325a81
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 2 deletions.
23 changes: 22 additions & 1 deletion .astro/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ declare module 'astro:content' {
collection: "staff";
data: InferEntrySchema<"staff">
} & { render(): Render[".md"] };
"domingo.md": {
id: "domingo.md";
slug: "domingo";
body: string;
collection: "staff";
data: InferEntrySchema<"staff">
} & { render(): Render[".md"] };
"federico.md": {
id: "federico.md";
slug: "federico";
body: string;
collection: "staff";
data: InferEntrySchema<"staff">
} & { render(): Render[".md"] };
"laura.md": {
id: "laura.md";
slug: "laura";
Expand Down Expand Up @@ -219,6 +233,13 @@ declare module 'astro:content' {
collection: "staff";
data: InferEntrySchema<"staff">
} & { render(): Render[".md"] };
"piernicola.md": {
id: "piernicola.md";
slug: "piernicola";
body: string;
collection: "staff";
data: InferEntrySchema<"staff">
} & { render(): Render[".md"] };
"simone.md": {
id: "simone.md";
slug: "simone";
Expand All @@ -236,5 +257,5 @@ declare module 'astro:content' {

type AnyEntryMap = ContentEntryMap & DataEntryMap;

export type ContentConfig = typeof import("../src/content/config.js");
export type ContentConfig = typeof import("./../src/content/config.js");
}
8 changes: 7 additions & 1 deletion dev.astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@ import tailwind from "@astrojs/tailwind";
import { defineConfig } from "astro/config";
import react from "@astrojs/react";
import AstroPWA from "@vite-pwa/astro";
import partytown from "@astrojs/partytown";
import { WebsiteConfig } from "./src/config";

// https://astro.build/config
export default defineConfig({
i18n: {
defaultLocale: "it",
locales: ["it", "en"],
routing:{
routing: {
prefixDefaultLocale: false,
}
},
integrations: [
partytown({
config: {
forward: ["dataLayer.push"],
},
}),
mdx(),
tailwind({
applyBaseStyles: false,
Expand Down
23 changes: 23 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 @@ -14,6 +14,7 @@
"license": "ISC",
"dependencies": {
"@astrojs/mdx": "^3.1.3",
"@astrojs/partytown": "^2.1.2",
"@astrojs/react": "^3.6.0",
"@astrojs/sitemap": "^3.1.6",
"@astrojs/tailwind": "^5.1.0",
Expand Down
6 changes: 6 additions & 0 deletions prod.astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import mdx from "@astrojs/mdx";
import partytown from "@astrojs/partytown";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import AstroPWA from "@vite-pwa/astro";
Expand All @@ -19,6 +20,11 @@ export default defineConfig({
}
},
integrations: [
partytown({
config: {
forward: ["dataLayer.push"],
},
}),
mdx(),
sitemap(),
tailwind(),
Expand Down
10 changes: 10 additions & 0 deletions src/components/Common/PageHead.astro
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ const {
} = Astro.props;
---

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

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

<title> {title ?? DEVFEST_NAME}</title>

<link rel="icon" type="image/x-icon" href="/assets/favicon.ico" />
Expand Down

0 comments on commit 4325a81

Please sign in to comment.