feat: add attributable page analytics
This commit is contained in:
@@ -5,8 +5,10 @@ type AnalyticsIdentity = {
|
||||
distinctId: string;
|
||||
username: string;
|
||||
ownerSegment: string;
|
||||
planType: string;
|
||||
channel: string;
|
||||
surface: 'product';
|
||||
identityMode: 'raw' | 'pseudonymous';
|
||||
};
|
||||
|
||||
type ProductAnalyticsContext = {
|
||||
@@ -160,6 +162,8 @@ function trackProductEvent(
|
||||
route_name: resolveProductRouteName(window.location.pathname),
|
||||
channel: identity?.channel || 'h5',
|
||||
owner_segment: identity?.ownerSegment || 'anonymous',
|
||||
plan_type: identity?.planType || 'anonymous',
|
||||
identity_mode: identity?.identityMode || 'anonymous',
|
||||
...data,
|
||||
},
|
||||
}));
|
||||
@@ -203,8 +207,10 @@ export function useProductAnalytics(userId?: string | null) {
|
||||
void window.umami?.identify(identity.distinctId, {
|
||||
username: identity.username,
|
||||
owner_segment: identity.ownerSegment,
|
||||
plan_type: identity.planType,
|
||||
channel: identity.channel,
|
||||
surface: identity.surface,
|
||||
identity_mode: identity.identityMode,
|
||||
});
|
||||
}
|
||||
} else if (lastIdentityKey) {
|
||||
|
||||
Reference in New Issue
Block a user