-
Notifications
You must be signed in to change notification settings - Fork 354
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
Add PostHog analytics to readme #159
Add PostHog analytics to readme #159
Conversation
WalkthroughThe changes introduce a new section titled "Setup Analytics -- Optional" in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant PostHog
participant Site
User->>Site: Generates events
Site->>PostHog: Sends event data
PostHog-->>Site: Confirms event tracking
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
README.md (1)
Line range hint
339-343
: Consider adding contribution guidelines for community extensions.The Community Extensions section would benefit from additional information:
## Community Extensions The open source community is extending and improving SaasStarter! These extensions are reference implementations of commonly needed features. We don't integrate them into the main branch to keep our dependencies minimal and simplify maintenance. However, if you need them you can cherry pick into your fork/repo: - Internationalization: [branch](https://github.com/CriticalMoments/CMSaasStarter/tree/extension/internationalization), and [instructions](https://github.com/CriticalMoments/CMSaasStarter/pull/49) - Dark mode theme: [branch](https://github.com/CriticalMoments/CMSaasStarter/tree/extension/dark_mode), and [instructions](https://github.com/CriticalMoments/CMSaasStarter/pull/47) + +### Contributing Extensions + +Want to contribute a new extension? Follow these steps: +1. Create a new branch named `extension/your_feature_name` +2. Implement your feature +3. Create a PR with detailed implementation instructions +4. Once approved, your extension will be listed here + +Note: Extensions are community-maintained and may need updates to work with the latest version of SaasStarter.🧰 Tools
🪛 LanguageTool
[uncategorized] ~341-~341: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...s active. ## Community Extensions The open source community is extending and improving Sa...(EN_COMPOUND_ADJECTIVE_INTERNAL)
## Setup Analytics -- Optional | ||
|
||
### PostHog | ||
|
||
- Create a PostHog Account | ||
- Install PostHog JS Library | ||
- Run `npm install posthog-js` in your terminal. This will add PostHog dependencies to your `package.json` and `package-lock.json`. | ||
- Set Up PostHog | ||
- Create a new layout file at `src/routes/+layout.js` | ||
- Log into PostHog. Then copy the code from [Svelte Client-side setup](https://posthog.com/docs/libraries/svelte#client-side-setup) and paste it into your `src/routes/+layout.js` file | ||
- Note: ensure you’re logged into PostHog so that the code includes your unique API key automatically. | ||
- Test analytics | ||
- Click around and view a few pages on your site to generate some events. You can view these events in PostHog to ensure tracking is active. | ||
|
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.
Several improvements needed in the PostHog setup instructions.
The analytics setup section needs the following improvements:
- Fix the layout file extension:
- Create a new layout file at `src/routes/+layout.js`
+ Create a new layout file at `src/routes/+layout.ts` # or .svelte if you need a UI component
- Add environment variable setup:
+- Configure Environment Variables
+ - Add `PUBLIC_POSTHOG_KEY=your-project-api-key` to your `.env.local` file for development
+ - Add this environment variable to your deployment environment (Cloudflare/Vercel)
- Add security note:
+- Security Note
+ - Ensure you're using the public project API key, not the private API key
+ - The public key is safe to expose in client-side code
- Clarify API key location:
- - Note: ensure you're logged into PostHog so that the code includes your unique API key automatically.
+ - Note: Find your project API key in PostHog under Project Settings > Project API Key
📝 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.
## Setup Analytics -- Optional | |
### PostHog | |
- Create a PostHog Account | |
- Install PostHog JS Library | |
- Run `npm install posthog-js` in your terminal. This will add PostHog dependencies to your `package.json` and `package-lock.json`. | |
- Set Up PostHog | |
- Create a new layout file at `src/routes/+layout.js` | |
- Log into PostHog. Then copy the code from [Svelte Client-side setup](https://posthog.com/docs/libraries/svelte#client-side-setup) and paste it into your `src/routes/+layout.js` file | |
- Note: ensure you’re logged into PostHog so that the code includes your unique API key automatically. | |
- Test analytics | |
- Click around and view a few pages on your site to generate some events. You can view these events in PostHog to ensure tracking is active. | |
## Setup Analytics -- Optional | |
### PostHog | |
- Create a PostHog Account | |
- Install PostHog JS Library | |
- Run `npm install posthog-js` in your terminal. This will add PostHog dependencies to your `package.json` and `package-lock.json`. | |
- Set Up PostHog | |
- Create a new layout file at `src/routes/+layout.ts` # or .svelte if you need a UI component | |
- Log into PostHog. Then copy the code from [Svelte Client-side setup](https://posthog.com/docs/libraries/svelte#client-side-setup) and paste it into your `src/routes/+layout.ts` file | |
- Note: Find your project API key in PostHog under Project Settings > Project API Key | |
- Configure Environment Variables | |
- Add `PUBLIC_POSTHOG_KEY=your-project-api-key` to your `.env.local` file for development | |
- Add this environment variable to your deployment environment (Cloudflare/Vercel) | |
- Security Note | |
- Ensure you're using the public project API key, not the private API key | |
- The public key is safe to expose in client-side code | |
- Test analytics | |
- Click around and view a few pages on your site to generate some events. You can view these events in PostHog to ensure tracking is active. |
@evlim our README is a bit long. How about a new ANALYTICS.md in root, with a 1 line link to it in the "Add Your Content" section. |
6b23493
into
CriticalMoments:analytics_instructions
Summary by CodeRabbit
New Features
Documentation