Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(integrations): instrument team and personal GitHub connects (#81911)

Georgiy Tarasov2b7cb05a581c
diff --git a/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx b/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx
index a6ea9a56c144..93e3eaa55150 100644
--- a/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx
+++ b/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx
@@ -11,6 +11,7 @@ import api from 'lib/api'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { IntegrationView } from 'lib/integrations/IntegrationView'
import { getIntegrationNameFromKind } from 'lib/integrations/utils'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { urls } from 'scenes/urls'
import { findIntegrationByFormValue, matchesIntegrationIdValue } from './integrationLookup'
@@ -38,6 +39,7 @@ export function IntegrationChoice({
const { integrationsLoading, integrations, newIntegrationModalKind, slackAvailable } = useValues(integrationsLogic)
const { newGoogleCloudKey, openNewIntegrationModal, closeNewIntegrationModal, deleteIntegration } =
useActions(integrationsLogic)
+ const { reportIntegrationConnectClicked } = useActions(eventUsageLogic)
const kind = integration
const integrationsOfKind = integrations?.filter((x) => x.kind === kind)
@@ -107,7 +109,10 @@ export function IntegrationChoice({
: {
to: api.integrations.authorizeUrl({ kind, next: redirectUrl }),
disableClientSideRouting: true,
- onClick: beforeRedirect,
+ onClick: () => {
+ reportIntegrationConnectClicked(kind, kind, 'pipeline_config')
+ beforeRedirect?.()
+ },
label: integrationsOfKind?.length
? `Connect to a different integration for ${kindName}`
: `Connect to ${kindName}`,
diff --git a/frontend/src/lib/integrations/IntegrationScopesWarning.tsx b/frontend/src/lib/integrations/IntegrationScopesWarning.tsx
index c96d3ec15f56..b1cc22d5b298 100644
--- a/frontend/src/lib/integrations/IntegrationScopesWarning.tsx
+++ b/frontend/src/lib/integrations/IntegrationScopesWarning.tsx
@@ -1,3 +1,4 @@
+import { useActions } from 'kea'
import { useMemo } from 'react'
import api from 'lib/api'
@@ -5,6 +6,7 @@ import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedAr
import { TeamMembershipLevel } from 'lib/constants'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { Link } from 'lib/lemon-ui/Link'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { IntegrationType } from '~/types'
@@ -51,6 +53,7 @@ export function IntegrationScopesWarning({
integration: IntegrationType
schema?: { requiredScopes?: string }
}): JSX.Element {
+ const { reportIntegrationConnectClicked } = useActions(eventUsageLogic)
const restrictedReason = useRestrictedArea({
scope: RestrictionScope.Project,
minimumAccessLevel: TeamMembershipLevel.Admin,
@@ -73,6 +76,8 @@ export function IntegrationScopesWarning({
kind: integration.kind,
next: window.location.pathname,
}),
+ onClick: () =>
+ reportIntegrationConnectClicked(integration.kind, integration.kind, 'missing_scopes_reconnect'),
disabledReason: restrictedReason,
}}
>
diff --git a/frontend/src/lib/integrations/IntegrationView.tsx b/frontend/src/lib/integrations/IntegrationView.tsx
index 1ed344c2d282..0b249ed7286a 100644
--- a/frontend/src/lib/integrations/IntegrationView.tsx
+++ b/frontend/src/lib/integrations/IntegrationView.tsx
@@ -13,6 +13,7 @@ import { TeamMembershipLevel } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
import { GitHubRepoSummary } from 'lib/integrations/GitHubRepoSummary'
import { IntegrationScopesWarning } from 'lib/integrations/IntegrationScopesWarning'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
@@ -31,6 +32,7 @@ export function IntegrationView({
schema?: { requiredScopes?: string }
}): JSX.Element {
const { deleteIntegration } = useActions(integrationsLogic)
+ const { reportIntegrationConnectClicked } = useActions(eventUsageLogic)
const { currentTeam } = useValues(teamLogic)
const restrictedReason = useRestrictedArea({
scope: RestrictionScope.Project,
@@ -151,6 +153,12 @@ export function IntegrationView({
kind: integration.kind,
next: window.location.pathname,
}),
+ onClick: () =>
+ reportIntegrationConnectClicked(
+ integration.kind,
+ integration.kind,
+ 'error_banner_reconnect'
+ ),
disabledReason: restrictedReason,
}}
>
diff --git a/frontend/src/lib/integrations/utils.ts b/frontend/src/lib/integrations/utils.ts
index 48f948f99a8e..d784a320f148 100644
--- a/frontend/src/lib/integrations/utils.ts
+++ b/frontend/src/lib/integrations/utils.ts
@@ -41,6 +41,29 @@ import IconTikTok from 'public/services/tiktok.png'
import IconTwilio from 'public/services/twilio.png'
import IconVercel from 'public/services/vercel.png'
+/**
+ * Where a user started an integration connect flow. Reported as the `surface` property on
+ * `integration_connect_clicked`, so these strings are frozen — renaming one silently splits a
+ * funnel that already counts the old value.
+ *
+ * A connect can start from many places, and only some of them are a first connection: the
+ * `*_reconnect` and `settings_manage` values cover flows that begin with an integration already
+ * in place, which a conversion metric wants to exclude.
+ */
+export type IntegrationConnectSurface =
+ | 'settings'
+ | 'settings_manage'
+ | 'settings_link_existing'
+ | 'integration_landing_page'
+ | 'pipeline_config'
+ | 'error_banner_reconnect'
+ | 'missing_scopes_reconnect'
+ | 'warehouse_source_reconnect'
+ | 'onboarding_wizard'
+ | 'signals_agent_setup'
+ | 'task_composer'
+ | 'visual_review_settings'
+
export const ICONS: Record<IntegrationKind, any> = {
slack: IconSlack,
salesforce: IconSalesforce,
diff --git a/frontend/src/lib/utils/eventUsageLogic.ts b/frontend/src/lib/utils/eventUsageLogic.ts
index eaef8851d67f..b537a24ec0cf 100644
--- a/frontend/src/lib/utils/eventUsageLogic.ts
+++ b/frontend/src/lib/utils/eventUsageLogic.ts
@@ -4,6 +4,7 @@ import posthog from 'posthog-js'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import type { Dayjs } from 'lib/dayjs'
import { now } from 'lib/dayjs'
+import type { IntegrationConnectSurface } from 'lib/integrations/utils'
import { TimeToSeeDataPayload } from 'lib/internalMetrics'
import { preflightLogic } from 'lib/logic/preflightLogic'
import { objectClean } from 'lib/utils/objects'
@@ -1601,10 +1602,14 @@ export interface eventUsageLogicActions {
}
reportIntegrationConnectClicked: (
integration: string,
- kind: string
+ kind: string,
+ surface: IntegrationConnectSurface,
+ selfDriving?: boolean
) => {
integration: string
kind: string
+ selfDriving: boolean | undefined
+ surface: IntegrationConnectSurface
}
reportInviteMembersButtonClicked: () => {
value: true
@@ -1766,6 +1771,9 @@ export interface eventUsageLogicActions {
reportPersonSplit: (merge_count: number) => {
merge_count: number
}
+ reportPersonalIntegrationConnectClicked: (kind: string) => {
+ kind: string
+ }
reportPersonsJoinModeUpdated: (mode: string) => {
mode: string
}
@@ -2168,7 +2176,18 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
// timing
reportTimeToSeeData: (payload: TimeToSeeDataPayload) => ({ payload }),
reportGroupTypeDetailDashboardCreated: () => ({}),
- reportIntegrationConnectClicked: (integration: string, kind: string) => ({ integration, kind }),
+ reportIntegrationConnectClicked: (
+ integration: string,
+ kind: string,
+ surface: IntegrationConnectSurface,
+ selfDriving?: boolean
+ ) => ({
+ integration,
+ kind,
+ surface,
+ selfDriving,
+ }),
+ reportPersonalIntegrationConnectClicked: (kind: string) => ({ kind }),
reportGroupPropertyUpdated: (
action: 'added' | 'updated' | 'removed',
totalProperties: number,
@@ -3068,8 +3087,22 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportInstanceSettingChange: ({ name, value }) => {
posthog.capture('instance setting change', { name, value })
},
- reportIntegrationConnectClicked: ({ integration, kind }) => {
- posthog.capture('integration_connect_clicked', { integration, integration_kind: kind })
+ reportIntegrationConnectClicked: ({ integration, kind, surface, selfDriving }) => {
+ posthog.capture('integration_connect_clicked', {
+ integration,
+ integration_kind: kind,
+ surface,
+ // Only set where the surface can actually tell. The OAuth landing page serves both
+ // self-driving runs and everyone else, so it resolves this; surfaces that are
+ // self-driving by construction leave it unset rather than assert a constant.
+ self_driving: selfDriving,
+ })
+ },
+ // Personal integrations are a separate table with their own connect surface, so they get
+ // their own event: saved insights already count `integration_connect_clicked` unfiltered and
+ // would silently start including personal links.
+ reportPersonalIntegrationConnectClicked: ({ kind }) => {
+ posthog.capture('personal integration connect clicked', { integration_kind: kind })
},
reportDashboardLoadingTime: async ({ loadingMilliseconds, dashboardId }) => {
posthog.capture('dashboard loading time', { loadingMilliseconds, dashboardId })
diff --git a/frontend/src/scenes/integrations/IntegrationFullPage.tsx b/frontend/src/scenes/integrations/IntegrationFullPage.tsx
index 62c3952196c9..a3ae61bb63dc 100644
--- a/frontend/src/scenes/integrations/IntegrationFullPage.tsx
+++ b/frontend/src/scenes/integrations/IntegrationFullPage.tsx
@@ -68,6 +68,10 @@ function ConnectView({
SettingsSection: SettingsSectionComponent
}): JSX.Element {
const { reportIntegrationConnectClicked } = useActions(eventUsageLogic)
+ // This page serves both the self-driving wizard, which parks a run here for the GitHub round
+ // trip, and everyone arriving under their own steam. Both leave the same click behind, so
+ // recording which it was is the only way to attribute a connect to a wizard run.
+ const { inFlight: selfDrivingRunInFlight } = useSelfDrivingRunState()
// Connecting an integration requires project membership (enforced again in the backend);
// editing or removing one still requires admin. Users with no project access fall back to
// the request-access flow below.
@@ -77,7 +81,12 @@ function ConnectView({
})
const onConnectClick = (): void => {
- reportIntegrationConnectClicked(definition.slug, definition.kind)
+ reportIntegrationConnectClicked(
+ definition.slug,
+ definition.kind,
+ 'integration_landing_page',
+ selfDrivingRunInFlight
+ )
}
return (
diff --git a/frontend/src/scenes/integrations/components/GithubIntegration.test.tsx b/frontend/src/scenes/integrations/components/GithubIntegration.test.tsx
new file mode 100644
index 000000000000..2378b0f420e4
--- /dev/null
+++ b/frontend/src/scenes/integrations/components/GithubIntegration.test.tsx
@@ -0,0 +1,58 @@
+import '@testing-library/jest-dom'
+
+import { cleanup, render, screen, waitFor } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import { Provider } from 'kea'
+import posthog from 'posthog-js'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import { GithubIntegration } from './GithubIntegration'
+
+describe('GithubIntegration', () => {
+ let captureSpy: jest.SpyInstance
+
+ beforeEach(() => {
+ useMocks({
+ get: {
+ '/api/environments/:team_id/integrations': { results: [] },
+ '/api/projects/:team_id/integrations/github/available_installations/': { installations: [] },
+ },
+ })
+ initKeaTests()
+ captureSpy = jest.spyOn(posthog, 'capture').mockReturnValue(undefined as any)
+ })
+
+ afterEach(() => {
+ captureSpy.mockRestore()
+ cleanup()
+ })
+
+ const clickConnect = async (element: JSX.Element): Promise<void> => {
+ render(<Provider>{element}</Provider>)
+ const button = await screen.findByText('Connect account')
+ await userEvent.click(button)
+ }
+
+ const connectClicks = (): Record<string, unknown>[] =>
+ captureSpy.mock.calls.filter((call) => call[0] === 'integration_connect_clicked').map((call) => call[1])
+
+ it('reports the surface it was rendered on', async () => {
+ await clickConnect(<GithubIntegration connectSurface="settings" />)
+
+ await waitFor(() =>
+ expect(connectClicks()).toEqual([
+ { integration: 'github', integration_kind: 'github', surface: 'settings' },
+ ])
+ )
+ })
+
+ // The OAuth landing page reports every kind's connect click for itself, so giving `connectSurface`
+ // a default would make one click on that page count twice and inflate the connect metric.
+ it('stays silent without a surface, so the landing page is the only reporter there', async () => {
+ await clickConnect(<GithubIntegration />)
+
+ expect(connectClicks()).toEqual([])
+ })
+})
diff --git a/frontend/src/scenes/integrations/components/GithubIntegration.tsx b/frontend/src/scenes/integrations/components/GithubIntegration.tsx
index 2f18b3db3292..b9d2b09d9c7d 100644
--- a/frontend/src/scenes/integrations/components/GithubIntegration.tsx
+++ b/frontend/src/scenes/integrations/components/GithubIntegration.tsx
@@ -6,7 +6,9 @@ import { LemonBanner, LemonButton, Link } from '@posthog/lemon-ui'
import api from 'lib/api'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
+import type { IntegrationConnectSurface } from 'lib/integrations/utils'
import { LemonMenu } from 'lib/lemon-ui/LemonMenu'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
@@ -14,11 +16,23 @@ import type { GitHubAvailableInstallationApi } from 'products/integrations/front
import { Integration, useIntegrations } from './Integration'
-export function GithubIntegration({ next }: { next?: string }): JSX.Element {
+export function GithubIntegration({
+ next,
+ connectSurface,
+}: {
+ next?: string
+ /**
+ * Where this card is rendered, reported as the `surface` on `integration_connect_clicked`.
+ * Omit it only on the OAuth landing page, which reports every kind's connect click itself —
+ * passing it there would count one click twice. Every other render site should set it.
+ */
+ connectSurface?: IntegrationConnectSurface
+}): JSX.Element {
const { currentTeam } = useValues(teamLogic)
const { linkedGithubInstallationLoading, githubAvailableInstallations, githubPersonalConnected } =
useValues(integrationsLogic)
const { linkExistingGithubInstallation, loadGithubAvailableInstallations } = useActions(integrationsLogic)
+ const { reportIntegrationConnectClicked } = useActions(eventUsageLogic)
const githubIntegrations = useIntegrations('github')
// integrationsLogic is a singleton mounted from dozens of unrelated surfaces, so this fetch
@@ -38,6 +52,14 @@ export function GithubIntegration({ next }: { next?: string }): JSX.Element {
const canLinkExisting = !isConnected && installations.length > 0
const multipleInstallations = installations.length > 1
+ // Silent without `connectSurface`, because the only card rendered without one sits on the OAuth
+ // landing page, which already reports every kind's connect click for itself.
+ const reportConnect = (variant?: IntegrationConnectSurface): void => {
+ if (connectSurface) {
+ reportIntegrationConnectClicked('github', 'github', variant ?? connectSurface)
+ }
+ }
+
return (
<Integration kind="github">
{/* w-full because Integration drops its children into a bare flex row, which would
@@ -62,7 +84,13 @@ export function GithubIntegration({ next }: { next?: string }): JSX.Element {
<GitHubInstallationLink
installations={installations}
loading={linkedGithubInstallationLoading}
- onLink={linkExistingGithubInstallation}
+ onLink={(installationId) => {
+ // Reusing an existing install never leaves PostHog, so it's a
+ // connect that skips GitHub entirely — worth separating from the
+ // clicks that redirect out.
+ reportConnect('settings_link_existing')
+ linkExistingGithubInstallation(installationId)
+ }}
projectName={currentTeam?.name}
/>
</div>
@@ -73,7 +101,12 @@ export function GithubIntegration({ next }: { next?: string }): JSX.Element {
account, so GitHub offers install where it's missing and configure where it
isn't. "Connect account" matches the Linear and Jira cards, which name the
third party's container. */}
- <LemonButton type="secondary" disableClientSideRouting to={authorizationUrl}>
+ <LemonButton
+ type="secondary"
+ disableClientSideRouting
+ to={authorizationUrl}
+ onClick={() => reportConnect(isConnected ? 'settings_manage' : undefined)}
+ >
{isConnected ? 'Manage on GitHub' : 'Connect account'}
</LemonButton>
</div>
diff --git a/frontend/src/scenes/integrations/integrationTypes.ts b/frontend/src/scenes/integrations/integrationTypes.ts
index 2eb861c04516..84a89a59588c 100644
--- a/frontend/src/scenes/integrations/integrationTypes.ts
+++ b/frontend/src/scenes/integrations/integrationTypes.ts
@@ -1,8 +1,16 @@
+import type { IntegrationConnectSurface } from 'lib/integrations/utils'
+
import { IntegrationKind, IntegrationType } from '~/types'
/** The actionable connect section, reused in both settings and the full page.
- * The full page passes ``centered`` so the section can match its centered layout. */
-export type SettingsSectionComponent = (props: { next?: string; centered?: boolean }) => JSX.Element
+ * The full page passes ``centered`` so the section can match its centered layout.
+ * ``connectSurface`` names where the section is embedded for a section that reports its own connect
+ * clicks; the full page leaves it unset because it reports every kind's clicks itself. */
+export type SettingsSectionComponent = (props: {
+ next?: string
+ centered?: boolean
+ connectSurface?: IntegrationConnectSurface
+}) => JSX.Element
/**
* Optional slot rendered on the OAuth landing page directly below the success card,
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardCloudRunBlock.tsx b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardCloudRunBlock.tsx
index a58c3ca6883d..99ffcd414685 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardCloudRunBlock.tsx
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardCloudRunBlock.tsx
@@ -6,6 +6,7 @@ import { LemonBanner, LemonButton } from '@posthog/lemon-ui'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { GitHubRepositoryPicker } from 'lib/integrations/GitHubIntegrationHelpers'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { useWizardCommand } from 'scenes/onboarding/shared/useWizardCommand'
import { activeCloudRunLogic } from './activeCloudRunLogic'
@@ -39,6 +40,7 @@ export function WizardCloudRunBlock({
const { activeCloudRun } = useValues(activeCloudRunLogic)
const { setSelectedRepository, startCloudRun } = useActions(wizardCloudRunLogic)
const { clearActiveCloudRun } = useActions(activeCloudRunLogic)
+ const { reportIntegrationConnectClicked } = useActions(eventUsageLogic)
// Fire onQueued once per kickoff, the moment the run is handed off. It advances the install step
// (GROW-96), so it must not repeat while the status stays 'queued' (the callback identity changes
@@ -120,6 +122,7 @@ export function WizardCloudRunBlock({
disableClientSideRouting
data-attr="wizard-cloud-run-connect-github"
className={hideHog ? 'self-center' : 'self-start'}
+ onClick={() => reportIntegrationConnectClicked('github', 'github', 'onboarding_wizard')}
>
Connect GitHub
</LemonButton>
diff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsx
index a27a78b74b1f..85cc1695dd9b 100644
--- a/frontend/src/scenes/settings/SettingsMap.tsx
+++ b/frontend/src/scenes/settings/SettingsMap.tsx
@@ -1580,7 +1580,7 @@ export const SETTINGS_MAP: SettingSection[] = [
title: 'GitHub integration',
description: 'Connect GitHub to link issues and pull requests with PostHog insights.',
docsUrl: 'https://posthog.com/docs/error-tracking/integrations',
- component: <GitHub.SettingsSection />,
+ component: <GitHub.SettingsSection connectSurface="settings" />,
keywords: ['github', 'git', 'repository', 'issue', 'pr'],
},
{
diff --git a/frontend/src/scenes/settings/environment/ErrorTrackingIntegrations.tsx b/frontend/src/scenes/settings/environment/ErrorTrackingIntegrations.tsx
index e01e4f8ab4cc..b058f756f4e8 100644
--- a/frontend/src/scenes/settings/environment/ErrorTrackingIntegrations.tsx
+++ b/frontend/src/scenes/settings/environment/ErrorTrackingIntegrations.tsx
@@ -28,7 +28,7 @@ export function ErrorTrackingIntegrations(): JSX.Element {
<img src={IconGitHub} alt="" className="w-5 h-5" />
GitHub
</h3>
- <GithubIntegration next={NEXT_URL} />
+ <GithubIntegration next={NEXT_URL} connectSurface="settings" />
</div>
<div>
<h3 className="flex items-center gap-2">
diff --git a/frontend/src/scenes/settings/environment/ReplayIntegrations.tsx b/frontend/src/scenes/settings/environment/ReplayIntegrations.tsx
index 4ca90263172f..e897021ede54 100644
--- a/frontend/src/scenes/settings/environment/ReplayIntegrations.tsx
+++ b/frontend/src/scenes/settings/environment/ReplayIntegrations.tsx
@@ -17,7 +17,7 @@ export function ReplayIntegrations(): JSX.Element {
</div>
<div>
<h3>GitHub</h3>
- <GithubIntegration next={NEXT_URL} />
+ <GithubIntegration next={NEXT_URL} connectSurface="settings" />
</div>
<div>
<h3>GitLab</h3>
diff --git a/frontend/src/scenes/settings/user/PersonalIntegrations.tsx b/frontend/src/scenes/settings/user/PersonalIntegrations.tsx
index 778282ce03ec..238c1d3684d7 100644
--- a/frontend/src/scenes/settings/user/PersonalIntegrations.tsx
+++ b/frontend/src/scenes/settings/user/PersonalIntegrations.tsx
@@ -7,6 +7,7 @@ import { TZLabel } from 'lib/components/TZLabel'
import { GitHubRepoSummary } from 'lib/integrations/GitHubRepoSummary'
import { userGithubIntegrationLogic } from 'lib/integrations/userGithubIntegrationLogic'
import { IconSlack } from 'lib/lemon-ui/icons'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import {
LinkableSlackWorkspace,
@@ -162,6 +163,7 @@ function SlackLinkRow({ integration }: { integration: PersonalSlackIntegration }
export function PersonalGitHubIntegrations(): JSX.Element {
const { integrations, integrationsLoading, githubConnecting } = useValues(personalIntegrationsLogic)
const { connectGitHub } = useActions(personalIntegrationsLogic)
+ const { reportPersonalIntegrationConnectClicked } = useActions(eventUsageLogic)
if (integrationsLoading && integrations.length === 0) {
return (
@@ -192,7 +194,10 @@ export function PersonalGitHubIntegrations(): JSX.Element {
type="secondary"
size="small"
icon={<IconPlus />}
- onClick={connectGitHub}
+ onClick={() => {
+ reportPersonalIntegrationConnectClicked('github')
+ connectGitHub()
+ }}
loading={githubConnecting}
disabledReason={githubConnecting ? 'Starting GitHub installation…' : undefined}
>
diff --git a/posthog/api/github_callback/team_services.py b/posthog/api/github_callback/team_services.py
index c67359319202..3141666ce644 100644
--- a/posthog/api/github_callback/team_services.py
+++ b/posthog/api/github_callback/team_services.py
@@ -31,6 +31,7 @@ from posthog.api.github_callback.types import (
)
from posthog.auth import SessionAuthentication
from posthog.egress.github.transport import GitHubEgressBudgetExhausted
+from posthog.event_usage import report_user_action
from posthog.models import Team
from posthog.models.integration import (
GitHubInstallationAccess,
@@ -664,6 +665,45 @@ def list_org_github_installations(
return list(installations.values())
+def _report_install_pending(user: User, team_id: int | None, setup_action: str) -> None:
+ """GitHub sends the user back with no ``installation_id`` when the install did not complete.
+
+ Either they asked an organization owner to approve it (``setup_action=request``), or they left
+ the install screen. Neither case writes a row anywhere, so this event is the only trace the
+ attempt leaves. The approval-requested case is the one that matters, because owner approval can
+ take days and nothing else records that the wait started.
+
+ Reported only when the callback resolved to a team the user belongs to. Without that, a bare
+ ``/integrations/github/callback/?setup_action=request`` would record an approval request against
+ whichever project the user happens to have open, since ``report_user_action`` falls back to
+ ``user.current_team``.
+ """
+ if team_id is None:
+ return
+
+ team = Team.objects.filter(id=team_id).first()
+ if team is None:
+ return
+
+ try:
+ report_user_action(
+ user,
+ "integration install pending",
+ {
+ "integration_kind": "github",
+ # Kept raw as well as derived so an unfamiliar setup_action shows up rather than
+ # silently folding into the "abandoned" side of the boolean.
+ "setup_action": setup_action or None,
+ "requested_approval": setup_action == "request",
+ },
+ team=team,
+ )
+ except Exception:
+ # The pending redirect is the graceful outcome of an install that did not complete. Letting a
+ # capture failure raise would turn it into an error page for a callback that is otherwise fine.
+ logger.exception("github_team_setup: failed to report pending install", team_id=team_id, user_id=user.id)
+
+
def finish_team_setup(http_request) -> FinishResult:
state_raw = http_request.GET.get("state")
user = cast(User, http_request.user)
@@ -687,6 +727,7 @@ def finish_team_setup(http_request) -> FinishResult:
)
if not installation_id:
+ _report_install_pending(user, team_id, setup_action)
return FinishResult(
redirect_kind="team_setup",
next_url=next_url,
diff --git a/posthog/api/integration.py b/posthog/api/integration.py
index eee69aa95022..0ddc0d363537 100644
--- a/posthog/api/integration.py
+++ b/posthog/api/integration.py
@@ -137,15 +137,6 @@ def _reraise_slack_api_error(error: SlackApiError) -> NoReturn:
raise error
-def _github_account_type(owner_type: str | None) -> str | None:
- """Normalize GitHub's account ``type`` ("Organization" / "User") to org vs personal."""
- if owner_type == "Organization":
- return "organization"
- if owner_type == "User":
- return "personal"
- return None
-
-
def validate_github_repository_name(repo: str) -> str:
"""Validate repository paths accepted by GitHub integration endpoints."""
parts = repo.split("/")
@@ -488,19 +479,17 @@ class IntegrationSerializer(serializers.ModelSerializer, UserAccessControlSerial
self.context["request"].user, self.context["get_team"]()
):
raise PermissionDenied("Editing an existing integration requires project admin access.")
- report_properties: dict[str, Any] = {"integration_kind": kind, "is_overwrite": is_overwrite}
- if kind == "github":
- # Surface whether the connected GitHub account is an org or a personal one, mirroring the
- # account_type we attach to PR webhook events. GitHub reports "Organization" / "User".
- owner_type = ((instance.config or {}).get("account") or {}).get("type")
- report_properties["repo_owner_type"] = owner_type
- report_properties["account_type"] = _github_account_type(owner_type)
- report_user_action(
- self.context["request"].user,
- "integration created",
- report_properties,
- team=self.context["get_team"](),
- )
+ # GitHub reports from GitHubIntegration.integration_from_installation_id instead, because it
+ # is also created outside this serializer (the App installation callback, agentic
+ # provisioning). This branch reaches that same helper, so reporting here too would count a
+ # new connection twice.
+ if kind != "github":
+ report_user_action(
+ self.context["request"].user,
+ "integration created",
+ {"integration_kind": kind, "is_overwrite": is_overwrite},
+ team=self.context["get_team"](),
+ )
return instance
def _build_integration(self, validated_data: Any) -> Any:
diff --git a/posthog/api/test/test_integration.py b/posthog/api/test/test_integration.py
index bf976c1c56c1..4394c163f936 100644
--- a/posthog/api/test/test_integration.py
+++ b/posthog/api/test/test_integration.py
@@ -39,12 +39,14 @@ from posthog.models.integration import (
PRIVATE_CHANNEL_WITHOUT_ACCESS,
SLACK_INTEGRATION_KINDS,
EmailIntegration,
+ GitHubInstallationAccess,
GitHubIntegration,
GitHubIntegrationError,
GitHubUserAuthorization,
Integration,
SlackIntegration,
StripeIntegration,
+ github_account_type,
)
from posthog.models.oauth import OAuthAccessToken, OAuthApplication, OAuthRefreshToken
from posthog.models.organization import Organization, OrganizationMembership
@@ -2074,9 +2076,46 @@ class TestGithubAccountTypeHelper:
]
)
def test_github_account_type(self, _name, owner_type, expected):
- from posthog.api.integration import _github_account_type
+ assert github_account_type(owner_type) == expected
- assert _github_account_type(owner_type) == expected
+
+class TestGitHubIntegrationCreatedReporting:
+ @pytest.fixture(autouse=True)
+ def setup_environment(self, db):
+ self.organization = Organization.objects.create(name="Test Org")
+ self.team = Team.objects.create(organization=self.organization, name="Test Team")
+ self.user = User.objects.create_and_join(
+ self.organization, "[email protected]", "test", level=OrganizationMembership.Level.ADMIN
+ )
+
+ @patch("posthog.event_usage.report_user_action")
+ @patch("posthog.models.integration.GitHubIntegration.fetch_installation_access")
+ def test_reports_integration_created_once_per_installation(self, mock_fetch, mock_report):
+ mock_fetch.return_value = GitHubInstallationAccess(
+ installation_id="12345",
+ installation_info={"account": {"type": "Organization", "login": "acme"}},
+ access_token="ghs_token",
+ token_expires_at=(timezone.now() + timedelta(hours=1)).isoformat(),
+ repository_selection="selected",
+ )
+
+ GitHubIntegration.integration_from_installation_id("12345", self.team.id, self.user)
+
+ assert mock_report.call_count == 1
+ args, kwargs = mock_report.call_args
+ assert args[1] == "integration created"
+ assert args[2] == {
+ "integration_kind": "github",
+ "is_overwrite": False,
+ "repo_owner_type": "Organization",
+ "account_type": "organization",
+ }
+ assert kwargs["team"] == self.team
+
+ # Reconnects and repeat installs re-run this, and must not read as new connections.
+ GitHubIntegration.integration_from_installation_id("12345", self.team.id, self.user)
+
+ assert mock_report.call_count == 1
class TestGitHubIntegrationStateValidation:
@@ -2262,18 +2301,20 @@ class TestGitHubIntegrationStateValidation:
assert cache.get(f"github_authorize:{state_token}") is None
assert cache.get(f"github_authorize_pending:{self.user.id}") is None
+ # Deliberately does not mock `integration_from_installation_id`: this serializer branch reaches it,
+ # and mocking it hides whichever of the two emitters is wrong.
@patch("posthog.api.integration.report_user_action")
+ @patch("posthog.event_usage.report_user_action")
@patch("posthog.models.github_integration_base.GitHubIntegrationBase.verify_user_installation_access")
@patch("posthog.models.integration.GitHubIntegration.github_user_from_code")
- @patch("posthog.models.integration.GitHubIntegration.integration_from_installation_id")
- @patch("posthog.models.user_integration.user_github_integration_from_installation")
- def test_create_github_integration_reports_account_type(
+ @patch("posthog.models.integration.GitHubIntegration.fetch_installation_access")
+ def test_create_github_integration_reports_created_exactly_once(
self,
- mock_user_integration,
- mock_from_install,
+ mock_fetch,
mock_from_code,
mock_verify,
- mock_report,
+ mock_model_report,
+ mock_serializer_report,
client: HttpClient,
):
from posthog.models.integration import GitHubUserAuthorization
@@ -2298,12 +2339,12 @@ class TestGitHubIntegrationStateValidation:
refresh_token_expires_in=None,
)
mock_verify.return_value = True
- mock_from_install.return_value = Integration.objects.create(
- team=self.team,
- kind="github",
- integration_id="12345",
- config={"installation_id": "12345", "account": {"type": "Organization", "name": "acme"}},
- sensitive_config={"access_token": "ghs_test"},
+ mock_fetch.return_value = GitHubInstallationAccess(
+ installation_id="12345",
+ installation_info={"account": {"type": "Organization", "login": "acme"}},
+ access_token="ghs_token",
+ token_expires_at=(timezone.now() + timedelta(hours=1)).isoformat(),
+ repository_selection="selected",
)
response = client.post(
@@ -2313,8 +2354,12 @@ class TestGitHubIntegrationStateValidation:
)
assert response.status_code == status.HTTP_201_CREATED, response.content
- mock_report.assert_called_once()
- props = mock_report.call_args.args[2]
+ # The serializer reports every other kind, but must stay silent for github.
+ assert mock_serializer_report.call_count == 0
+ # The same request also links the personal account, so filter to the team event.
+ created_calls = [c for c in mock_model_report.call_args_list if c.args[1] == "integration created"]
+ assert len(created_calls) == 1
+ props = created_calls[0].args[2]
assert props["integration_kind"] == "github"
assert props["repo_owner_type"] == "Organization"
assert props["account_type"] == "organization"
@@ -2650,6 +2695,60 @@ class TestGitHubTeamIntegrationComplete:
assert response.status_code == status.HTTP_302_FOUND
assert "github_install_pending=1" in response["Location"]
+ @patch("posthog.api.github_callback.team_services.report_user_action")
+ def test_pending_without_callback_state_is_not_reported(self, mock_report):
+ # No stored authorize state: anyone logged in can hit this URL directly. It still redirects,
+ # but recording it would let a hand-typed URL inflate the approval-request metric, and would
+ # attribute it to whichever project the user happens to have open.
+ client = HttpClient()
+ client.force_login(self.user)
+
+ response = client.get("/integrations/github/callback/", {"setup_action": "request"})
+
+ assert response.status_code == status.HTTP_302_FOUND
+ assert "github_install_pending=1" in response["Location"]
+ assert mock_report.call_count == 0
+
+ @parameterized.expand(
+ [
+ # GitHub sends setup_action=request when the user asked an org owner to approve the install.
+ ("owner_approval_requested", "request", "request", True),
+ ("left_without_installing", "", None, False),
+ ]
+ )
+ @patch("posthog.api.github_callback.team_services.report_user_action")
+ def test_missing_installation_id_reports_pending(
+ self, _name, setup_action, expected_setup_action, expected_requested_approval, mock_report
+ ):
+ client = HttpClient()
+ client.force_login(self.user)
+ state_token = "pending-token"
+ store_unified_authorize_state(
+ GitHubAuthorizeState(
+ token=state_token,
+ flow=FlowKind.TEAM_INSTALL,
+ user_id=self.user.id,
+ team_id=self.team.pk,
+ next_url=f"/project/{self.team.pk}/integrations/github",
+ ),
+ )
+
+ response = client.get(
+ "/integrations/github/callback/",
+ {"setup_action": setup_action, "state": urlencode({"token": state_token})},
+ )
+
+ assert response.status_code == status.HTTP_302_FOUND
+ assert mock_report.call_count == 1
+ args, kwargs = mock_report.call_args
+ assert args[1] == "integration install pending"
+ assert args[2] == {
+ "integration_kind": "github",
+ "setup_action": expected_setup_action,
+ "requested_approval": expected_requested_approval,
+ }
+ assert kwargs["team"] == self.team
+
@patch("posthog.models.github_integration_base.GitHubIntegrationBase.verify_user_installation_access")
@patch("posthog.models.integration.GitHubIntegration.github_user_from_code")
@patch("posthog.models.integration.GitHubIntegration.integration_from_installation_id")
diff --git a/posthog/api/test/test_user_integration.py b/posthog/api/test/test_user_integration.py
index 69c81050c3c8..72163a71f8c7 100644
--- a/posthog/api/test/test_user_integration.py
+++ b/posthog/api/test/test_user_integration.py
@@ -1031,6 +1031,58 @@ class TestUserGitHubIntegrationFromInstallation(APIBaseTest):
self.assertEqual(integration.integration_id, "12345")
self.assertEqual(integration.sensitive_config["user_access_token"], "gho_refreshed")
+ @parameterized.expand(
+ [
+ ("deliberate_link", False, False),
+ ("rode_along_with_team_install", True, True),
+ ]
+ )
+ @patch("posthog.event_usage.report_user_action")
+ def test_reports_personal_integration_created(self, _name, create_only, expected_auto_created, mock_report):
+ user_github_integration_from_installation(
+ self.user,
+ GitHubInstallationAccess(
+ installation_id="12345",
+ installation_info={"account": {"type": "Organization", "login": "posthog"}},
+ access_token="ghs_install",
+ token_expires_at="2099-01-01T00:00:00Z",
+ repository_selection="selected",
+ ),
+ _authorization(),
+ create_only=create_only,
+ )
+
+ self.assertEqual(mock_report.call_count, 1)
+ args, _kwargs = mock_report.call_args
+ self.assertEqual(args[1], "personal integration created")
+ self.assertEqual(
+ args[2],
+ {
+ "integration_kind": "github",
+ "repo_owner_type": "Organization",
+ "account_type": "organization",
+ "auto_created": expected_auto_created,
+ },
+ )
+
+ @patch("posthog.event_usage.report_user_action")
+ def test_relinking_same_installation_does_not_report_again(self, mock_report):
+ _create_user_integration(self.user, integration_id="12345")
+
+ user_github_integration_from_installation(
+ self.user,
+ GitHubInstallationAccess(
+ installation_id="12345",
+ installation_info={"account": {"type": "User", "login": "octocat"}},
+ access_token="ghs_refreshed",
+ token_expires_at="2099-01-01T00:00:00Z",
+ repository_selection="all",
+ ),
+ _authorization(),
+ )
+
+ self.assertEqual(mock_report.call_count, 0)
+
class TestGithubUserFromCode(APIBaseTest):
@patch("posthog.egress.transport.transport.requests.request")
diff --git a/posthog/models/integration.py b/posthog/models/integration.py
index 2fda85a85e9d..fa9ffb135a15 100644
--- a/posthog/models/integration.py
+++ b/posthog/models/integration.py
@@ -3404,6 +3404,15 @@ def invalidate_github_repository_caches_for_installation(installation_id: str |
).update(repository_cache_updated_at=None)
+def github_account_type(owner_type: str | None) -> str | None:
+ """Normalize GitHub's account ``type`` ("Organization" / "User") to org vs personal."""
+ if owner_type == "Organization":
+ return "organization"
+ if owner_type == "User":
+ return "personal"
+ return None
+
+
class GitHubIntegration(GitHubIntegrationBase):
integration: Integration
@@ -3470,6 +3479,34 @@ class GitHubIntegration(GitHubIntegrationBase):
integration.errors = ""
integration.save()
+ # Every other kind reports this from IntegrationSerializer.create(). GitHub also gets created
+ # through its App installation callback and through agentic provisioning, which never reach
+ # that serializer, so this is the one place every GitHub connect passes through.
+ # IntegrationSerializer.create() skips github for the same reason: its own github branch ends
+ # up here, and reporting in both would count one connection twice.
+ if created and created_by is not None:
+ from posthog.event_usage import ( # noqa: PLC0415 — posthog.event_usage imports posthog.models
+ report_user_action,
+ )
+
+ owner_type = dot_get(installation_access.installation_info, "account.type", None)
+ try:
+ report_user_action(
+ created_by,
+ "integration created",
+ {
+ "integration_kind": "github",
+ "is_overwrite": False,
+ "repo_owner_type": owner_type,
+ "account_type": github_account_type(owner_type),
+ },
+ team=integration.team,
+ )
+ except Exception:
+ # The integration row is already committed. Raising here would report a connection
+ # that actually succeeded as a failure.
+ logger.exception("github_integration: failed to report integration created")
+
invalidate_github_repository_caches_for_installation(installation_id)
return integration
diff --git a/posthog/models/user_integration.py b/posthog/models/user_integration.py
index 5993997faa21..f2c4ff39a9cd 100644
--- a/posthog/models/user_integration.py
+++ b/posthog/models/user_integration.py
@@ -12,7 +12,7 @@ from posthog.egress.github.transport import github_request, raise_if_github_rate
from posthog.egress.limiter.policies import Priority
from posthog.helpers.encrypted_fields import EncryptedJSONField
from posthog.models.github_integration_base import GitHubIntegrationBase
-from posthog.models.integration import invalidate_github_repository_caches_for_installation
+from posthog.models.integration import github_account_type, invalidate_github_repository_caches_for_installation
from posthog.models.utils import UUIDModel
if TYPE_CHECKING:
@@ -539,7 +539,7 @@ def user_github_integration_from_installation(
}
if create_only:
- integration, _created = UserIntegration.objects.get_or_create(
+ integration, created = UserIntegration.objects.get_or_create(
user=user,
kind=UserIntegration.IntegrationKind.GITHUB,
integration_id=installation.installation_id,
@@ -549,7 +549,7 @@ def user_github_integration_from_installation(
},
)
else:
- integration, _created = UserIntegration.objects.update_or_create(
+ integration, created = UserIntegration.objects.update_or_create(
user=user,
kind=UserIntegration.IntegrationKind.GITHUB,
integration_id=installation.installation_id,
@@ -559,9 +559,41 @@ def user_github_integration_from_installation(
},
)
invalidate_github_repository_caches_for_installation(installation.installation_id)
+
+ if created:
+ _report_personal_integration_created(user, config, auto_created=create_only)
+
return integration
+def _report_personal_integration_created(user: "User", config: dict[str, Any], *, auto_created: bool) -> None:
+ """Personal integrations live in their own table and never pass through the team integration
+ path, so ``integration created`` cannot see them. They get their own event rather than a scope
+ property on the team one, because saved insights already count ``integration created`` unfiltered
+ and would silently start including personal links.
+ """
+ from posthog.event_usage import report_user_action # noqa: PLC0415 — posthog.event_usage imports posthog.models
+
+ owner_type = (config.get("account") or {}).get("type")
+ try:
+ report_user_action(
+ user,
+ "personal integration created",
+ {
+ "integration_kind": "github",
+ "repo_owner_type": owner_type,
+ "account_type": github_account_type(owner_type),
+ # True when the row rode along with a team App install rather than the user
+ # deliberately linking their account under Personal integrations.
+ "auto_created": auto_created,
+ },
+ )
+ except Exception:
+ # The row is already committed. Raising here would report a link that actually succeeded as
+ # a failure, and on the team install path it would take the team connect down with it.
+ logger.exception("user_github_integration: failed to report personal integration created")
+
+
def refresh_user_github_installation_access(
integration: UserIntegration,
installation: "GitHubInstallationAccess",
diff --git a/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx b/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx
index 23a365b2d07e..4259c675b060 100644
--- a/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx
+++ b/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx
@@ -10,6 +10,7 @@ import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { LemonField } from 'lib/lemon-ui/LemonField'
import type { LemonInputSelectOption } from 'lib/lemon-ui/LemonInputSelect/LemonInputSelect'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { InputSuggestion, InputWithSuggestionsDropdown } from './InputWithSuggestionsDropdown'
@@ -119,10 +120,15 @@ function captionHelp(caption?: string): JSX.Element | undefined {
/** Re-run OAuth for the connected integration in place, so a failed account load is recoverable
* without hunting for the disconnect/reconnect action elsewhere on the page. */
function ReconnectLink({ integrationKind }: { integrationKind: string }): JSX.Element {
+ const { reportIntegrationConnectClicked } = useActions(eventUsageLogic)
+
return (
<Link
disableClientSideRouting
to={api.integrations.authorizeUrl({ kind: integrationKind, next: window.location.pathname })}
+ onClick={() =>
+ reportIntegrationConnectClicked(integrationKind, integrationKind, 'warehouse_source_reconnect')
+ }
>
Reconnect
</Link>
diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/RepositorySelector.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/RepositorySelector.tsx
index 9defe1fa2476..ac530797eec8 100644
--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/RepositorySelector.tsx
+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/RepositorySelector.tsx
@@ -1,4 +1,4 @@
-import { useValues } from 'kea'
+import { useActions, useValues } from 'kea'
import { IconGitBranch, IconGithub } from '@posthog/icons'
import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
@@ -9,6 +9,7 @@ import { GitHubBranchCombobox } from 'lib/integrations/GitHubBranchCombobox'
import { GitHubRepositoryCombobox } from 'lib/integrations/GitHubRepositoryCombobox'
import { githubRepositorySearchLogic } from 'lib/integrations/githubRepositorySearchLogic'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { urls } from 'scenes/urls'
import type { RepositoryConfig } from '../../../types/taskTypes'
@@ -27,8 +28,11 @@ const githubAuthorizeUrl = api.integrations.authorizeUrl({ kind: 'github', next:
*/
export function RepositorySelector({ value, onChange }: RepositorySelectorProps): JSX.Element {
const { getIntegrationsByKind, integrationsLoading } = useValues(integrationsLogic)
+ const { reportIntegrationConnectClicked } = useActions(eventUsageLogic)
const githubIntegrations = getIntegrationsByKind(['github'])
+ const reportConnect = (): void => reportIntegrationConnectClicked('github', 'github', 'task_composer')
+
// Selecting a repo clears the branch so GitHubBranchCombobox auto-picks the new repo's default branch.
const handleRepositoryChange = (repository: string | null): void => {
onChange({ ...value, repository: repository ?? undefined, branch: undefined })
@@ -63,6 +67,7 @@ export function RepositorySelector({ value, onChange }: RepositorySelectorProps)
icon={<IconGithub />}
to={githubAuthorizeUrl}
disableClientSideRouting
+ onClick={reportConnect}
>
Connect GitHub
</LemonButton>
@@ -91,7 +96,12 @@ export function RepositorySelector({ value, onChange }: RepositorySelectorProps)
},
{
items: [
- { to: githubAuthorizeUrl, disableClientSideRouting: true, label: 'Connect another' },
+ {
+ to: githubAuthorizeUrl,
+ disableClientSideRouting: true,
+ onClick: reportConnect,
+ label: 'Connect another',
+ },
{ to: urls.settings('project-integrations'), label: 'Manage integrations' },
],
},
diff --git a/products/signals/frontend/inbox/components/shell/AgentSetupColumn.tsx b/products/signals/frontend/inbox/components/shell/AgentSetupColumn.tsx
index 446fafab78eb..675683a46a26 100644
--- a/products/signals/frontend/inbox/components/shell/AgentSetupColumn.tsx
+++ b/products/signals/frontend/inbox/components/shell/AgentSetupColumn.tsx
@@ -302,7 +302,12 @@ function NotificationsWidget(): JSX.Element {
*/
function GithubSetupBody(): JSX.Element {
const { location, searchParams } = useValues(router)
- return <GithubIntegration next={combineUrl(location.pathname, { ...searchParams, setup: 'github' }).url} />
+ return (
+ <GithubIntegration
+ next={combineUrl(location.pathname, { ...searchParams, setup: 'github' }).url}
+ connectSurface="signals_agent_setup"
+ />
+ )
}
const SETUP_MODALS: Record<
diff --git a/products/visual_review/frontend/scenes/VisualReviewSettingsScene.tsx b/products/visual_review/frontend/scenes/VisualReviewSettingsScene.tsx
index 8b099a64281e..507d07d8e10f 100644
--- a/products/visual_review/frontend/scenes/VisualReviewSettingsScene.tsx
+++ b/products/visual_review/frontend/scenes/VisualReviewSettingsScene.tsx
@@ -6,6 +6,7 @@ import { LemonButton, LemonInput, LemonSearchableSelect, LemonSkeleton, LemonSwi
import api from 'lib/api'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { SceneExport } from 'scenes/sceneTypes'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
@@ -24,6 +25,8 @@ export const scene: SceneExport = {
}
function GitHubConnectPrompt(): JSX.Element {
+ const { reportIntegrationConnectClicked } = useActions(eventUsageLogic)
+
return (
<div className="border rounded-lg p-6 text-center">
<div className="space-y-4 flex flex-col items-center">
@@ -42,6 +45,7 @@ function GitHubConnectPrompt(): JSX.Element {
kind: 'github',
next: window.location.pathname,
})}
+ onClick={() => reportIntegrationConnectClicked('github', 'github', 'visual_review_settings')}
>
Connect GitHub
</LemonButton>