docs: added tracking

This commit is contained in:
alina 🌸 2023-11-16 02:41:48 +03:00
parent 4a027d5498
commit 1b6e41a709
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
2 changed files with 27 additions and 0 deletions

View file

@ -17,5 +17,6 @@ module.exports = {
externalPattern: ['**/dist/**'], externalPattern: ['**/dist/**'],
plugin: [ plugin: [
'./plugin-external-links.cjs', './plugin-external-links.cjs',
'./plugin-umami.cjs',
], ],
} }

View file

@ -0,0 +1,26 @@
const { JSX } = require('typedoc')
const WEBSITE_ID = '4aac3220-0450-44d6-9d0c-8fe7fe8e62bd'
const UMAMI_URL = 'https://zond.tei.su'
const UMAMI_NOSCRIPT = `https://tei.su/zond.php?website=${WEBSITE_ID}`
const { createElement: h } = JSX
function load(app) {
app.renderer.hooks.on('head.end', (event) => {
return h('script', {
async: true,
src: `${UMAMI_URL}/script.js`,
'data-website-id': WEBSITE_ID,
})
})
app.renderer.hooks.on('body.begin', (event) => {
return h(
'noscript',
null,
h('div', null, h('img', { src: UMAMI_NOSCRIPT, style: 'position:absolute; left:-9999px;' })),
)
})
}
module.exports = { load }