Skip to content

Commit 3f96206

Browse files
committed
added GA
1 parent 43efddb commit 3f96206

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
build:
1111
name: Build Docusaurus
1212
runs-on: ubuntu-latest
13+
env:
14+
GA_ID: ${{ secrets.GA_ID }}
1315
steps:
1416
- uses: actions/checkout@v4
1517
with:

docusaurus.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import {themes as prismThemes} from 'prism-react-renderer';
22
import type {Config} from '@docusaurus/types';
33
import type * as Preset from '@docusaurus/preset-classic';
44

5+
// Access the environment variable
6+
const googleAnalyticsTrackingID = process.env.GA_ID;
7+
58
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
69

710
const config: Config = {
@@ -129,6 +132,12 @@ const config: Config = {
129132
theme: prismThemes.github,
130133
darkTheme: prismThemes.dracula,
131134
},
135+
gtag: googleAnalyticsTrackingID
136+
? {
137+
trackingID: googleAnalyticsTrackingID,
138+
anonymizeIP: true,
139+
}
140+
: undefined,
132141
} satisfies Preset.ThemeConfig,
133142
};
134143

0 commit comments

Comments
 (0)