From 62243cb716cd041b1d787089e85c9b3def7d0a99 Mon Sep 17 00:00:00 2001 From: Ash Davies <3853061+DrizzlyOwl@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:17:08 +0000 Subject: [PATCH] Application Insights front-end telemetry (#613) * Corrected indentation * Delete App Insights cookies if consent is rejected * Inject App Insights web sdk if feature is enabled * Set connection string instead of defaulting to instrumentation key * Updated Cookie Consent Policy * Use npm package for app insights web configuration * Asset build workflow --- .../Pages/Public/Cookies.cshtml | 47 ++- .../Pages/Shared/_Layout.cshtml | 25 +- .../Pages/_ViewImports.cshtml | 2 +- .../Services/AnalyticsConsentService.cs | 18 +- .../Dfe.ManageFreeSchoolProjects/Startup.cs | 5 +- .../appsettings.json | 3 +- .../wwwroot/package-lock.json | 356 +++++++++++++++++- .../wwwroot/package.json | 4 +- .../wwwroot/src/application-insights.js | 16 + .../wwwroot/webpack.appinsights.config.js | 9 + 10 files changed, 446 insertions(+), 39 deletions(-) create mode 100644 Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/wwwroot/src/application-insights.js create mode 100644 Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/wwwroot/webpack.appinsights.config.js diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Public/Cookies.cshtml b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Public/Cookies.cshtml index 2adf8bce8..60293cf7d 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Public/Cookies.cshtml +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Public/Cookies.cshtml @@ -117,6 +117,8 @@
With your permission, we use Google Analytics to collect data about how you use this website. This information helps us to improve our website.
Google Analytics is not allowed to use or share our analytics data with anyone. @@ -127,8 +129,7 @@
Google Analytics stores the following cookies:
We use Azure Application Insights software to collect information about how you use this website. We do this to help make sure the site is meeting the needs of its users and to help us make improvements.
+Azure Application Insights stores information about:
+We don't allow Microsoft to use or share our analytics data.
+ +Azure Application Insights sets the following cookies:
+Name | +Purpose | +Expires | +
---|---|---|
ai_session | +This helps us track activity happening over a single browser session | +1 hour | +
ai_user | +This helps us to identify the number of distinct users accessing the site over time by tracking if you've visited before | +1 year | +
ai_authuser | +This helps us to identify authenticated users and how they interact with the site | +When you close your browser | +