This repository has been archived by the owner on Jun 10, 2020. It is now read-only.
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.
Add an option to enable emitting the JS required to track authenticated users #311
Closed
Description
Add a new property ApplicationInsightsServiceOptions.EnableAuthenticatedUserTracking
that adds the following to the emitted JS:
appInsights.setAuthenticatedUserContext("username".replace(/[,;=| ]+/g, "_"));
Note that it has to essentially be as if the user had done the following in the Razor view (this is from the AppInsights docs):
@if (User.Identity.IsAuthenticated)
{
<script>
appInsights.setAuthenticatedUserContext("@User.Identity.Name.Replace("\\", "\\\\")".replace(/[,;=| ]+/g, "_"));
</script>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels