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>
|
// Insert OG tags before </head>
|
||||||
html = html.replace('</head>', `${ogTags}</head>`);
|
html = html.replace('</head>', `${ogTags}</head>`);
|
||||||
|
|
||||||
// Update title
|
// Update title - include participant name for Matomo tracking
|
||||||
html = html.replace(/<title>.*?<\/title>/, `<title>${title} - Activiteiten Inventaris</title>`);
|
const pageTitle = `${title} - ${participant.name}`;
|
||||||
|
html = html.replace(/<title>.*?<\/title>/, `<title>${pageTitle}</title>`);
|
||||||
|
|
||||||
res.send(html);
|
res.send(html);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -65,6 +65,16 @@ export function PublicQuestionnaire({ accessToken }: { accessToken?: string } =
|
|||||||
fetchQuestionnaire()
|
fetchQuestionnaire()
|
||||||
}, [slug, effectiveToken])
|
}, [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() {
|
async function fetchQuestionnaire() {
|
||||||
try {
|
try {
|
||||||
// Use token-based access if available
|
// Use token-based access if available
|
||||||
|
|||||||
Reference in New Issue
Block a user