Skip to content

Commit bce881e

Browse files
committed
added google analytics
1 parent 71ac0c9 commit bce881e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

astro.config.mjs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from 'astro/config';
22
import starlightLinksValidator from 'starlight-links-validator';
33
import starlight from '@astrojs/starlight';
4-
4+
const googleAnalyticsId = 'G-FPWQ35ME85';
55

66
export default defineConfig({
77
site: "https://rcac-bioinformatics.github.io",
@@ -28,6 +28,25 @@ export default defineConfig({
2828
}
2929
}
3030
],
31+
head: [
32+
// Adding google analytics
33+
{
34+
tag: 'script',
35+
attrs: {
36+
src: `https://www.googletagmanager.com/gtag/js?id=${googleAnalyticsId}`,
37+
},
38+
},
39+
{
40+
tag: 'script',
41+
content: `
42+
window.dataLayer = window.dataLayer || [];
43+
function gtag(){dataLayer.push(arguments);}
44+
gtag('js', new Date());
45+
46+
gtag('config', '${googleAnalyticsId}');
47+
`,
48+
},
49+
],
3150
logo: {
3251
light: './src/assets/logo-light.png',
3352
dark: './src/assets/logo-dark.png',

0 commit comments

Comments
 (0)