|
| 1 | +# Microsoft Feature Management Application Insights Plugin for Browser |
| 2 | + |
| 3 | +Feature Management Application Insights Plugin for Browser provides a solution for sending feature flag evaluation events produced by the Feature Management library. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- Node.js LTS version |
| 10 | + |
| 11 | +### Usage |
| 12 | + |
| 13 | +``` javascript |
| 14 | +import applicationInsights from "applicationinsights"; |
| 15 | +import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microsoft/feature-management"; |
| 16 | +import { trackEvent, publishTelemetry } from "@microsoft/feature-management-applicationinsights-node"; |
| 17 | + |
| 18 | +applicationInsights.setup(CONNECTION_STRING).start(); |
| 19 | + |
| 20 | +const provider = new ConfigurationObjectFeatureFlagProvider(jsonObject); |
| 21 | +const featureManager = new FeatureManager(provider, {onFeatureEvaluated: publishTelemetry}); |
| 22 | + |
| 23 | +// FeatureEvaluation event will be emitted when a feature flag is evaluated |
| 24 | +featureManager.getVariant("TestFeature", {userId : TARGETING_ID}).then((variant) => { /* do something*/ }); |
| 25 | + |
| 26 | +// Emit a custom event with targeting id attached. |
| 27 | +trackEvent(TARGETING_ID, {name: "TestEvent"}); |
| 28 | +``` |
| 29 | + |
| 30 | +## Contributing |
| 31 | + |
| 32 | +This project welcomes contributions and suggestions. Most contributions require you to agree to a |
| 33 | +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us |
| 34 | +the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. |
| 35 | + |
| 36 | +When you submit a pull request, a CLA bot will automatically determine whether you need to provide |
| 37 | +a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions |
| 38 | +provided by the bot. You will only need to do this once across all repos using our CLA. |
| 39 | + |
| 40 | +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). |
| 41 | +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or |
| 42 | +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
| 43 | + |
| 44 | +## Trademarks |
| 45 | + |
| 46 | +This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft |
| 47 | +trademarks or logos is subject to and must follow |
| 48 | +[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). |
| 49 | +Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. |
| 50 | +Any use of third-party trademarks or logos are subject to those third-party's policies. |
0 commit comments