diff --git a/package.json b/package.json index b8f9fc730..1f8aa1ccc 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@material-ui/core": "^4.9.0", "@material-ui/icons": "^4.5.1", "@material-ui/lab": "^4.0.0-alpha.46", + "@microsoft/applicationinsights-web": "^2.5.11", "@redux-beacon/google-analytics-gtag": "^1.0.2", "@redux-beacon/logger": "^1.0.0", "@redux-beacon/offline-web": "^1.0.0", diff --git a/public/index.html b/public/index.html index bfd965afe..ffee1c181 100644 --- a/public/index.html +++ b/public/index.html @@ -25,6 +25,7 @@ https://ssl.gstatic.com https://www.youtube.com/ https://*.cloudfront.net/ + https://*.visualstudio.com/ blob: gap: data:; diff --git a/src/constants.js b/src/constants.js index d2950606a..1fa9798da 100644 --- a/src/constants.js +++ b/src/constants.js @@ -12,3 +12,4 @@ export const TAWASOL_BASE_PATH_API = 'https://madaportal.org/tawasol/wp-json/custom/v2/dea44ade76/'; export const TAWASOL_BASE_IMAGE_URL = 'https://www.madaportal.org/tawasol/wp-content/uploads/images/'; +export const AZURE_INST_KEY = process.env.AZURE_INST_KEY || null; diff --git a/src/index.js b/src/index.js index e02425ae3..f3a07ff95 100644 --- a/src/index.js +++ b/src/index.js @@ -15,7 +15,20 @@ import LanguageProvider from './providers/LanguageProvider'; import SpeechProvider from './providers/SpeechProvider'; import ThemeProvider from './providers/ThemeProvider'; import configureStore, { getStore } from './store'; +import { ApplicationInsights } from '@microsoft/applicationinsights-web'; +import { AZURE_INST_KEY } from './constants'; +if (AZURE_INST_KEY) { + const appInsights = new ApplicationInsights({ + config: { + instrumentationKey: AZURE_INST_KEY, + enableAutoRouteTracking: true, + loggingLevelTelemetry: 2 + } + }); + appInsights.loadAppInsights(); + appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview +} const { persistor } = configureStore(); const store = getStore(); const dndOptions = {