-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathanalytics-config.js
More file actions
101 lines (92 loc) · 3.29 KB
/
analytics-config.js
File metadata and controls
101 lines (92 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/**
* Analytics Configuration
* Centralized configuration for all analytics and monitoring systems
*/
window.ANALYTICS_CONFIG = {
// Google Analytics 4 Configuration
googleAnalytics: {
measurementId: 'G-XXXXXXXXXX', // Replace with actual GA4 measurement ID
enableDebugMode: false, // Set to true for development
sampleRate: 100, // 100% sampling for production
enableUserConsent: true,
enableCookieConsent: true
},
// Core Web Vitals Monitoring Configuration
coreWebVitals: {
enableContinuousMonitoring: true,
enableAlerts: true,
enableDashboard: true,
monitoringInterval: 30000, // 30 seconds
alertCooldown: 300000, // 5 minutes
alertThresholds: {
LCP: { warning: 2500, critical: 4000 },
FID: { warning: 100, critical: 300 },
CLS: { warning: 0.1, critical: 0.25 },
FCP: { warning: 1800, critical: 3000 },
TTFB: { warning: 800, critical: 1800 }
}
},
// User Behavior Tracking Configuration
userBehavior: {
enableContentTracking: true,
enableNavigationTracking: true,
enableDownloadTracking: true,
enableHeatmapTracking: true,
enableScrollTracking: true,
enableClickTracking: true,
enableFormTracking: true,
enableSearchTracking: true,
heatmapSampleRate: 0.1, // 10% of users for heatmap
trackingInterval: 5000, // 5 seconds
maxEventsPerSession: 1000
},
// Cross-Page Integration Analytics Configuration
crossPageIntegration: {
enableCrossPageTracking: true,
enableContentPreviewTracking: true,
enableRelatedContentTracking: true,
enableBreadcrumbTracking: true,
enableUserJourneyTracking: true,
enableFeatureFlagTracking: true,
trackingBatchSize: 10,
trackingBatchInterval: 300000, // 5 minutes
enablePerformanceMonitoring: true,
enableConversionTracking: true,
sessionTimeout: 1800000, // 30 minutes
enableDebugMode: false
},
// Privacy and Compliance
privacy: {
enableConsentBanner: true,
consentExpiryDays: 30,
enableDataMinimization: true,
enableAnonymization: true,
respectDoNotTrack: true
},
// Development and Debugging
development: {
enableConsoleLogging: false, // Set to true for development
enableDebugDashboard: false,
enableTestMode: false
},
// Performance Optimization
performance: {
enableLazyLoading: true,
enableScriptDefer: true,
enableEventThrottling: true,
batchEventSending: true,
maxBatchSize: 50
}
};
// Environment-specific overrides
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
// Development environment
window.ANALYTICS_CONFIG.googleAnalytics.enableDebugMode = true;
window.ANALYTICS_CONFIG.development.enableConsoleLogging = true;
window.ANALYTICS_CONFIG.development.enableDebugDashboard = true;
window.ANALYTICS_CONFIG.userBehavior.heatmapSampleRate = 1.0; // 100% in development
}
// Export configuration
if (typeof module !== 'undefined' && module.exports) {
module.exports = window.ANALYTICS_CONFIG;
}