Skip to content

Commit

Permalink
[main] [Web-Snippet Package] Prepare for release by update readme wit…
Browse files Browse the repository at this point in the history
…h new functions (#2275)

* Update README.md

* Update README.md

* Update README.md
  • Loading branch information
siyuniu-ms authored Feb 15, 2024
1 parent 02d4c4b commit 26a13c0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tools/applicationinsights-web-snippet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ Add the Application Insights Web Snippet to your app's dependencies and package.
npm i @microsoft/applicationinsights-web-snippet
```


Import web snippet from the package.
### Pass in Key via Function (available since v1.1.0)
Import the helper function from the package to easily get the snippet
```
import { webSnippet } from "@microsoft/applicationinsights-web-snippet";
import { getSdkLoaderScript } from "@microsoft/applicationinsights-web-snippet";
```


Replace "INSTRUMENTATION_KEY" with valid Instrumentation Key.
Configure the snippet with your connectionString.
```
webSnippet.replace("INSTRUMENTATION_KEY", your_valid_ikey);
let config = {connectionString: "InstrumentationKey=xxx"};
// or let config = {instrumentationKey: key};
let theSnippet = getSdkLoaderScript(config);
```



More details on web snippet, see [Web Snippet](https://github.com/microsoft/ApplicationInsights-JS#snippet-setup-ignore-if-using-npm-setup).

## Build
Expand Down

0 comments on commit 26a13c0

Please sign in to comment.