(traits?: Record<string, any>)
| 172 | } |
| 173 | |
| 174 | identify(traits?: Record<string, any>): void { |
| 175 | if (!this.consentManager.isEnabled()) { |
| 176 | return; |
| 177 | } |
| 178 | |
| 179 | const userId = this.consentManager.getUserId(); |
| 180 | const sanitizedTraits = this.sanitizeProperties(traits || {}); |
| 181 | |
| 182 | if (typeof posthog !== 'undefined' && posthog.identify) { |
| 183 | posthog.identify(userId, { |
| 184 | ...sanitizedTraits, |
| 185 | anonymous: true, |
| 186 | }); |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | private sanitizeProperties(properties: Record<string, any>): Record<string, any> { |
| 191 | const sanitized: Record<string, any> = {}; |
no test coverage detected