Skip to content

Commit da0f968

Browse files
use commonjs for node example
1 parent 8fd3ea7 commit da0f968

File tree

2 files changed

+9
-10
lines changed
  • src
    • feature-management-applicationinsights-browser
    • feature-management-applicationinsights-node

2 files changed

+9
-10
lines changed

src/feature-management-applicationinsights-browser/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microso
1212
import { createTelemetryPublisher, trackEvent } from "@microsoft/feature-management-applicationinsights-browser";
1313

1414
const appInsights = new ApplicationInsights({ config: {
15-
connectionString: CONNECTION_STRING
15+
connectionString: "<APPINSIGHTS_CONNECTION_STRING>"
1616
}});
1717
appInsights.loadAppInsights();
1818

src/feature-management-applicationinsights-node/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Microsoft Feature Management Application Insights Plugin for Node
1+
# Microsoft Feature Management Application Insights Plugin for Browser
22

3-
Feature Management Application Insights Plugin for Node provides a solution for sending feature flag evaluation events produced by the Feature Management library.
3+
Feature Management Application Insights Plugin for Browser provides a solution for sending feature flag evaluation events produced by the Feature Management library.
44

55
## Getting Started
66

@@ -11,22 +11,21 @@ Feature Management Application Insights Plugin for Node provides a solution for
1111
### Usage
1212

1313
``` javascript
14-
import appInsights from "applicationinsights";
15-
import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microsoft/feature-management";
16-
import { createTelemetryPublisher, trackEvent } from "@microsoft/feature-management-applicationinsights-node";
14+
const appInsights = require("applicationinsights");
15+
appInsights.setup(process.env.APPINSIGHTS_CONNECTION_STRING).start();
1716

18-
appInsights.setup(CONNECTION_STRING)
19-
.start();
17+
const { FeatureManager, ConfigurationObjectFeatureFlagProvider } = require("@microsoft/feature-management");
18+
const { createTelemetryPublisher, trackEvent } = require("@microsoft/feature-management-applicationinsights-node");
2019

2120
const publishTelemetry = createTelemetryPublisher(appInsights.defaultClient);
2221
const provider = new ConfigurationObjectFeatureFlagProvider(jsonObject);
2322
const featureManager = new FeatureManager(provider, {onFeatureEvaluated: publishTelemetry});
2423

2524
// FeatureEvaluation event will be emitted when a feature flag is evaluated
26-
featureManager.getVariant("TestFeature", {userId : TARGETING_ID}).then((variant) => { /* do something*/ });
25+
featureManager.getVariant("TestFeature", {userId : "<TARGETING_ID>"}).then((variant) => { /* do something*/ });
2726

2827
// Emit a custom event with targeting id attached.
29-
trackEvent(appInsights.defaultClient, TARGETING_ID, {name: "TestEvent"});
28+
trackEvent(appInsights.defaultClient, "<TARGETING_ID>", {name: "TestEvent"});
3029
```
3130

3231
## Contributing

0 commit comments

Comments
 (0)