fix(analytics): stop identifying Public visitors as page creators
Public generated pages were calling umami.identify(owner_id), collapsing every visitor into the creator session. Anonymous visits now skip identify; logged-in viewers identify with their own distinct id. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
collectInlineScriptHashes,
|
||||
} from '../mindspace-public-delivery.mjs';
|
||||
import {
|
||||
buildViewerAnalyticsIdentity,
|
||||
injectMindSpaceAnalytics,
|
||||
resolveAnalyticsOwnerLabel,
|
||||
resolveAnalyticsOwnerSegment,
|
||||
@@ -51,6 +52,7 @@ async function decoratePublicationHtmlAnalytics(
|
||||
result,
|
||||
analyticsConfig,
|
||||
rybbitConfig,
|
||||
viewer = null,
|
||||
getAuthPool = () => null,
|
||||
getUserAuth = () => null,
|
||||
getMindSpacePages = () => null,
|
||||
@@ -112,6 +114,7 @@ async function decoratePublicationHtmlAnalytics(
|
||||
generatedAt: pageDataContext?.generatedAt ?? '',
|
||||
pageId,
|
||||
publicationId,
|
||||
viewerIdentity: buildViewerAnalyticsIdentity(viewer, analyticsConfig),
|
||||
config: analyticsConfig,
|
||||
});
|
||||
decorated = injectMindSpaceRybbit(decorated, {
|
||||
@@ -215,6 +218,7 @@ export function createPortalPublishedPageDelivery({
|
||||
result,
|
||||
analyticsConfig,
|
||||
rybbitConfig,
|
||||
viewer: req.currentUser ?? null,
|
||||
getAuthPool,
|
||||
getUserAuth,
|
||||
getMindSpacePages,
|
||||
@@ -346,6 +350,7 @@ export function createPortalPublishedPageDelivery({
|
||||
result,
|
||||
analyticsConfig,
|
||||
rybbitConfig,
|
||||
viewer: req.currentUser ?? null,
|
||||
getAuthPool,
|
||||
getUserAuth,
|
||||
getMindSpacePages,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
buildViewerAnalyticsIdentity,
|
||||
injectMindSpaceAnalytics,
|
||||
resolveAnalyticsOwnerLabel,
|
||||
resolveAnalyticsOwnerSegment,
|
||||
@@ -250,6 +251,10 @@ export function createPortalWorkspacePublicationDelivery({
|
||||
pageDataContext?.publicationId ??
|
||||
pageDataContext?.publication_id ??
|
||||
'',
|
||||
viewerIdentity: buildViewerAnalyticsIdentity(
|
||||
req.currentUser ?? null,
|
||||
analyticsConfig,
|
||||
),
|
||||
config: analyticsConfig,
|
||||
});
|
||||
html = injectMindSpaceRybbit(html, {
|
||||
|
||||
Reference in New Issue
Block a user