shell-mirror 1.5.47 → 1.5.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/app/dashboard.html +29 -1
- package/public/app/dashboard.js +25 -8
- package/public/app/terminal.html +29 -1
- package/public/app/terminal.js +19 -4
- package/public/index.html +55 -13
package/package.json
CHANGED
|
@@ -6,12 +6,40 @@
|
|
|
6
6
|
<title>Shell Mirror Dashboard</title>
|
|
7
7
|
|
|
8
8
|
<!-- Google Analytics 4 -->
|
|
9
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=G-LG7ZGLB8FK"></script>
|
|
10
9
|
<script>
|
|
10
|
+
// Initialize dataLayer and gtag function first
|
|
11
11
|
window.dataLayer = window.dataLayer || [];
|
|
12
12
|
function gtag(){dataLayer.push(arguments);}
|
|
13
13
|
gtag('js', new Date());
|
|
14
14
|
gtag('config', 'G-LG7ZGLB8FK');
|
|
15
|
+
|
|
16
|
+
// Load gtag script with proper error handling
|
|
17
|
+
(function() {
|
|
18
|
+
var script = document.createElement('script');
|
|
19
|
+
script.async = true;
|
|
20
|
+
script.src = 'https://www.googletagmanager.com/gtag/js?id=G-LG7ZGLB8FK';
|
|
21
|
+
script.onload = function() {
|
|
22
|
+
console.log('✅ Google Analytics script loaded successfully');
|
|
23
|
+
window.gtagLoaded = true;
|
|
24
|
+
};
|
|
25
|
+
script.onerror = function() {
|
|
26
|
+
console.warn('❌ Failed to load Google Analytics script');
|
|
27
|
+
window.gtagLoaded = false;
|
|
28
|
+
};
|
|
29
|
+
document.head.appendChild(script);
|
|
30
|
+
})();
|
|
31
|
+
|
|
32
|
+
// Google Analytics helper function
|
|
33
|
+
function sendGAEvent(eventName, eventParams) {
|
|
34
|
+
if (typeof gtag === 'function') {
|
|
35
|
+
console.log('📊 [GA] Sending event:', eventName, eventParams);
|
|
36
|
+
gtag('event', eventName, eventParams);
|
|
37
|
+
return true;
|
|
38
|
+
} else {
|
|
39
|
+
console.warn('❌ [GA] gtag not available, event not sent:', eventName);
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
15
43
|
</script>
|
|
16
44
|
|
|
17
45
|
<!-- Microsoft Clarity -->
|
package/public/app/dashboard.js
CHANGED
|
@@ -13,6 +13,23 @@ class ShellMirrorDashboard {
|
|
|
13
13
|
this.showLoading();
|
|
14
14
|
this.loadVersionInfo(); // Load version info immediately
|
|
15
15
|
|
|
16
|
+
// Wait for GA script to load and send page view
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
console.log('🔍 [DASHBOARD DEBUG] Checking Google Analytics setup...');
|
|
19
|
+
console.log('🔍 [DASHBOARD DEBUG] gtag function type:', typeof gtag);
|
|
20
|
+
console.log('🔍 [DASHBOARD DEBUG] gtagLoaded flag:', window.gtagLoaded);
|
|
21
|
+
|
|
22
|
+
// Send dashboard page view event
|
|
23
|
+
if (typeof sendGAEvent === 'function') {
|
|
24
|
+
sendGAEvent('page_view', {
|
|
25
|
+
page_title: 'Shell Mirror Dashboard',
|
|
26
|
+
page_location: window.location.href
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
console.warn('❌ [DASHBOARD DEBUG] sendGAEvent function not available');
|
|
30
|
+
}
|
|
31
|
+
}, 1000);
|
|
32
|
+
|
|
16
33
|
try {
|
|
17
34
|
const authStatus = await this.checkAuthStatus();
|
|
18
35
|
|
|
@@ -431,8 +448,8 @@ class ShellMirrorDashboard {
|
|
|
431
448
|
console.log(`[DASHBOARD] ✅ Reconnecting to existing session: ${mostRecentSession.id}`);
|
|
432
449
|
|
|
433
450
|
// Track terminal connection in Google Analytics
|
|
434
|
-
if (typeof
|
|
435
|
-
|
|
451
|
+
if (typeof sendGAEvent === 'function') {
|
|
452
|
+
sendGAEvent('terminal_connect', {
|
|
436
453
|
event_category: 'terminal',
|
|
437
454
|
event_label: 'existing_session',
|
|
438
455
|
agent_id: agentId,
|
|
@@ -446,8 +463,8 @@ class ShellMirrorDashboard {
|
|
|
446
463
|
console.log(`[DASHBOARD] 🆕 Creating new session for agent: ${agentId}`);
|
|
447
464
|
|
|
448
465
|
// Track new session creation in Google Analytics
|
|
449
|
-
if (typeof
|
|
450
|
-
|
|
466
|
+
if (typeof sendGAEvent === 'function') {
|
|
467
|
+
sendGAEvent('terminal_connect', {
|
|
451
468
|
event_category: 'terminal',
|
|
452
469
|
event_label: 'new_session',
|
|
453
470
|
agent_id: agentId
|
|
@@ -460,8 +477,8 @@ class ShellMirrorDashboard {
|
|
|
460
477
|
|
|
461
478
|
async connectToSession(agentId, sessionId) {
|
|
462
479
|
// Track specific session connection in Google Analytics
|
|
463
|
-
if (typeof
|
|
464
|
-
|
|
480
|
+
if (typeof sendGAEvent === 'function') {
|
|
481
|
+
sendGAEvent('terminal_connect', {
|
|
465
482
|
event_category: 'terminal',
|
|
466
483
|
event_label: 'specific_session',
|
|
467
484
|
agent_id: agentId,
|
|
@@ -477,8 +494,8 @@ class ShellMirrorDashboard {
|
|
|
477
494
|
console.log(`[DASHBOARD] Creating new session for agent: ${agentId}`);
|
|
478
495
|
|
|
479
496
|
// Track explicit new session creation in Google Analytics
|
|
480
|
-
if (typeof
|
|
481
|
-
|
|
497
|
+
if (typeof sendGAEvent === 'function') {
|
|
498
|
+
sendGAEvent('terminal_connect', {
|
|
482
499
|
event_category: 'terminal',
|
|
483
500
|
event_label: 'force_new_session',
|
|
484
501
|
agent_id: agentId
|
package/public/app/terminal.html
CHANGED
|
@@ -4,12 +4,40 @@
|
|
|
4
4
|
<title>Terminal Mirror</title>
|
|
5
5
|
|
|
6
6
|
<!-- Google Analytics 4 -->
|
|
7
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=G-LG7ZGLB8FK"></script>
|
|
8
7
|
<script>
|
|
8
|
+
// Initialize dataLayer and gtag function first
|
|
9
9
|
window.dataLayer = window.dataLayer || [];
|
|
10
10
|
function gtag(){dataLayer.push(arguments);}
|
|
11
11
|
gtag('js', new Date());
|
|
12
12
|
gtag('config', 'G-LG7ZGLB8FK');
|
|
13
|
+
|
|
14
|
+
// Load gtag script with proper error handling
|
|
15
|
+
(function() {
|
|
16
|
+
var script = document.createElement('script');
|
|
17
|
+
script.async = true;
|
|
18
|
+
script.src = 'https://www.googletagmanager.com/gtag/js?id=G-LG7ZGLB8FK';
|
|
19
|
+
script.onload = function() {
|
|
20
|
+
console.log('✅ Google Analytics script loaded successfully');
|
|
21
|
+
window.gtagLoaded = true;
|
|
22
|
+
};
|
|
23
|
+
script.onerror = function() {
|
|
24
|
+
console.warn('❌ Failed to load Google Analytics script');
|
|
25
|
+
window.gtagLoaded = false;
|
|
26
|
+
};
|
|
27
|
+
document.head.appendChild(script);
|
|
28
|
+
})();
|
|
29
|
+
|
|
30
|
+
// Google Analytics helper function
|
|
31
|
+
function sendGAEvent(eventName, eventParams) {
|
|
32
|
+
if (typeof gtag === 'function') {
|
|
33
|
+
console.log('📊 [GA] Sending event:', eventName, eventParams);
|
|
34
|
+
gtag('event', eventName, eventParams);
|
|
35
|
+
return true;
|
|
36
|
+
} else {
|
|
37
|
+
console.warn('❌ [GA] gtag not available, event not sent:', eventName);
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
13
41
|
</script>
|
|
14
42
|
|
|
15
43
|
<!-- Microsoft Clarity -->
|
package/public/app/terminal.js
CHANGED
|
@@ -180,6 +180,21 @@ setInterval(() => {
|
|
|
180
180
|
window.addEventListener('load', () => {
|
|
181
181
|
loadVersionInfo();
|
|
182
182
|
|
|
183
|
+
// Wait for GA script to load and send page view
|
|
184
|
+
setTimeout(() => {
|
|
185
|
+
console.log('🔍 [TERMINAL DEBUG] Checking Google Analytics setup...');
|
|
186
|
+
console.log('🔍 [TERMINAL DEBUG] gtag function type:', typeof gtag);
|
|
187
|
+
console.log('🔍 [TERMINAL DEBUG] gtagLoaded flag:', window.gtagLoaded);
|
|
188
|
+
|
|
189
|
+
// Send terminal page view event
|
|
190
|
+
if (typeof sendGAEvent === 'function') {
|
|
191
|
+
sendGAEvent('page_view', {
|
|
192
|
+
page_title: 'Shell Mirror Terminal',
|
|
193
|
+
page_location: window.location.href
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}, 1000);
|
|
197
|
+
|
|
183
198
|
// Get agent ID and session ID from URL parameters
|
|
184
199
|
const urlParams = new URLSearchParams(window.location.search);
|
|
185
200
|
const agentId = urlParams.get('agent');
|
|
@@ -235,8 +250,8 @@ function startConnection() {
|
|
|
235
250
|
term.open(document.getElementById('terminal'));
|
|
236
251
|
|
|
237
252
|
// Track terminal session start in Google Analytics
|
|
238
|
-
if (typeof
|
|
239
|
-
|
|
253
|
+
if (typeof sendGAEvent === 'function') {
|
|
254
|
+
sendGAEvent('terminal_session_start', {
|
|
240
255
|
event_category: 'terminal',
|
|
241
256
|
event_label: requestedSessionId ? 'existing_session' : 'new_session',
|
|
242
257
|
agent_id: AGENT_ID,
|
|
@@ -533,8 +548,8 @@ async function createPeerConnection() {
|
|
|
533
548
|
updateConnectionStatus('connected');
|
|
534
549
|
|
|
535
550
|
// Track successful connection in Google Analytics
|
|
536
|
-
if (typeof
|
|
537
|
-
|
|
551
|
+
if (typeof sendGAEvent === 'function') {
|
|
552
|
+
sendGAEvent('terminal_connection_success', {
|
|
538
553
|
event_category: 'terminal',
|
|
539
554
|
event_label: 'webrtc_established',
|
|
540
555
|
agent_id: AGENT_ID
|
package/public/index.html
CHANGED
|
@@ -19,12 +19,28 @@
|
|
|
19
19
|
<meta property="twitter:description" content="Access your Mac terminal from your phone to use Claude Code CLI, Gemini CLI, and other command-line tools.">
|
|
20
20
|
|
|
21
21
|
<!-- Google Analytics 4 -->
|
|
22
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=G-LG7ZGLB8FK"></script>
|
|
23
22
|
<script>
|
|
23
|
+
// Initialize dataLayer and gtag function first
|
|
24
24
|
window.dataLayer = window.dataLayer || [];
|
|
25
25
|
function gtag(){dataLayer.push(arguments);}
|
|
26
26
|
gtag('js', new Date());
|
|
27
27
|
gtag('config', 'G-LG7ZGLB8FK');
|
|
28
|
+
|
|
29
|
+
// Load gtag script with proper error handling
|
|
30
|
+
(function() {
|
|
31
|
+
var script = document.createElement('script');
|
|
32
|
+
script.async = true;
|
|
33
|
+
script.src = 'https://www.googletagmanager.com/gtag/js?id=G-LG7ZGLB8FK';
|
|
34
|
+
script.onload = function() {
|
|
35
|
+
console.log('✅ Google Analytics script loaded successfully');
|
|
36
|
+
window.gtagLoaded = true;
|
|
37
|
+
};
|
|
38
|
+
script.onerror = function() {
|
|
39
|
+
console.warn('❌ Failed to load Google Analytics script');
|
|
40
|
+
window.gtagLoaded = false;
|
|
41
|
+
};
|
|
42
|
+
document.head.appendChild(script);
|
|
43
|
+
})();
|
|
28
44
|
</script>
|
|
29
45
|
|
|
30
46
|
<!-- Microsoft Clarity -->
|
|
@@ -697,13 +713,13 @@
|
|
|
697
713
|
|
|
698
714
|
// Handle Google login - direct web OAuth
|
|
699
715
|
async function handleGoogleLogin() {
|
|
716
|
+
console.log('🔍 [DEBUG] Login button clicked');
|
|
717
|
+
|
|
700
718
|
// Track login attempt in Google Analytics
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
});
|
|
706
|
-
}
|
|
719
|
+
sendGAEvent('login_attempt', {
|
|
720
|
+
event_category: 'authentication',
|
|
721
|
+
event_label: 'google_oauth'
|
|
722
|
+
});
|
|
707
723
|
|
|
708
724
|
// Direct OAuth flow using the web backend
|
|
709
725
|
window.location.href = '/php-backend/api/auth-login.php?return=' + encodeURIComponent('/app/dashboard');
|
|
@@ -711,13 +727,13 @@
|
|
|
711
727
|
|
|
712
728
|
// Handle dashboard navigation
|
|
713
729
|
async function openDashboard() {
|
|
730
|
+
console.log('🔍 [DEBUG] Dashboard button clicked');
|
|
731
|
+
|
|
714
732
|
// Track dashboard access in Google Analytics
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
});
|
|
720
|
-
}
|
|
733
|
+
sendGAEvent('dashboard_access', {
|
|
734
|
+
event_category: 'navigation',
|
|
735
|
+
event_label: 'from_landing_page'
|
|
736
|
+
});
|
|
721
737
|
|
|
722
738
|
window.location.href = '/app/dashboard.html';
|
|
723
739
|
}
|
|
@@ -745,8 +761,34 @@
|
|
|
745
761
|
}
|
|
746
762
|
}
|
|
747
763
|
|
|
764
|
+
// Google Analytics helper function
|
|
765
|
+
function sendGAEvent(eventName, eventParams) {
|
|
766
|
+
if (typeof gtag === 'function') {
|
|
767
|
+
console.log('📊 [GA] Sending event:', eventName, eventParams);
|
|
768
|
+
gtag('event', eventName, eventParams);
|
|
769
|
+
return true;
|
|
770
|
+
} else {
|
|
771
|
+
console.warn('❌ [GA] gtag not available, event not sent:', eventName);
|
|
772
|
+
return false;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
748
776
|
// Initialize page on load
|
|
749
777
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
778
|
+
// Wait a moment for GA script to load
|
|
779
|
+
setTimeout(() => {
|
|
780
|
+
console.log('🔍 [DEBUG] Checking Google Analytics setup...');
|
|
781
|
+
console.log('🔍 [DEBUG] gtag function type:', typeof gtag);
|
|
782
|
+
console.log('🔍 [DEBUG] dataLayer exists:', typeof window.dataLayer !== 'undefined');
|
|
783
|
+
console.log('🔍 [DEBUG] gtagLoaded flag:', window.gtagLoaded);
|
|
784
|
+
|
|
785
|
+
// Send test event
|
|
786
|
+
sendGAEvent('page_view', {
|
|
787
|
+
page_title: 'Shell Mirror Landing',
|
|
788
|
+
page_location: window.location.href
|
|
789
|
+
});
|
|
790
|
+
}, 1000);
|
|
791
|
+
|
|
750
792
|
await updateHeaderAndCTA();
|
|
751
793
|
loadVersionInfo();
|
|
752
794
|
});
|