Skip to content

Commit

Permalink
Added partytown and slight config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewdr committed Nov 8, 2024
1 parent c109e8e commit eac5d55
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 1 deletion.
10 changes: 9 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { visualizer } from "rollup-plugin-visualizer";

import preact from "@astrojs/preact";

import partytown from "@astrojs/partytown";

// https://astro.build/config

export default defineConfig({
Expand All @@ -14,8 +16,14 @@ export default defineConfig({
cssCodeSplit: true,
chunkSizeWarningLimit: 20,
},
optimizeDeps: {
force: true,
},
plugins: [visualizer()],
},

integrations: [preact()],
integrations: [
preact(),
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 @@
"format": "yarn biome check --write"
},
"dependencies": {
"@astrojs/partytown": "^2.1.2",
"@astrojs/preact": "^3.5.3",
"preact": "^10.24.3",
"react-snowfall": "^2.1.1"
Expand Down
10 changes: 10 additions & 0 deletions src/pages/about.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ import { Snow } from "../components/Snow.tsx";
<link rel="icon" type="image/x-icon" href="/elephant.jpg" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />

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

<title>{pageTitle}</title>
</head>
<body>
Expand Down
9 changes: 9 additions & 0 deletions src/pages/blog.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ import { Snow } from "../components/Snow.tsx";
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/x-icon" href="/elephant.jpg" />
<title>{pageTitle}</title>

<!-- Google tag (gtag.js) -->
<script type="text/partytown" src="https://www.googletagmanager.com/gtag/js?id=G-18TEL9N92D"></script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-18TEL9N92D');
</script>
</head>
<body>
<Navigation />
Expand Down
9 changes: 9 additions & 0 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ import { Snow } from "../components/Snow.tsx";
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>{pageTitle}</title>

<!-- Google tag (gtag.js) -->
<script type="text/partytown" src="https://www.googletagmanager.com/gtag/js?id=G-18TEL9N92D"></script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-18TEL9N92D');
</script>
</head>
<body>
<Navigation />
Expand Down
9 changes: 9 additions & 0 deletions src/pages/links.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ import { Snow } from "../components/Snow.tsx";
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>{pageTitle}</title>

<!-- Google tag (gtag.js) -->
<script type="text/partytown" src="https://www.googletagmanager.com/gtag/js?id=G-18TEL9N92D"></script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-18TEL9N92D');
</script>
</head>
<body>
<Navigation />
Expand Down
13 changes: 13 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@
unist-util-visit-parents "^6.0.1"
vfile "^6.0.3"

"@astrojs/partytown@^2.1.2":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@astrojs/partytown/-/partytown-2.1.2.tgz#2df6745eb6add076e721ebd7e32c1bcd28063d1f"
integrity sha512-1a9T5lqxtnrw0qLPo1KwliUvaaUzPNPtWucD8VxdwT7zqcpODFk1RzGgAgqVo+YhutFrTu/qclbtnOfXBuskjw==
dependencies:
"@builder.io/partytown" "^0.10.2"
mrmime "^2.0.0"

"@astrojs/preact@^3.5.3":
version "3.5.3"
resolved "https://registry.yarnpkg.com/@astrojs/preact/-/preact-3.5.3.tgz#91ff5f0aafedb79eaa311d8bae4e24c62dcc83d0"
Expand Down Expand Up @@ -342,6 +350,11 @@
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz#4c7afa90e3970213599b4095e62f87e5972b2340"
integrity sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==

"@builder.io/partytown@^0.10.2":
version "0.10.2"
resolved "https://registry.yarnpkg.com/@builder.io/partytown/-/partytown-0.10.2.tgz#102c909f805c945a638e249275003ef6ba828287"
integrity sha512-A9U+4PREWcS+CCYzKGIPovtGB/PBgnH/8oQyCE6Nr9drDJk6cMPpLQIEajpGPmG9tYF7N3FkRvhXm/AS9+0iKg==

"@emmetio/abbreviation@^2.3.3":
version "2.3.3"
resolved "https://registry.yarnpkg.com/@emmetio/abbreviation/-/abbreviation-2.3.3.tgz#ed2b88fe37b972292d6026c7c540aaf887cecb6e"
Expand Down

0 comments on commit eac5d55

Please sign in to comment.