shell-mirror 1.5.46 → 1.5.47

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shell-mirror",
3
- "version": "1.5.46",
3
+ "version": "1.5.47",
4
4
  "description": "Access your Mac shell from any device securely. Perfect for mobile coding with Claude Code CLI, Gemini CLI, and any shell tool.",
5
5
  "main": "server.js",
6
6
  "bin": {
@@ -4,6 +4,25 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Shell Mirror Dashboard</title>
7
+
8
+ <!-- Google Analytics 4 -->
9
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-LG7ZGLB8FK"></script>
10
+ <script>
11
+ window.dataLayer = window.dataLayer || [];
12
+ function gtag(){dataLayer.push(arguments);}
13
+ gtag('js', new Date());
14
+ gtag('config', 'G-LG7ZGLB8FK');
15
+ </script>
16
+
17
+ <!-- Microsoft Clarity -->
18
+ <script type="text/javascript">
19
+ (function(c,l,a,r,i,t,y){
20
+ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
21
+ t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
22
+ y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
23
+ })(window, document, "clarity", "script", "CLARITY_PROJECT_ID");
24
+ </script>
25
+
7
26
  <link rel="stylesheet" href="dashboard.css">
8
27
  </head>
9
28
  <body>
@@ -429,21 +429,62 @@ class ShellMirrorDashboard {
429
429
  session.lastActivity > latest.lastActivity ? session : latest
430
430
  );
431
431
  console.log(`[DASHBOARD] ✅ Reconnecting to existing session: ${mostRecentSession.id}`);
432
+
433
+ // Track terminal connection in Google Analytics
434
+ if (typeof gtag !== 'undefined') {
435
+ gtag('event', 'terminal_connect', {
436
+ event_category: 'terminal',
437
+ event_label: 'existing_session',
438
+ agent_id: agentId,
439
+ session_id: mostRecentSession.id
440
+ });
441
+ }
442
+
432
443
  window.location.href = `/app/terminal.html?agent=${agentId}&session=${mostRecentSession.id}`;
433
444
  } else {
434
445
  // No existing sessions, create new one
435
446
  console.log(`[DASHBOARD] 🆕 Creating new session for agent: ${agentId}`);
447
+
448
+ // Track new session creation in Google Analytics
449
+ if (typeof gtag !== 'undefined') {
450
+ gtag('event', 'terminal_connect', {
451
+ event_category: 'terminal',
452
+ event_label: 'new_session',
453
+ agent_id: agentId
454
+ });
455
+ }
456
+
436
457
  window.location.href = `/app/terminal.html?agent=${agentId}`;
437
458
  }
438
459
  }
439
460
 
440
461
  async connectToSession(agentId, sessionId) {
462
+ // Track specific session connection in Google Analytics
463
+ if (typeof gtag !== 'undefined') {
464
+ gtag('event', 'terminal_connect', {
465
+ event_category: 'terminal',
466
+ event_label: 'specific_session',
467
+ agent_id: agentId,
468
+ session_id: sessionId
469
+ });
470
+ }
471
+
441
472
  window.location.href = `/app/terminal.html?agent=${agentId}&session=${sessionId}`;
442
473
  }
443
474
 
444
475
  async createNewSession(agentId) {
445
476
  // Force creation of new session by not passing session parameter
446
477
  console.log(`[DASHBOARD] Creating new session for agent: ${agentId}`);
478
+
479
+ // Track explicit new session creation in Google Analytics
480
+ if (typeof gtag !== 'undefined') {
481
+ gtag('event', 'terminal_connect', {
482
+ event_category: 'terminal',
483
+ event_label: 'force_new_session',
484
+ agent_id: agentId
485
+ });
486
+ }
487
+
447
488
  window.location.href = `/app/terminal.html?agent=${agentId}`;
448
489
  }
449
490
 
