mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-27 08:00:06 +02:00

* Rename `suppressGoogleAnalytics` to `suppressAnalytics` * Add Propensity script * Add LinkedIn Insight Tag script * Version the cookie to prevent adding unconsented tracking * Move tracking loaders to Typescript, insert them in foot_scripts.pug * Show the cookie-banner when tracking other than GA is set * Revert `oa` cookie versioning * Remove `async` from propensity script * Use shared tracking loader for Hotjar, LinkedIn, and Propensity * Reusable `insertScript` * Remove tracking-linkedin * Test the scripts by adding fake ids * Revert "Test the scripts by adding fake ids" This reverts commit 50759bb6b40fd2684d1b967d83dd71e8517c3de9. GitOrigin-RevId: 2a7b36bfc70ac1fc983f837dd4693a19a385cbc6
18 lines
639 B
TypeScript
18 lines
639 B
TypeScript
import getMeta from '@/utils/meta'
|
|
import { debugConsole } from '@/utils/debugging'
|
|
import { initializeHotjar } from '@/infrastructure/hotjar-snippet'
|
|
import { createTrackingLoader } from '@/infrastructure/tracking-loader'
|
|
|
|
const { hotjarId, hotjarVersion } = getMeta('ol-ExposedSettings')
|
|
const shouldLoadHotjar = getMeta('ol-shouldLoadHotjar')
|
|
|
|
if (hotjarId && hotjarVersion && shouldLoadHotjar) {
|
|
if (!/^\d+$/.test(hotjarId) || !/^\d+$/.test(hotjarVersion)) {
|
|
debugConsole.error('Invalid Hotjar id or version')
|
|
} else {
|
|
createTrackingLoader(
|
|
() => initializeHotjar(hotjarId, hotjarVersion),
|
|
'Hotjar'
|
|
)
|
|
}
|
|
}
|