Algolia, PostHog and Google Analytics#203
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds environment-driven analytics/search to VitePress, a CookieConsent component injected into the theme Layout, removes multiple Plane One docs, updates self-hosting docs formatting, adds vercel redirects and .env.example, updates .gitignore, and tweaks a troubleshooting header and one bullet. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Browser
participant CookieConsent as CookieConsent.vue
participant Analytics as Analytics (gtag / PostHog)
Browser->>CookieConsent: mount()
CookieConsent->>Browser: read localStorage (plane-docs-cookie-consent)
alt stored = granted
CookieConsent->>Analytics: enable gtag & init PostHog (if key present)
else stored = denied
CookieConsent->>Analytics: ensure PostHog disabled, gtag not permitted
else no decision
CookieConsent->>Browser: show banner (Accept / Decline)
User->>CookieConsent: click Accept
CookieConsent->>Browser: write localStorage = granted
CookieConsent->>Analytics: init/enable analytics
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@docs/.vitepress/config.mts`:
- Around line 48-53: Gate Google Analytics initialization behind explicit user
consent: modify the two script entries that inject gtag (the ['script', ...]
entries and the inline gtag setup invoking gtag('config')) to first set consent
defaults to denied (use gtag('consent', 'default', {ad_storage:'denied',
analytics_storage:'denied'})) and remove or delay the gtag('config') call;
implement a consent callback (or expose a function like enableGtagConsent())
that upon user opt-in calls gtag('consent','update', {ad_storage:'granted',
analytics_storage:'granted'}) and then calls gtag('config', 'G-JF828SKW90') so
analytics are only configured after consent.
🧹 Nitpick comments (1)
docs/.vitepress/config.mts (1)
631-637: Algolia search-only keys are designed to be publicly committed; consider env injection for easier rotation.This appears to be a search-only API key (correct for a public docs search provider). Algolia and DocSearch explicitly state that search-only keys are safe to share publicly, including in git. However, using an environment variable (
process.env.ALGOLIA_SEARCH_KEY) would simplify future rotation without requiring a git commit. This is optional rather than urgent.♻️ Env-injected key (optional)
options: { appId: 'AXICJJC8RP', - apiKey: '23df4157dee1d9a8d435cadd6cae3f26', + apiKey: process.env.ALGOLIA_SEARCH_KEY ?? '23df4157dee1d9a8d435cadd6cae3f26', indexName: 'plane_developer_docs', searchParameters: { facetFilters: [] }, insights: true,
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@docs/.vitepress/config.mts`:
- Line 31: The config sets lang: 'root', which is not a valid BCP 47 tag and
will produce improper <html lang="">; update the exported VitePress config
object (the lang property) to a valid BCP 47 tag such as 'en' or 'en-US' (e.g.,
replace 'root' with 'en' or 'en-US') so screen readers and SEO receive a correct
language attribute.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@docs/.vitepress/config.mts`:
- Around line 628-635: The Algolia credentials are hardcoded in the
search.options object (appId and apiKey) — replace the literal values for appId
and apiKey with environment variables (e.g., read from process.env or Vite's
import.meta.env) so search.options.appId and search.options.apiKey pull from
ALGOLIA_APP_ID and ALGOLIA_SEARCH_KEY at build time; keep indexName and insights
as-is, update docs/deployment settings to declare those env vars
(ALGOLIA_APP_ID, ALGOLIA_SEARCH_KEY) and ensure CI/Vercel build config injects
them for production builds.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@vercel.json`:
- Around line 52-59: Duplicate redirect entries for source
"/plane-one/manage/advanced-deploy" -> "/self-hosting/overview" exist in
vercel.json; remove one of the identical redirect objects so only a single
mapping remains, and ensure the redirects array stays valid JSON (no stray
trailing commas) after deletion.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@docs/.vitepress/config.mts`:
- Around line 55-59: The PostHog project key is hardcoded in the inline script
(the ['script', {}, `... posthog.init('phc_...') ...`] entry) which prevents
rotation and bypasses consent; change posthog.init to read the key from an
environment variable (e.g., POSTHOG_KEY via import.meta.env or the existing env
loader used in config.mts) and add the same consent gating logic you use for
Google Analytics so the initialization only runs when analytics consent is
given; update deployment docs to document POSTHOG_KEY alongside Algolia vars and
ensure the change touches the inline script block and the posthog.init call.
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Fix all issues with AI agents
In @.env.example:
- Around line 4-7: The dotenv-linter complains about unsorted keys in
.env.example; reorder the Algolia variables VITE_ALGOLIA_APP_ID,
VITE_ALGOLIA_API_KEY, and VITE_ALGOLIA_INDEX_NAME into alphabetical order (or
the project’s required ordering) so the three entries are sorted consistently in
the file; update the block containing those symbols so the linter no longer
flags them.
In `@docs/self-hosting/govern/custom-domain.md`:
- Around line 91-93: Replace the inline backticked snippet that currently shows
"`bash sudo prime-cli restart`" with a proper fenced code block: add a
opening fence with ```bash before the command and a closing ``` after it so the
line containing "sudo prime-cli restart" is rendered as a bash code block;
update the markdown around the existing snippet that references `bash` and `sudo
prime-cli restart` accordingly.
In `@docs/self-hosting/methods/coolify.md`:
- Line 20: The heading contains a typo: change the phrase "Download the required
depoyment files" to "Download the required deployment files" in the
docs/self-hosting/methods/coolify.md content so the word "depoyment" is
corrected to "deployment" in that list item; update the markdown text
accordingly.
In `@docs/self-hosting/upgrade-from-community.md`:
- Around line 95-107: The env block under "Configure object storage" (the
`#DATASTORE SETTINGS` section) is malformed and breaking Markdown linting; wrap
the environment variables in a proper fenced code block by starting with
"```env" before USE_MINIO and ending with "```" after AWS_S3_BUCKET_NAME, then
place the info callout (`:::info` ... `:::`) on its own lines after that closing
fence so the callout is rendered correctly; ensure there is a blank line between
the closing ``` and the `:::info` callout for proper parsing.
- Around line 51-73: The fenced code blocks containing the single-line "cd
~/ce-backup" and the multi-line shell script beginning with
"TARGET_DIR=/opt/plane/data" should include a language identifier for Markdown
linting and readability; update the opening backticks from ``` to ```bash for
both blocks so they become ```bash cd ~/ce-backup ```bash and ```bash
(script...) ```bash respectively, leaving the block contents unchanged and
preserving the closing triple backticks.
🧹 Nitpick comments (1)
docs/.vitepress/theme/components/CookieConsent.vue (1)
70-79: Set explicit button types to avoid accidental form submits.
If the banner ever renders inside a form, defaultsubmitbehavior could fire.Suggested tweak
- <button class="consent-btn consent-btn-decline" `@click`="decline">Decline</button> - <button class="consent-btn consent-btn-accept" `@click`="accept">Accept</button> + <button type="button" class="consent-btn consent-btn-decline" `@click`="decline">Decline</button> + <button type="button" class="consent-btn consent-btn-accept" `@click`="accept">Accept</button>
| # Algolia Search | ||
| VITE_ALGOLIA_APP_ID= | ||
| VITE_ALGOLIA_API_KEY= | ||
| VITE_ALGOLIA_INDEX_NAME= |
There was a problem hiding this comment.
Reorder Algolia keys to satisfy dotenv-linter.
Proposed fix
# Algolia Search
-VITE_ALGOLIA_APP_ID=
VITE_ALGOLIA_API_KEY=
+VITE_ALGOLIA_APP_ID=
VITE_ALGOLIA_INDEX_NAME=📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Algolia Search | |
| VITE_ALGOLIA_APP_ID= | |
| VITE_ALGOLIA_API_KEY= | |
| VITE_ALGOLIA_INDEX_NAME= | |
| # Algolia Search | |
| VITE_ALGOLIA_API_KEY= | |
| VITE_ALGOLIA_APP_ID= | |
| VITE_ALGOLIA_INDEX_NAME= |
🧰 Tools
🪛 dotenv-linter (4.0.0)
[warning] 6-6: [UnorderedKey] The VITE_ALGOLIA_API_KEY key should go before the VITE_ALGOLIA_APP_ID key
(UnorderedKey)
🤖 Prompt for AI Agents
In @.env.example around lines 4 - 7, The dotenv-linter complains about unsorted
keys in .env.example; reorder the Algolia variables VITE_ALGOLIA_APP_ID,
VITE_ALGOLIA_API_KEY, and VITE_ALGOLIA_INDEX_NAME into alphabetical order (or
the project’s required ordering) so the three entries are sorted consistently in
the file; update the block containing those symbols so the linter no longer
flags them.
| ### Procedure | ||
|
|
||
| 1. **Download the required depoyment files** | ||
| 1. **Download the required depoyment files** |
There was a problem hiding this comment.
Fix typo: “depoyment” → “deployment”.
Proposed fix
-1. **Download the required depoyment files**
+1. **Download the required deployment files**📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 1. **Download the required depoyment files** | |
| 1. **Download the required deployment files** |
🤖 Prompt for AI Agents
In `@docs/self-hosting/methods/coolify.md` at line 20, The heading contains a
typo: change the phrase "Download the required depoyment files" to "Download the
required deployment files" in the docs/self-hosting/methods/coolify.md content
so the word "depoyment" is corrected to "deployment" in that list item; update
the markdown text accordingly.
| 1. Start any command-line interface like Terminal and go into the folder with the back-up files. | ||
| ``` | ||
| cd ~/ce-backup | ||
| ``` | ||
| ``` | ||
| cd ~/ce-backup | ||
| ``` | ||
| 2. Copy and paste the script below on Terminal and hit Enter. | ||
| ``` | ||
| TARGET_DIR=/opt/plane/data | ||
| sudo mkdir -p $TARGET_DIR | ||
| for FILE in *.tar.gz; do | ||
| if [ -e "$FILE" ]; then | ||
| tar -xzvf "$FILE" -C "$TARGET_DIR" | ||
| else | ||
| echo "No .tar.gz files found in the current directory." | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| mv $TARGET_DIR/pgdata/ $TARGET_DIR/db | ||
| mv $TARGET_DIR/redisdata/ $TARGET_DIR/redis | ||
| mkdir -p $TARGET_DIR/minio | ||
| mv $TARGET_DIR/uploads/ $TARGET_DIR/minio/uploads/ | ||
| ``` | ||
|
|
||
| ``` | ||
| TARGET_DIR=/opt/plane/data | ||
| sudo mkdir -p $TARGET_DIR | ||
| for FILE in *.tar.gz; do | ||
| if [ -e "$FILE" ]; then | ||
| tar -xzvf "$FILE" -C "$TARGET_DIR" | ||
| else | ||
| echo "No .tar.gz files found in the current directory." | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| mv $TARGET_DIR/pgdata/ $TARGET_DIR/db | ||
| mv $TARGET_DIR/redisdata/ $TARGET_DIR/redis | ||
| mkdir -p $TARGET_DIR/minio | ||
| mv $TARGET_DIR/uploads/ $TARGET_DIR/minio/uploads/ | ||
| ``` |
There was a problem hiding this comment.
Add language identifiers to fenced code blocks.
This addresses MD040 and improves readability.
Proposed fix
- ```
- cd ~/ce-backup
- ```
+ ```bash
+ cd ~/ce-backup
+ ```
…
- ```
+ ```bash
TARGET_DIR=/opt/plane/data
sudo mkdir -p $TARGET_DIR
for FILE in *.tar.gz; do
if [ -e "$FILE" ]; then
tar -xzvf "$FILE" -C "$TARGET_DIR"
else
echo "No .tar.gz files found in the current directory."
exit 1
fi
done
…
- ```
+ ```📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 1. Start any command-line interface like Terminal and go into the folder with the back-up files. | |
| ``` | |
| cd ~/ce-backup | |
| ``` | |
| ``` | |
| cd ~/ce-backup | |
| ``` | |
| 2. Copy and paste the script below on Terminal and hit Enter. | |
| ``` | |
| TARGET_DIR=/opt/plane/data | |
| sudo mkdir -p $TARGET_DIR | |
| for FILE in *.tar.gz; do | |
| if [ -e "$FILE" ]; then | |
| tar -xzvf "$FILE" -C "$TARGET_DIR" | |
| else | |
| echo "No .tar.gz files found in the current directory." | |
| exit 1 | |
| fi | |
| done | |
| mv $TARGET_DIR/pgdata/ $TARGET_DIR/db | |
| mv $TARGET_DIR/redisdata/ $TARGET_DIR/redis | |
| mkdir -p $TARGET_DIR/minio | |
| mv $TARGET_DIR/uploads/ $TARGET_DIR/minio/uploads/ | |
| ``` | |
| ``` | |
| TARGET_DIR=/opt/plane/data | |
| sudo mkdir -p $TARGET_DIR | |
| for FILE in *.tar.gz; do | |
| if [ -e "$FILE" ]; then | |
| tar -xzvf "$FILE" -C "$TARGET_DIR" | |
| else | |
| echo "No .tar.gz files found in the current directory." | |
| exit 1 | |
| fi | |
| done | |
| mv $TARGET_DIR/pgdata/ $TARGET_DIR/db | |
| mv $TARGET_DIR/redisdata/ $TARGET_DIR/redis | |
| mkdir -p $TARGET_DIR/minio | |
| mv $TARGET_DIR/uploads/ $TARGET_DIR/minio/uploads/ | |
| ``` | |
| 1. Start any command-line interface like Terminal and go into the folder with the back-up files. |
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)
[warning] 52-52: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 57-57: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
In `@docs/self-hosting/upgrade-from-community.md` around lines 51 - 73, The fenced
code blocks containing the single-line "cd ~/ce-backup" and the multi-line shell
script beginning with "TARGET_DIR=/opt/plane/data" should include a language
identifier for Markdown linting and readability; update the opening backticks
from ``` to ```bash for both blocks so they become ```bash cd ~/ce-backup
```bash and ```bash (script...) ```bash respectively, leaving the block contents
unchanged and preserving the closing triple backticks.
Summary by CodeRabbit
New Features
Documentation
Chores
Summary by CodeRabbit
New Features
Documentation
Chores