@@ -2,6 +2,25 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Terminal Mirror</title>
5
+
6
+ <!-- Google Analytics 4 -->
7
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-LG7ZGLB8FK"></script>
8
+ <script>
9
+ window.dataLayer = window.dataLayer || [];
10
+ function gtag(){dataLayer.push(arguments);}
11
+ gtag('js', new Date());
12
+ gtag('config', 'G-LG7ZGLB8FK');
13
+ </script>
14
+
15
+ <!-- Microsoft Clarity -->
16
+ <script type="text/javascript">
17
+ (function(c,l,a,r,i,t,y){
18
+ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
19
+ t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
20
+ y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
21
+ })(window, document, "clarity", "script", "CLARITY_PROJECT_ID");
22
+ </script>
23
+
5
24
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@4.15.0/css/xterm.css" />
6
25
  <script src="https://cdn.jsdelivr.net/npm/xterm@4.15.0/lib/xterm.js"></script>
7
26
  <script src="https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.js"></script>
@@ -233,6 +233,17 @@ function startConnection() {
233
233
  connectContainer.style.display = 'none';
234
234
  terminalContainer.classList.add('show');
235
235
  term.open(document.getElementById('terminal'));
236
+
237
+ // Track terminal session start in Google Analytics
238
+ if (typeof gtag !== 'undefined') {
239
+ gtag('event', 'terminal_session_start', {
240
+ event_category: 'terminal',
241
+ event_label: requestedSessionId ? 'existing_session' : 'new_session',
242
+ agent_id: AGENT_ID,
243
+ session_id: requestedSessionId || 'new'
244
+ });
245
+ }
246
+
236
247
  // Delay fit to ensure proper dimensions after CSS transitions
237
248
  setTimeout(() => {
238
249
  fitAddon.fit();
@@ -520,6 +531,16 @@ async function createPeerConnection() {
520
531
  case 'connected':
521
532
  console.log('[CLIENT] ✅ WebRTC connection established!');
522
533
  updateConnectionStatus('connected');
534
+
535
+ // Track successful connection in Google Analytics
536
+ if (typeof gtag !== 'undefined') {
537
+ gtag('event', 'terminal_connection_success', {
538
+ event_category: 'terminal',
539
+ event_label: 'webrtc_established',
540
+ agent_id: AGENT_ID
541
+ });
542
+ }
543
+
523
544
  break;
524
545
  case 'completed':
525
546
  console.log('[CLIENT] ✅ ICE connection completed successfully!');
package/public/index.html CHANGED
@@ -18,6 +18,24 @@
18
18
  <meta property="twitter:title" content="Shell Mirror - Use Claude Code CLI from your phone">
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
+ <!-- Google Analytics 4 -->
22
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-LG7ZGLB8FK"></script>
23
+ <script>
24
+ window.dataLayer = window.dataLayer || [];
25
+ function gtag(){dataLayer.push(arguments);}
26
+ gtag('js', new Date());
27
+ gtag('config', 'G-LG7ZGLB8FK');
28
+ </script>
29
+
30
+ <!-- Microsoft Clarity -->
31
+ <script type="text/javascript">
32
+ (function(c,l,a,r,i,t,y){
33
+ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
34
+ t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
35
+ y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
36
+ })(window, document, "clarity", "script", "CLARITY_PROJECT_ID");
37
+ </script>
38
+
21
39
  <style>
22
40
  * {
23
41
  margin: 0;
@@ -679,12 +697,28 @@
679
697
 
680
698
  // Handle Google login - direct web OAuth
681
699
  async function handleGoogleLogin() {
700
+ // Track login attempt in Google Analytics
701
+ if (typeof gtag !== 'undefined') {
702
+ gtag('event', 'login_attempt', {
703
+ event_category: 'authentication',
704
+ event_label: 'google_oauth'
705
+ });
706
+ }
707
+
682
708
  // Direct OAuth flow using the web backend
683
709
  window.location.href = '/php-backend/api/auth-login.php?return=' + encodeURIComponent('/app/dashboard');
684
710
  }
685
711
 
686
712
  // Handle dashboard navigation
687
713
  async function openDashboard() {
714
+ // Track dashboard access in Google Analytics
715
+ if (typeof gtag !== 'undefined') {
716
+ gtag('event', 'dashboard_access', {
717
+ event_category: 'navigation',
718
+ event_label: 'from_landing_page'
719
+ });
720
+ }
721
+
688
722
  window.location.href = '/app/dashboard.html';
689
723
  }
690
724