Skip to content
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
8 changes: 7 additions & 1 deletion astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ import sitemap from '@astrojs/sitemap'
import tailwindcss from '@tailwindcss/vite'
import { defineConfig, fontProviders } from 'astro/config'
import expressiveCode from 'astro-expressive-code'
import partytown from '@astrojs/partytown'

// https://astro.build/config
export default defineConfig({
site: 'https://nodejsdesignpatterns.com',
integrations: [react(), expressiveCode(), sitemap()],
integrations: [
react(),
expressiveCode(),
sitemap(),
partytown({ config: { forward: ['dataLayer.push'] } }),
],
vite: {
plugins: [tailwindcss()],
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@astrojs/partytown": "^2.1.4",
"@astrojs/react": "^4.3.1",
"@astrojs/sitemap": "^3.6.0",
"@lucide/astro": "^0.522.0",
Expand Down
26 changes: 26 additions & 0 deletions pnpm-lock.yaml

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

22 changes: 22 additions & 0 deletions src/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,28 @@ const {
<Font cssVariable="--font-base-sans" preload />
<Font cssVariable="--font-base-serif" preload />
<Font cssVariable="--font-base-mono" preload />

<!-- Google tag (gtag.js) -->
<script
is:inline
type="text/partytown"
src="https://www.googletagmanager.com/gtag/js?id=G-NFE37ZH2W3"></script>
<script is:inline type="text/partytown">
window.dataLayer = window.dataLayer || []
function gtag() {
// eslint-disable-next-line no-undef
dataLayer.push(arguments)
}
gtag('js', new Date())
// Disable all tracking by default
gtag('consent', 'default', {
ad_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
// analytics_storage: 'denied',
})
gtag('config', 'G-NFE37ZH2W3')
</script>
</head>
<body
class="antialiased transition-colors duration-300 bg-base-100 text-base-content"
Expand Down