You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-app-configuration/feature-management-javascript-reference.md
+32-3Lines changed: 32 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -453,11 +453,24 @@ In the above example, the feature is enabled for users named `Jeff` and `Alicia`
453
453
454
454
An example web application that uses the targeting feature filter is available in this [example](https://github.com/microsoft/FeatureManagement-JavaScript/tree/preview/examples/express-app) project.
455
455
456
-
#### Ambient targeting context
457
-
458
456
In web applications, especially those with multiple components or layers, passing targeting context (`userId` and `groups`) to every feature flag check can become cumbersome and repetitive. This scenario is referred to as "ambient targeting context," where the user identity information is already available in the application context (such as in session data or authentication context) but needs to be accessible to feature management evaluations throughout the application.
459
457
460
-
The library provides a solution through the `targetingContextAccessor` pattern. Instead of explicitly passing the targeting context with each `isEnabled` or `getVariant` call, you can provide a function that knows how to retrieve the current user's targeting information from your application's context:
458
+
#### ITargetingContextAccessor
459
+
460
+
The library provides a solution through the `ITargetingContextAccessor` pattern.
Instead of explicitly passing the targeting context with each `isEnabled` or `getVariant` call, you can provide a function that knows how to retrieve the current user's targeting information from your application's context:
@@ -828,6 +841,22 @@ trackEvent(appInsights.defaultClient, "<TARGETING_ID>", {name: "TestEvent", pro
828
841
829
842
The telemetry publisher sends `FeatureEvaluation` custom events to the Application Insights when a feature flag enabled with telemetry is evaluated. The custom event follows the [FeatureEvaluationEvent](https://github.com/microsoft/FeatureManagement/tree/main/Schema/FeatureEvaluationEvent) schema.
830
843
844
+
### Targeting telemetry processor
845
+
846
+
If you have implemented [`ITargetingContextAccessor`](#itargetingcontextaccessor), you can use the built-in Application Insights telemetry processor to automatically attached targeting id information to telemetry by calling `createTargetingTelemetryProcessor` function.
This ensures that every telemetry sent to Application Insights includes the targeting id information, allowing you to correlate feature flag usage in your analytics.
859
+
831
860
## Next steps
832
861
833
862
To learn how to use feature flags in your applications, continue to the following quickstarts.
0 commit comments