Skip to content

Commit 08f6884

Browse files
Add Google Analytics and update environment settings for production build (#557)
1 parent df4095b commit 08f6884

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
npm install
4545
- name: Build with npm
4646
run: |
47+
export NODE_ENV=production
4748
npm run build
4849
- name: Upload artifact
4950
uses: actions/upload-pages-artifact@v3

docusaurus.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,14 @@ const config: Config = {
275275
}
276276
},
277277
],
278+
// Google Analytics Plugin
279+
[
280+
'@docusaurus/plugin-google-gtag',
281+
{
282+
trackingID: 'G-QNT38TBH1M',
283+
anonymizeIP: true,
284+
},
285+
],
278286
// Old Url Redirects
279287
[
280288
'@docusaurus/plugin-client-redirects',

netlify.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[build]
22
publish = "build"
3-
command = "npm run update-preview-config && npm run build"
4-
environment = { NODE_VERSION = "20", NPM_VERSION = "9", NPM_FLAGS = "--no-audit --no-fund" }
3+
command = "npm run update-preview-config && npm run build --dev"
4+
environment = { NODE_VERSION = "20", NPM_VERSION = "9", NPM_FLAGS = "--no-audit --no-fund", NODE_ENV = "development" }

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"dependencies": {
2626
"@docusaurus/core": "3.9.2",
2727
"@docusaurus/plugin-client-redirects": "3.9.2",
28+
"@docusaurus/plugin-google-gtag": "^3.9.2",
2829
"@docusaurus/preset-classic": "3.9.2",
2930
"@docusaurus/theme-mermaid": "3.9.2",
3031
"@easyops-cn/docusaurus-search-local": "^0.52.1",

0 commit comments

Comments
 (0)