( userId: string, traits?: Record<string, any>, )
| 116 | * Identify a user |
| 117 | */ |
| 118 | export function identify( |
| 119 | userId: string, |
| 120 | traits?: Record<string, any>, |
| 121 | ) { |
| 122 | currentUserId = userId |
| 123 | |
| 124 | // Skip in development mode |
| 125 | if (isDev) return |
| 126 | |
| 127 | // Skip if user opted out |
| 128 | if (isOptedOut()) return |
| 129 | |
| 130 | if (!initialized) return |
| 131 | |
| 132 | posthog.identify(userId, { |
| 133 | ...getCommonProperties(), |
| 134 | ...traits, |
| 135 | }) |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Get current user ID |
no test coverage detected