@tinytapanalytics/sdk
Version:
Behavioral psychology platform that detects visitor frustration, predicts abandonment, and helps you save at-risk conversions in real-time
133 lines • 3 kB
TypeScript
/**
* Advanced Analytics features for detailed user behavior analysis
* Dynamically imported to reduce core bundle size
*/
import { TinyTapAnalyticsConfig } from '../types/index';
interface SessionData {
id: string;
startTime: number;
lastActivity: number;
pageViews: number;
events: number;
duration: number;
}
interface FunnelStep {
name: string;
selector?: string;
event?: string;
url?: string;
}
export declare class AdvancedAnalytics {
private config;
private sdk;
private sessionData;
private userJourney;
private heatmapData;
constructor(config: TinyTapAnalyticsConfig, sdk: any);
/**
* Initialize session tracking
*/
private initializeSession;
/**
* Start session tracking
*/
private startSessionTracking;
/**
* Update session activity
*/
private updateSessionActivity;
/**
* Track page view with enhanced data
*/
trackPageView(url?: string): void;
/**
* Track user engagement metrics
*/
trackEngagement(): void;
/**
* Setup funnel analysis
*/
setupFunnelAnalysis(steps: FunnelStep[]): void;
/**
* Observe funnel step by element selector
*/
private observeFunnelStep;
/**
* Track funnel step by URL
*/
private trackURLFunnelStep;
/**
* Record funnel step completion
*/
private recordFunnelStep;
/**
* Track user cohort analysis
*/
trackCohort(cohortName: string, userAttributes?: Record<string, any>): void;
/**
* Track attribution data
*/
trackAttribution(): void;
/**
* Track conversion funnel
*/
trackConversionFunnel(funnelName: string, stepName: string, value?: number): void;
/**
* Track user segment
*/
trackUserSegment(segment: string, properties?: Record<string, any>): void;
/**
* Get user journey snapshot
*/
private getUserJourneySnapshot;
/**
* Calculate scroll depth
*/
private calculateScrollDepth;
/**
* Get session click count
*/
private getSessionClickCount;
/**
* Check if this is the user's first visit
*/
private isFirstVisit;
/**
* Get traffic source
*/
private getTrafficSource;
/**
* Get traffic medium
*/
private getTrafficMedium;
/**
* Get campaign information
*/
private getCampaign;
/**
* End session and send final data
*/
private endSession;
/**
* Generate session ID
*/
private generateSessionId;
/**
* Get current session data
*/
getSessionData(): SessionData;
/**
* Get user journey
*/
getUserJourney(): Array<{
timestamp: number;
event: string;
data: any;
}>;
/**
* Add custom event to user journey
*/
addToUserJourney(event: string, data: any): void;
}
export {};
//# sourceMappingURL=AdvancedAnalytics.d.ts.map