Add participant name to page title for Matomo tracking
This commit is contained in:
@@ -167,8 +167,9 @@ if (isProduction) {
|
||||
// Insert OG tags before </head>
|
||||
html = html.replace('</head>', `${ogTags}</head>`);
|
||||
|
||||
// Update title
|
||||
html = html.replace(/<title>.*?<\/title>/, `<title>${title} - Activiteiten Inventaris</title>`);
|
||||
// Update title - include participant name for Matomo tracking
|
||||
const pageTitle = `${title} - ${participant.name}`;
|
||||
html = html.replace(/<title>.*?<\/title>/, `<title>${pageTitle}</title>`);
|
||||
|
||||
res.send(html);
|
||||
});
|
||||
|
||||
@@ -65,6 +65,16 @@ export function PublicQuestionnaire({ accessToken }: { accessToken?: string } =
|
||||
fetchQuestionnaire()
|
||||
}, [slug, effectiveToken])
|
||||
|
||||
// Update document title for Matomo tracking
|
||||
useEffect(() => {
|
||||
if (questionnaire) {
|
||||
const title = visitorName
|
||||
? `${questionnaire.title} - ${visitorName}`
|
||||
: questionnaire.title
|
||||
document.title = title
|
||||
}
|
||||
}, [questionnaire, visitorName])
|
||||
|
||||
async function fetchQuestionnaire() {
|
||||
try {
|
||||
// Use token-based access if available
|
||||
|
||||
Reference in New Issue
Block a user