-
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.
- Loading branch information
1 parent
6400990
commit 6922a54
Showing
7 changed files
with
81 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FC, useEffect } from 'react'; | ||
|
||
const AnalyticsMonsido: FC = () => { | ||
const { hostname } = location; | ||
const isFellesDatakatalog = [ | ||
'data.norge.no', | ||
'fellesdatakatalog.digdir.no' | ||
].includes(hostname); | ||
const isTransportPortal = ['data.transportportal.no'].includes(hostname); | ||
|
||
useEffect(() => { | ||
const scriptInline = document.createElement('script'); | ||
const script = document.createElement('script'); | ||
|
||
scriptInline.type = 'text/javascript'; | ||
scriptInline.innerHTML = ` | ||
window._monsido = window._monsido || { | ||
token: ${ | ||
isTransportPortal | ||
? 'H7pMv_I-KwnWIR1nkiCXuw' | ||
: 'xAbTzhYnF9PHMK5X7XE-8g' | ||
}, | ||
heatmap: { enabled: true } | ||
}; | ||
`; | ||
|
||
script.src = 'https://app-script.monsido.com/v2/monsido-script.js'; | ||
script.async = true; | ||
|
||
if (isFellesDatakatalog || isTransportPortal) { | ||
document.body.appendChild(scriptInline); | ||
document.body.appendChild(script); | ||
} | ||
|
||
return () => { | ||
if (isFellesDatakatalog || isTransportPortal) { | ||
document.body.removeChild(scriptInline); | ||
document.body.removeChild(script); | ||
} | ||
}; | ||
}, []); | ||
|
||
return null; | ||
}; | ||
|
||
export default AnalyticsMonsido; |
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,20 @@ | ||
import { FC, useEffect } from 'react'; | ||
|
||
const AnalyticsSiteImprove: FC = () => { | ||
useEffect(() => { | ||
const script = document.createElement('script'); | ||
|
||
script.src = 'https://siteimproveanalytics.com/js/siteanalyze_6255470.js'; | ||
script.async = true; | ||
|
||
document.body.appendChild(script); | ||
|
||
return () => { | ||
document.body.removeChild(script); | ||
}; | ||
}, []); | ||
|
||
return null; | ||
}; | ||
|
||
export default AnalyticsSiteImprove; |
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