Skip to content

Commit 6c41ee5

Browse files
authored
Merge pull request #88 from dusk-network/add-analytics
Add Google Analytics
2 parents f47ad25 + 8ed16f3 commit 6c41ee5

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

astro.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import rehypeMathjax from 'rehype-mathjax';
55
import defaultSidebar from "./src/sidebars/defaultSidebar";
66
import starlightLinksValidator from "starlight-links-validator";
77

8+
const googleAnalyticsId = 'G-63RJYNDBL1';
9+
810
// https://astro.build/config
911
export default defineConfig({
1012
site: "https://docs.dusk.network",
@@ -48,6 +50,26 @@ export default defineConfig({
4850
tableOfContents: { minHeadingLevel: 2, maxHeadingLevel: 4 },
4951
sidebar: defaultSidebar,
5052
plugins: [starlightLinksValidator()],
53+
head: [
54+
// Adding google analytics
55+
{
56+
tag: 'script',
57+
attrs: {
58+
async: true,
59+
src: `https://www.googletagmanager.com/gtag/js?id=${googleAnalyticsId}`,
60+
},
61+
},
62+
{
63+
tag: 'script',
64+
content: `
65+
window.dataLayer = window.dataLayer || [];
66+
function gtag(){dataLayer.push(arguments);}
67+
gtag('js', new Date());
68+
69+
gtag('config', '${googleAnalyticsId}');
70+
`,
71+
},
72+
],
5173
}),
5274
],
5375
});

0 commit comments

Comments
 (0)