-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Making it a shared partial keeps the _layout.cshtml cleaner * Adds missing configuration for click tracking and user identification * Extract App Insights connection string into Options
- Loading branch information
1 parent
5372d77
commit 7efdfe8
Showing
6 changed files
with
29 additions
and
14 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
Dfe.PrepareConversions/Dfe.PrepareConversions/Configuration/ApplicationInsightsOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Dfe.PrepareConversions.Configuration; | ||
|
||
public class ApplicationInsightsOptions | ||
{ | ||
public const string ConfigurationSection = "ApplicationInsights"; | ||
public string ConnectionString { get; set; } | ||
public string InstrumentationKey { get; set; } | ||
} |
12 changes: 12 additions & 0 deletions
12
Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_AppInsights.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@{ | ||
var authenticatedUserId = (User.Identity is not null && User.Identity.IsAuthenticated) ? User.Identity.Name ?? "Unknown" : "Anonymous"; | ||
} | ||
<script type="text/javascript" integrity="sha384-g/ZkzetdQypWdY0NBZT5r2L3BR9/hURD8OBcd1rEaBpgX6QC7EaTL+o+mzWrBcXW" crossorigin="anonymous" src="https://js.monitor.azure.com/scripts/b/ext/ai.clck.2.8.18.min.js"></script> | ||
<script type="text/javascript" asp-add-nonce> | ||
window.appInsights = { | ||
connectionString: '@ApplicationInsightsOptions.Value.ConnectionString', | ||
instrumentationKey: '@ApplicationInsightsOptions.Value.InstrumentationKey', | ||
authenticatedUserId: '@authenticatedUserId' | ||
} | ||
</script> | ||
<script type="text/javascript" src="~/dist/application-insights.min.js" asp-add-nonce></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters