Skip to content

Commit 5e2e827

Browse files
Merge branch 'main' into bkellam/posthog-ai
2 parents d4dd04a + cb29189 commit 5e2e827

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Added PostHog events for chat UI interactions (details card expand/collapse, copy answer, table of contents toggle) and repo tracking in `wa_chat_message_sent`. [#922](https://github.com/sourcebot-dev/sourcebot/pull/922)
1212
- Added Bitbucket Cloud OAuth identity provider support (`provider: "bitbucket-cloud"`) for SSO and account-linked permission syncing. [#924](https://github.com/sourcebot-dev/sourcebot/pull/924)
1313
- Added permission syncing support for Bitbucket Cloud. [#925](https://github.com/sourcebot-dev/sourcebot/pull/925)
14+
- Added `wa_user_created` PostHog event fired on successful user sign-up. [#933](https://github.com/sourcebot-dev/sourcebot/pull/933)
15+
- Added `wa_askgh_login_wall_prompted` PostHog event fired when an unauthenticated user attempts to ask a question on Ask GitHub. [#933](https://github.com/sourcebot-dev/sourcebot/pull/933)
1416

1517
### Changed
1618
- Hide version upgrade toast for askgithub deployment (`EXPERIMENT_ASK_GH_ENABLED`). [#931](https://github.com/sourcebot-dev/sourcebot/pull/931)

packages/web/src/app/[domain]/askgh/[owner]/[repo]/components/landingPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type { IdentityProviderMetadata } from "@/lib/identityProviders";
1414
import { Descendant, Transforms } from "slate";
1515
import { useSlate } from "slate-react";
1616
import { useCallback, useEffect, useMemo, useState, useRef } from "react";
17+
import { captureEvent } from "@/hooks/useCaptureEvent";
1718

1819
const PENDING_MESSAGE_KEY = "askgh_pending_message";
1920

@@ -55,6 +56,7 @@ export const LandingPage = ({
5556
// Intercept submit to check auth status
5657
const handleSubmit = useCallback((children: Descendant[]) => {
5758
if (!isAuthenticated) {
59+
captureEvent('wa_askgh_login_wall_prompted', {});
5860
// Store message in sessionStorage to survive OAuth redirect
5961
sessionStorage.setItem(PENDING_MESSAGE_KEY, JSON.stringify(children));
6062
setIsLoginModalOpen(true);

packages/web/src/lib/authUtils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const onCreateUser = async ({ user }: { user: AuthJsUser }) => {
107107
type: "org"
108108
}
109109
});
110-
} else if (!defaultOrg.memberApprovalRequired) {
110+
} else if (!defaultOrg.memberApprovalRequired) {
111111
const hasAvailability = await orgHasAvailability(defaultOrg.domain);
112112
if (!hasAvailability) {
113113
logger.warn(`onCreateUser: org ${SINGLE_TENANT_ORG_ID} has reached max capacity. User ${user.id} was not added to the org.`);
@@ -123,6 +123,10 @@ export const onCreateUser = async ({ user }: { user: AuthJsUser }) => {
123123
});
124124
}
125125

126+
// Dynamic import to avoid circular dependency:
127+
// authUtils -> posthog -> auth -> authUtils
128+
const { captureEvent } = await import("@/lib/posthog");
129+
await captureEvent('wa_user_created', { userId: user.id });
126130
};
127131

128132

packages/web/src/lib/posthogEvents.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ export type PosthogEventMap = {
227227
chatId: string,
228228
isExpanded: boolean,
229229
},
230+
wa_user_created: {
231+
userId: string,
232+
},
233+
//////////////////////////////////////////////////////////////////
234+
wa_askgh_login_wall_prompted: {},
230235
//////////////////////////////////////////////////////////////////
231236
wa_demo_docs_link_pressed: {},
232237
wa_demo_search_example_card_pressed: {

0 commit comments

Comments
 (0)