MCPcopy Create free account
hub / github.com/Noumena-Network/code / logExposureForFeature

Function logExposureForFeature

src/services/analytics/growthbook.ts:327–348  ·  view source on GitHub ↗

* Log experiment exposure for a feature if it has experiment data. * Deduplicates within a session - each feature is logged at most once.

(feature: string)

Source from the content-addressed store, hash-verified

325 * Deduplicates within a session - each feature is logged at most once.
326 */
327function logExposureForFeature(feature: string): void {
328 const canonicalFeature = toCanonicalAnalyticsName(feature)
329 // Skip if already logged this session (dedup)
330 if (loggedExposures.has(canonicalFeature)) {
331 return
332 }
333
334 const expData =
335 experimentDataByFeature.get(canonicalFeature) ??
336 experimentDataByFeature.get(feature)
337 if (expData) {
338 loggedExposures.add(canonicalFeature)
339 logGrowthBookExperimentTo1P({
340 experimentId: expData.experimentId,
341 variationId: expData.variationId,
342 userAttributes: getUserAttributes(),
343 experimentMetadata: {
344 feature_id: canonicalFeature,
345 },
346 })
347 }
348}
349
350function updateExperimentDataForFeature(
351 feature: string,

Calls 6

toCanonicalAnalyticsNameFunction · 0.85
getUserAttributesFunction · 0.85
hasMethod · 0.45
getMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected