Skip to content

Add Posthog analytics - #115

Open
ElijahAhianyo wants to merge 7 commits into
masterfrom
elijah/posthog
Open

ElijahAhianyo wants to merge 7 commits into
masterfrom
elijah/posthog

Conversation

@ElijahAhianyo

Copy link
Copy Markdown
Contributor

No description provided.

@ElijahAhianyo
ElijahAhianyo marked this pull request as draft October 5, 2026 02:14
@ElijahAhianyo

ElijahAhianyo commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-10-05 at 2 21 51 AM Screenshot 2026-10-05 at 2 34 59 PM

Comment thread src/analytics.rs

static CONFIG: OnceLock<Result<AnalyticsConfig, String>> = OnceLock::new();
const DEFAULT_ENABLED: bool = true;
const DEFAULT_PROJECT_TOKEN: &str = "phc_CpMFffYnhPmXZrMy8oh8TqeB2kK4EopYaMft3yhgtHiY";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ElijahAhianyo
ElijahAhianyo marked this pull request as ready for review October 5, 2026 14:38

@seqre seqre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is so much code needed? As I look in their docs, they have only short snippet there 🤔

@ElijahAhianyo

Copy link
Copy Markdown
Contributor Author

Why is so much code needed? As I look in their docs, they have only short snippet there 🤔

I think most of the code is logic for the cookie banner. Using PostHog with cookies requires a mandatory cookie banner for compliance reasons .
The current logic I have here (as do many other websites that use cookies for analytics) offers an opt in rather than an opt-out by default.

Technically, we could use the cookieless option(Discussed this with @m4tx last week), but we lose some good analytics features that could give us more insight into improving the doc experience.

@seqre

seqre commented Oct 10, 2026

Copy link
Copy Markdown
Member

Technically, we could use the cookieless option(Discussed this with @m4tx last week), but we lose some good analytics features that could give us more insight into improving the doc experience.

I think I'd rather go with cookieless as a first step and see what value we can get from that and expand from that in the future. We all hate those cookie banners, so I'd try to not have to show them on our site (especially since it's static docs site), unless we actually need it.

If you really want to go with cookie option, I'd redo the cookie banner to reduce the generic dry language with something more direct and "human". Like change the text to "Optional cookies help us figure out what’s working (and what’s not) so we can make the site better for you and everyone else." or "We’d like to use a few optional cookies to peek at how you use the site. No creepy stuff, just helping us make it better for everyone.". We could also extract the cat from our logo and put there in the corner to make it more individualized.

@ElijahAhianyo

ElijahAhianyo commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

If you really want to go with cookie option, I'd redo the cookie banner to reduce the generic dry language with something more direct and "human". Like change the text to "Optional cookies help us figure out what’s working (and what’s not) so we can make the site better for you and everyone else." or "We’d like to use a few optional cookies to peek at how you use the site. No creepy stuff, just helping us make it better for everyone.".

@seqre to be fair, I actually just lifted this off the Mintlify docs: https://www.mintlify.com/docs and the GitBook docs: https://gitbook.com/docs/, but yeah I could improve that. My only issue is that this part, "No creepy stuff, just helping us make it better for everyone," makes it sound even more suspicious; maybe it's just me 😄

We could also extract the cat from our logo and put there in the corner to make it more individualized.

Where exactly should this go? The banner or the modal? Also, I'm wondering if we really need to have the logo there as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants