Skip to content

Commit d74e803

Browse files
authored
Merge pull request TrilonIO#42 from GustavoAmerico/patch-1
Fix user details on track events closes TrilonIO#41
2 parents bea6391 + ffd9146 commit d74e803

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"main": "./dist/index.js",
2323
"types": "./dist/index.d.ts",
2424
"dependencies": {
25-
"applicationinsights-js": "^1.0.12",
26-
"@types/applicationinsights-js": "^1.0.2"
25+
"applicationinsights-js": "^1.0.15",
26+
"@types/applicationinsights-js": "^1.0.5"
2727
},
2828
"peerDependencies": {
2929
"@angular/router": "^5.0.0",

src/app-insight.service.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,20 @@ export class AppInsightsService implements IAppInsights {
178178
// setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string)
179179
// Set the authenticated user id and the account id in this session. Use this when you have identified a specific
180180
// signed-in user. Parameters must not contain spaces or ,;=|
181-
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string) {
181+
/**
182+
* Sets the authenticated user id and the account id.
183+
* User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
184+
*
185+
* By default the method will only set the authUserID and accountId for all events in this page view. To add them to all events within
186+
* the whole session, you should either call this method on every page view or set `storeInCookie = true`.
187+
*
188+
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
189+
* @param accountId {string} - An optional string to represent the account associated with the authenticated user.
190+
* @param storeInCookie {boolean} - AuthenticateUserID will be stored in a cookie and added to all events within this session.
191+
*/
192+
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string, storeInCookie:boolean = false) {
182193
try {
183-
AppInsights.setAuthenticatedUserContext(authenticatedUserId, accountId);
194+
AppInsights.setAuthenticatedUserContext(authenticatedUserId, accountId, storeInCookie);
184195
} catch (ex) {
185196
console.warn('Angular application insights Error [setAuthenticatedUserContext]: ', ex);
186197
}

0 commit comments

Comments
 (0)