MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getUserAttributes

Function getUserAttributes

src/services/analytics/growthbook.ts:454–485  ·  view source on GitHub ↗

* Get user attributes for GrowthBook from CoreUserData

()

Source from the content-addressed store, hash-verified

452 * Get user attributes for GrowthBook from CoreUserData
453 */
454function getUserAttributes(): GrowthBookUserAttributes {
455 const user = getUserForGrowthBook()
456
457 // For ants, always try to include email from OAuth config even if ANTHROPIC_API_KEY is set.
458 // This ensures GrowthBook targeting by email works regardless of auth method.
459 let email = user.email
460 if (!email && process.env.USER_TYPE === 'ant') {
461 email = getGlobalConfig().oauthAccount?.emailAddress
462 }
463
464 const apiBaseUrlHost = getApiBaseUrlHost()
465
466 const attributes = {
467 id: user.deviceId,
468 sessionId: user.sessionId,
469 deviceID: user.deviceId,
470 platform: user.platform,
471 ...(apiBaseUrlHost && { apiBaseUrlHost }),
472 ...(user.organizationUuid && { organizationUUID: user.organizationUuid }),
473 ...(user.accountUuid && { accountUUID: user.accountUuid }),
474 ...(user.userType && { userType: user.userType }),
475 ...(user.subscriptionType && { subscriptionType: user.subscriptionType }),
476 ...(user.rateLimitTier && { rateLimitTier: user.rateLimitTier }),
477 ...(user.firstTokenTime && { firstTokenTime: user.firstTokenTime }),
478 ...(email && { email }),
479 ...(user.appVersion && { appVersion: user.appVersion }),
480 ...(user.githubActionsMetadata && {
481 githubActionsMetadata: user.githubActionsMetadata,
482 }),
483 }
484 return attributes
485}
486
487/**
488 * Get or create the GrowthBook client instance

Callers 2

logExposureForFeatureFunction · 0.85
growthbook.tsFile · 0.85

Calls 3

getUserForGrowthBookFunction · 0.85
getGlobalConfigFunction · 0.85
getApiBaseUrlHostFunction · 0.85

Tested by

no test coverage detected