MCPcopy Create free account
hub / github.com/winfunc/opcode / identify

Method identify

src/lib/analytics/index.ts:174–188  ·  view source on GitHub ↗
(traits?: Record<string, any>)

Source from the content-addressed store, hash-verified

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> = {};

Callers 1

initializePostHogMethod · 0.80

Calls 3

sanitizePropertiesMethod · 0.95
getUserIdMethod · 0.80
isEnabledMethod · 0.45

Tested by

no test coverage detected