-
Notifications
You must be signed in to change notification settings - Fork 7.6k
feat(docs): wire Google Analytics into the published docs site #1482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,8 +30,8 @@ export default withMermaid( | |
| ['meta', { property: 'og:description', content: '96.6% LongMemEval recall. Zero API calls. Local, free, open source.' }], | ||
| ['meta', { property: 'og:image', content: `${docsBase}mempalace_logo.png` }], | ||
| ...(gaId ? [ | ||
| ['script', { async: '', src: `https://www.googletagmanager.com/gtag/js?id=${gaId}` }], | ||
| ['script', {}, `window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', '${gaId}');`], | ||
| ['script', { async: '', src: `https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(gaId)}` }], | ||
| ['script', {}, `window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', ${JSON.stringify(gaId)});`], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While using
Comment on lines
32
to
+34
|
||
| ] as const : []), | ||
| ], | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request description mentions passing
MEMPALACE_DOCS_GA_IDfrom the deploy workflow, but the necessary changes to the GitHub Actions workflow files (typically located in.github/workflows/) are not included in this PR. \n\nIn GitHub Actions, repository variables are not automatically injected into the environment ofrunsteps. To ensure the analytics ID is available during the VitePress build, you must explicitly map it in your workflow file:\n\nyaml\n- name: Build Docs\n run: npm run docs:build\n env:\n MEMPALACE_DOCS_GA_ID: ${{ vars.MEMPALACE_DOCS_GA_ID }}\n\n\nWithout this,gaIdwill remain undefined in the production build, and the Google Analytics tags will not be rendered.