Skip to content

Commit

Permalink
161 use google analytics onetrust module (#490)
Browse files Browse the repository at this point in the history
* Adding Github workflow

* ADDING A read me

* Remove the docker openshift file

* Update README.md

* Update README.md

* configure github action

* 161 use Google Analytics + OneTrust module, Upgrade react, react-dom

* updated package tag, gh actions build

* adjust workflow

* add img-src, privacy redirect for banner link

* drop repo owner change

* drop branch

* last workflow change to remove

* package update

---------

Co-authored-by: Pushyami Gundala <[email protected]>
Co-authored-by: Pushyami Gundala <[email protected]>
  • Loading branch information
3 people authored Nov 18, 2024
1 parent 0ac8eb4 commit 200bd63
Show file tree
Hide file tree
Showing 12 changed files with 539 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ccm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
release:
# Making sure that release only runs for tag pushes
if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'tl-its-umich-edu'
if: startsWith(github.ref, 'refs/tags/') && (github.repository_owner == 'tl-its-umich-edu')
needs: build # This ensures the build job finishes successfully before starting this job
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 8 additions & 0 deletions ccm_web/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ErrorAlert from './components/ErrorAlert.js'
import Layout from './components/Layout.js'
import useGlobals from './hooks/useGlobals.js'
import usePromise from './hooks/usePromise.js'
import { useGoogleAnalytics, UseGoogleAnalyticsParams } from '@tl-its-umich-edu/react-ga-onetrust-consent'
import { CanvasCourseBase } from './models/canvas.js'
import allFeatures from './models/FeatureUIData.js'
import Home from './pages/Home.js'
Expand All @@ -22,6 +23,13 @@ function App (): JSX.Element {

const [globals, csrfToken, isAuthenticated, isLoading, globalsError, csrfTokenCookieError] = useGlobals()

const googleAnalyticsConfig: UseGoogleAnalyticsParams = {
googleAnalyticsId: globals?.googleAnalyticsId ?? '',
oneTrustScriptDomain: globals?.oneTrustScriptDomain ?? '',
debug: false
}
useGoogleAnalytics(googleAnalyticsConfig);

const [course, setCourse] = useState<undefined|CanvasCourseBase>(undefined)
const [doLoadCourse, isCourseLoading, getCourseError] = usePromise<CanvasCourseBase|undefined, typeof getCourse>(
async (courseId: number): Promise<CanvasCourseBase> => {
Expand Down
6 changes: 3 additions & 3 deletions ccm_web/client/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SnackbarProvider } from 'notistack'
import React from 'react'
import { createRoot } from 'react-dom/client'
import { BrowserRouter, Route, Routes } from 'react-router-dom'
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'
import { ThemeProvider, StyledEngineProvider } from '@mui/material'

import App from './App.js'
Expand All @@ -21,13 +21,13 @@ root.render(
<StyledEngineProvider injectFirst>
<ThemeProvider theme={ccmTheme}>
<SnackbarProvider maxSnack={3}>
<BrowserRouter>
<Router>
<Routes>
<Route path='/access-denied' element={<AccessDenied {...helpContactProps} />}/>
<Route path='/launch-error' element={<LaunchError {...helpContactProps} />}/>
<Route path='*' element={<App />}/>
</Routes>
</BrowserRouter>
</Router>
</SnackbarProvider>
</ThemeProvider>
</StyledEngineProvider>
Expand Down
2 changes: 2 additions & 0 deletions ccm_web/client/src/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export interface Globals {
user: User
course: Course
baseHelpURL: string
googleAnalyticsId: string;
oneTrustScriptDomain: string;
}

export interface CsrfToken {
Expand Down
Loading

0 comments on commit 200bd63

Please sign in to comment.