Skip to content

Commit 335c655

Browse files
Merge pull request #58 from thefirehacker/3.6.0_Voice_DeepResearchPlayground_Integration
amplify yml config changes
2 parents f47c55f + ef5298e commit 335c655

File tree

2 files changed

+115
-2
lines changed

2 files changed

+115
-2
lines changed

amplify.yml

Lines changed: 113 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ frontend:
4242
site_name: this.SITE_NAME
4343
});
4444
45-
console.log(\` Google Analytics 4 initialized with ID: \${this.GA4_MEASUREMENT_ID}\`);
45+
console.log(\`✅ Google Analytics 4 initialized with ID: \${this.GA4_MEASUREMENT_ID}\`);
4646
}
4747
4848
// Method to track custom events
@@ -53,7 +53,7 @@ frontend:
5353
event_label: label,
5454
value: value
5555
});
56-
console.log(\`📊 GA4 Event tracked: \${action} (\${category})\`);
56+
console.log(\`📊 GA4 Event tracked: \${action} (\${category})\`);
5757
}
5858
}
5959
@@ -66,6 +66,117 @@ frontend:
6666
});
6767
}
6868
}
69+
70+
// Enhanced tracking methods for comprehensive analytics
71+
trackKeyEvent(action, details = {}) {
72+
if (window.gtag) {
73+
gtag('event', action, {
74+
event_category: 'key_interaction',
75+
custom_parameters: details,
76+
...details
77+
});
78+
console.log(\`🔑 Key Event tracked: \${action}\`, details);
79+
}
80+
}
81+
82+
trackNavigation(item, location = '') {
83+
if (window.gtag) {
84+
gtag('event', 'navigation_click', {
85+
event_category: 'navigation',
86+
nav_item: item,
87+
nav_location: location
88+
});
89+
console.log(\`🧭 Navigation tracked: \${item} at \${location}\`);
90+
}
91+
}
92+
93+
trackModal(action, modalName) {
94+
if (window.gtag) {
95+
gtag('event', \`modal_\${action}\`, {
96+
event_category: 'modal_interaction',
97+
modal_name: modalName
98+
});
99+
console.log(\`📱 Modal tracked: \${action} - \${modalName}\`);
100+
}
101+
}
102+
103+
trackAIInteraction(provider, action, details = {}) {
104+
if (window.gtag) {
105+
gtag('event', 'ai_interaction', {
106+
event_category: 'ai_usage',
107+
ai_provider: provider,
108+
ai_action: action,
109+
...details
110+
});
111+
console.log(\`🤖 AI Interaction tracked: \${provider} - \${action}\`, details);
112+
}
113+
}
114+
115+
trackDocumentOperation(operation, details = {}) {
116+
if (window.gtag) {
117+
gtag('event', 'document_operation', {
118+
event_category: 'document_management',
119+
doc_operation: operation,
120+
...details
121+
});
122+
console.log(\`📄 Document Operation tracked: \${operation}\`, details);
123+
}
124+
}
125+
126+
trackResearchOperation(operation, details = {}) {
127+
if (window.gtag) {
128+
gtag('event', 'research_operation', {
129+
event_category: 'research_activity',
130+
research_operation: operation,
131+
...details
132+
});
133+
console.log(\`🔬 Research Operation tracked: \${operation}\`, details);
134+
}
135+
}
136+
137+
trackChatInteraction(method, details = {}) {
138+
if (window.gtag) {
139+
gtag('event', 'chat_interaction', {
140+
event_category: 'chat_usage',
141+
interaction_method: method,
142+
...details
143+
});
144+
console.log(\`💬 Chat Interaction tracked: \${method}\`, details);
145+
}
146+
}
147+
148+
// Device and capability tracking
149+
trackDeviceInfo() {
150+
if (window.gtag) {
151+
const deviceInfo = {
152+
screen_resolution: \`\${screen.width}x\${screen.height}\`,
153+
viewport_size: \`\${window.innerWidth}x\${window.innerHeight}\`,
154+
user_agent: navigator.userAgent,
155+
platform: navigator.platform,
156+
language: navigator.language,
157+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
158+
connection_type: navigator.connection ? navigator.connection.effectiveType : 'unknown',
159+
device_memory: navigator.deviceMemory || 'unknown',
160+
hardware_concurrency: navigator.hardwareConcurrency || 'unknown'
161+
};
162+
163+
gtag('event', 'device_info', {
164+
event_category: 'device_analytics',
165+
...deviceInfo
166+
});
167+
168+
console.log('📱 Device Info tracked:', deviceInfo);
169+
}
170+
}
171+
172+
// Debug helper
173+
debugAnalytics() {
174+
console.log('🔍 Analytics Debug Info:');
175+
console.log(' - GA4 ID:', this.GA4_MEASUREMENT_ID);
176+
console.log(' - gtag available:', !!window.gtag);
177+
console.log(' - dataLayer length:', window.dataLayer ? window.dataLayer.length : 0);
178+
console.log(' - Available methods:', Object.getOwnPropertyNames(Object.getPrototypeOf(this)));
179+
}
69180
}
70181
71182
// Create global config instance

doc/forAI/commonFixesforAI.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
### Analytics & Window Object Method Calls
44
- **ALWAYS check method existence**: Use `if (window.AppConfig && typeof window.AppConfig.methodName === 'function')` before calling any window object methods
55
- **Never assume methods exist**: Even if the object exists, the specific method might not be loaded yet or could be missing
6+
- **AWS Amplify overwrites files**: If using Amplify, ensure all tracking methods are included in `amplify.yml` config generation, not just local files
7+
- **Deployment sync**: After updating `amplify.yml`, push to repo - Amplify auto-detects and rebuilds with new configuration

0 commit comments

Comments
 (0)