Skip to content

Commit a31de75

Browse files
committed
publish(2.4): new set InstrumentationKey later feature
1 parent 2c6c713 commit a31de75

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Microsoft Azure Application Insights Angular v2+ implementation
22

3-
> Connect your Angular 2+ client-side to Microsofts Application Insights with this easy-to-use Module.
3+
> Connect your Angular 2+ client-side to Microsofts Application Insights with this easy-to-use Module.
44
55
## Installation:
66

@@ -35,6 +35,27 @@ import { ApplicationInsightsModule, AppInsightsService } from '@markpieszak/ng-a
3535
export class YourRootModule { }
3636
```
3737

38+
### What if you don't know your instrumentationKey right away?
39+
40+
```typescript
41+
// Use instrumentationKeySetlater
42+
ApplicationInsightsModule.forRoot({
43+
instrumentationKeySetlater: true // <--
44+
})
45+
46+
// Then later in your Application somewhere
47+
constructor(
48+
private appInsightsService: AppInsightsService
49+
) {
50+
appInsightsService.config = {
51+
instrumentationKey: __env.APPINSIGHTS_INSTRUMENTATIONKEY // <-- set it later sometime
52+
}
53+
// then make sure to initialize and start-up app insights
54+
appInsightsService.init();
55+
}
56+
57+
```
58+
3859
## Usage:
3960

4061
Through out your application you can now use the AppInsightsService class to fire off AppInsights functionality.

package-lock.json

Lines changed: 11 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@markpieszak/ng-application-insights",
3-
"version": "2.3.4",
3+
"version": "2.4.0",
44
"scripts": {
55
"lint": "tslint -p tsconfig.json",
66
"clean": "rimraf ./dist",
@@ -26,7 +26,7 @@
2626
"@types/applicationinsights-js": "^1.0.2"
2727
},
2828
"peerDependencies": {
29-
"@angular/router" : "^4.0.0",
29+
"@angular/router": "^4.0.0",
3030
"rxjs": "^5.0.3"
3131
},
3232
"devDependencies": {

0 commit comments

Comments
 (0)