This commit is contained in:
2026-07-27 16:42:04 +02:00
parent 45a7704ea6
commit 018b751723
23 changed files with 2327 additions and 635 deletions

View File

@@ -5,6 +5,8 @@ type AnalyticsProperties = Record<string, unknown>;
type SafeAnalytics = {
capture: (event: string, properties?: AnalyticsProperties) => void;
identify: (userId: string, properties?: AnalyticsProperties) => void;
/** Setzt Person-Properties ohne die User-ID zu aendern (z. B. Experiment-Varianten). */
identifyProperties: (properties: AnalyticsProperties) => void;
screen: (name: string, properties?: AnalyticsProperties) => void;
reset: () => void;
};
@@ -46,6 +48,15 @@ const safeAnalytics: SafeAnalytics = {
console.warn('[Analytics] identify failed', error);
}
},
identifyProperties: (properties) => {
try {
// PostHog RN: register() haengt die Properties an alle folgenden Events an,
// damit laesst sich der komplette Funnel nach Variante segmentieren.
client?.register(properties as Record<string, string>);
} catch (error) {
console.warn('[Analytics] identifyProperties failed', error);
}
},
screen: (name, properties) => {
try {
client?.screen(name, properties as Record<string, string>);